Re: Cross-compiling for different glibc (and other libs) versions
- --- In LINUX_Newbies@yahoogroups.com, Horror Vacui <horrorvacui@g...>
> This is probably the wrong group to ask this, but what the hell...It can actually be a very simple process. We've used the Freesco
> I've got an embedded PC running Linux that I want to compile
> software for on my laptop. Currently I'm doing some RTFM on
firewall/router which is a 'mini' Linux based on Slackware 3.5, and
will fit on a single floppy. All programs in it are based on the old
libc5 libraries. On our Debian machines, it was just a matter of
installing the libc5-compat packages, then making sure that these old
libraries were pointed to at compile time when building a program for
Freesco. It requires adding the path to the older libraries before
compiling. A little care is needed so that the path to these older
libs aren't made perminent, just used when doing the compile of a
program, and after it's done, libs paths are again pointing to the
current libs required by the current system. We've used a small shell
script to accomplish it.....
The paths shown above are what is used on the Debian machines, and are
not necessarily valid for other distributions, but it gives a general
idea. It's not a 100% guaranteed process, there are some programs
whose source code is written with the newer libraries in mind, and
will cause some errors when compiled/linked to the older libraries. In
these cases either an older version of the program is needed, or some
hacks to the existing code to make it backwards compatible.
The key to the whole thing is the libc5-compat packages which, at
least in Debian, install the older libs and components in such a way
that they can live in harmony with current libs. Other distros
probably have similar packages, I'm just not familiar with them.
Finally, the ldd command can be used to see which libraries a program
is linked with...
Linux #> ldd cp
libc.so.6 => /lib/libc.so.6 (0x40029000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
...shows the cp program is linked against libc6, the latest, greatest,
Linux #> ldd dnsmasq
libc.so.5 => /lib/libc.so.5 (0x4001d000)
...here the dnsmasq program was compiled on the current Debian machine
using the old libs, and shows that in fact libc5 was used.