From: andy@physast.uga.edu (Andreas Schweitzer)
Subject: Compiling on non-glibc2.07 systems, was: Re: e3 1.4 and a httpd
Newsgroups: floppyfw.general
Date: Sat, 10 Mar 2001 18:33:18 +0000 (UTC)
Organization: Hyssing.net
Reply-To: andy@physast.uga.edu

On Sat, 10 Mar 2001 15:06:37 +0100,
benoit mortier <opensides@caramail.com> wrote:
>In article <slrn9ajrhg.2k1.andy@logic.reptile.house>,
>andy@logic.reptile.house  wrote:
>
>> - I compiled the http server on Mandrake7.2 but had
>>   to install the glibc2.0.7 compatibility libraries to make it work (if
>>   anybody is interested in such tips ...).
>
>yes i am interested in this !

To get executables for FloppyFW on systems that don't have glibc2.0.7
(like RedHat6.2+ and Mandrake 7.2+) one needs one to two things :
A compiler (more or less Mandrake only) and the glibc2.0.7 :

1.) The Compiler
   Basically every compiler should work. However, Mandrake optimizes
   for pentium and floppyfw should not be optimized for pentium.
   Therefore I would try  2 things :
   a) always use the -m388 -march=i386 flags when defining the compiler.
      i.e. change the lines in the Makefile that have
      CC = gcc   to   CC = gcc -m388 -march=i386
   b) Mandrake's default compiler is not the standard one. If you are
      cautions you also might want to try to use egcs instead. Mandrake
      has an egcs package. To call egcs instead of gcc, first find the
      version with "egcs-version" (for me it is egcs-2.91.66), then
      edit the Makefile and substitute
      CC = gcc  with CC = gcc -V egcs-2.91.66
      you can, of course do a) and b)

2.) The correct library
   On Mandrake7.2 system, you can install the package
   compat-glibc-5.3-2.0.7.9mdk. This includes runtime libraries, headers
   and all you need to make 2.0.7 executables. RedHat probably has
   something like that, too. You might want to try to install
   the Mandrake rpms which can be found from a site listed on
   http://www.linux-mandrake.com/en/ftp.php3 as
   Mandrake/7.2/i586/Mandrake/RPMS/compat-glibc-5.3-2.0.7.9mdk.rpm
   
   First thing in the Makefile, make sure you use the 2.0.7 header
   files, best thing is to add it to CFLAGS. e.g. substitute
   CFLAGS = -O   with  CFLAGS = -O -I/usr/i386-glibc20-linux/include
   or wherever your package put the header files.

   Now, it's time to reveal my dirty tricks :-). There may be a better
   way to do it, but I didn't want to try out much more last night.
   I changed the linker flags in the Makefile, i.e. it looks now
   LDFLAGS =   -s -nostdlib -L/usr/i386-glibc20-linux/lib
/usr/i386-glibc20-linux/lib/libc.so /usr/i386-glibc20-linux/lib/crt1.o
   (on ONE line, though !)
   plus the previous linker flags. That compiled micro_httpd and
   micro_inetd
   
   You should also get away with
   LDFLAGS =   -s -nostdlib -L/usr/i386-glibc20-linux/lib -lc
/usr/i386-glibc20-linux/lib/crt1.o
   (on ONE line again). Maybe even with
   LDFLAGS = -s -nodefaultlib -L/usr/i386-glibc20-linux/lib -lc   

   If you want to read the man or info pages to gcc look for
   -nstdlib -nodefaultlib and -nostartfiles
   
   How to test ?
   if you do a ldd executable on your Mandrake or RedHat box, it will
   still show you the system defaults, since it finds those first.
   But it also will add the noversion libraries, since it sees the
   version mismatch.
   I then copy  the plain executable onto the floppyfw floppy in
   a newly created directory (I call it extra) and put that in my
   floppyfw box. Remember you don't have to reboot your floppyfw
   all the time - it's sneaker net time :-) ...
   Then mounting the floppy again on my floppyfw and running the
   newly compiled executable straight from the floppy should tell
   you if it works or not : a seg fault means, it still expects the
   2.1.X libraries :-)


All right, these are my experiences with compiling on Mandrake 7.2.
I'm sure there are better ways, simply because I don't know all
the bells and whistles of gcc and the linker.

Cheers
Andreas
