Linux: How to statically link against system libs?

Nick Sabalausky a at a.a
Fri May 6 20:58:28 PDT 2011


"Nick Sabalausky" <a at a.a> wrote in message 
news:ipf5pg$j80$1 at digitalmars.com...
> "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.
>

Aggghhhh!!! God damnnit, I officially fucking hate linux now... (not that 
I'm a win, mac or bsd fan, but whatever...)

I temporarily gave up trying to actually get ahold of an old distro, so I 
tried the other angles (not counting just simply *wishing* it was like win 
and I could just copy the damn binary over to another linux box...nooo, that 
would be too simple for a unix-style system):

I got my web host to switch me to a server that has 32-bit libs installed (a 
pain in and of itself because I had to coordinate with a client to find a 
convenient downtime, and then I ended up needing to change my domain's DNS 
entires, so now my whole domain's down for a couple days)...And it make no 
difference. So I guess in my particular case it wasn't a 32-bit/64-bit issue 
at all (or maybe there still would have been that problem too, I dunno).

So I went to try uClibc:

I started my Linux box...and it decides to hang mid-startup. So I reboot and 
at least this time the dumb thing finishes booting (I had problems with 
linux randomly breaking for no apperent reason ten years ago with Mandrake 
and Red Hat. I can't believe it's still happening now).

Anyway, at the uClibc site, I saw the "simple steps" here: 
http://uclibc.org/toolchains.html and thought "Uhh, hell no, not if I don't 
have to" and went to the link for the pre-built verison instead. The link 
was broken. Then the page says those are really old versions anyway. Great 
:/

So I go through the steps: I get to the part where I download buildroot. 
Copy/paste the link over to my linux box...and discover that Synergy+ has 
suddenly decided it no longer feels like offering the "shared clipboard" 
feature that always worked before.

Ok, so I type the URL into my linux box manually, download buildroot, unpack 
it...so far so good...and follow the instruction to run "make 
menuconfig"...BARF. It fails with some error about ncurses being missing, 
and that I should get ncurses-devel. "sudo apt-get install ncurses-devel": 
Can't find package. "sudo apt-get install ncurses": Can't find package. 
"sudo apt-get install fuck-shit-cock": Can't find package.

Google "ncurses deb package". Actually found it. Download. Run...You ready 
for this? Here's the message: "Error: A later version is already installed." 
SERIOUSLY?!

This is the point where I would normally say "fuck this shit", but the 
thought of continuing to use PHP (even if it is via Haxe) is enough to keep 
me bashing my head against this wall. Next stop: See if I can get ahold of 
*some* version of CentOS and see if using that in a VM will manage to work. 
(And rip Kubuntu off my Linux box and see if I can replace it with 
Debian+XFCE. How is it possible that GNOME and KDE were both fairly ok ten 
years ago, at least as far as I can remember, but the latest versions of 
both are complete shit? And then there's that iOS garbage that Ubuntu is 
moving to now (The one main thing I've always disliked about Ubuntu is their 
incompresensible Apple-envy, which only seems to be increasing). And fuck, 
the latest KDE actually makes the Win7 UI seem good (at least the Win7 UI 
actually *works* and has some semblance of consistency, even as obnoxious as 
it is), and I could have sworn that KDE never used to be so completely 
broken before. Or broken at all, for that matter. Which is too bad, because 
Dolphin actually shows some promise...at least when it isn't doing the 
random-horizontal-scrolling-for-no-apparent-reason dance.)




More information about the Digitalmars-d-learn mailing list