Linux: How to statically link against system libs?

Nick Sabalausky a at a.a
Fri Apr 29 13:02:10 PDT 2011


"Spacen Jasset" <spacenjasset at yahoo.co.uk> wrote in message 
news:ipe1ar$1e1f$1 at digitalmars.com...
>
> I don't know about any of that. All I say is software was built on Centos 
> 3 and it runs on the then company I was working for supported platforms.
>
> Which is redhat 3,4,5 + and Suse 9.something + That is 32bit and 64 bit by 
> the way too.
>
> It also runs on ubuntu (since about version 6ish +, upto 10, and I dare 
> say beyond) and fedora, but rekon it hasn't been tried recently on Fedora 
> 14 as it's not a supported platform. This all happens from one binary 
> compiled on Centos 3
>
>
> There was a bug, that I had to fix, and that was a crash on something like 
> Redhat 4, because at the time libc was being statically linked. I can't 
> remember the syscall that caused problem now, I have a feeling it was BSD 
> sockets related.
>
> libc is designed to be forward compatible only, if you dynamically link 
> it. The symbols within are versioned and the correct ones bound at 
> runtime.
>
> I pipe up about all this because I've been though it all, and did not 
> understand at the time what was wrong with static linking, but then you 
> see the difference between Posix type platforms and windows, and what libc 
> *actually is*, then it all makes sense.

I'm having a rediculously hard time trying to find a CentOS 3 installation 
disc image (or any other version before 5.6). This is the closest I've been 
able to find:

http://mirrors.cmich.edu/centos/3.1/

But I don't see anything in any of those directories that looks remotely 
like a disc image. Even though the chart on this page seems to say that 
mirror should have them:

http://www.centos.org/modules/tinycontent/index.php?id=30

On this page...

http://isoredirect.centos.org/centos/4/isos/i386/

...it *says* that that I can "download the .torrent files provided", but 
there's no torrent files listed there or at the mirrors, and the only other 
promising-looking link that page has is here:

http://packages.sw.be/bittorrent/

Which, despite the url, doesn't even have any torrents at all, just a bunch 
of rpms. How's a torrent client supposed to use an rpm?

I seem to remember having pretty much the same problem about a year ago when 
I blew a full day trying to get ahold of a copy of Debian. Eventually I gave 
up trying to find it and just went back to Ubuntu.

I don't have a problem using VirtualBox for this if I need to (Assuming I 
can actually get ahold of an appropriate OS). I actually quite like 
VirtualBox; been using it a lot the past year, and I have plenty of disk 
space. But, if all I need to do is get my app to link againt an older 
version of libc, shouldn't there be a way to do that right there on my 
Kubuntu 10.04 system?

I had been shying away from Alexander's suggestion of uClibc because 
uClibc's website says it sacrifices speed for size, and because it looks 
like a royal pain to get set up. But if I can't get this CentOS solution to 
work, I may give it a try anyway.

Also, I've found on Google that the message I got ("linux.so.2: bad ELF 
interpreter: No such file or directory") is known to sometimes occur when 
running a 32-bit binary on a 64-bit system that doesn't have the 32-bit libs 
installed. In case that turns out to be my real problem and my webhosts are 
unwilling to install the 32-bit libs, can DMD still output 64-bit binaries 
when building on a 32-bit system? My guess would be "no" since linux seems 
enjoy crapping out when trying to compile for anything but the local system.





More information about the Digitalmars-d-learn mailing list