Menu

Universal Linux Binaries

The "you can always recompile" attitude in Linux communities has always pissed me off. I can understand that Linux comes in many, diverse forms and that providing universal binaries for all platforms is impossible. However, I do believe that for consumer desktops running regular distros under x86 architectures there should be a way to deliver an executable that just runs. In that respect, my experiences with Mac OS have changed my expectations of software's user friendliness.

I encountered one of the more nasty occurences of linking troubles when compiling the GDS3D code on one of our new Linux servers. When trying to run this binary on the older machines, the following cryptic error message appeared:

error while loading shared libraries: requires glibc 2.5 or later dynamic linker

Some googling revealed that this is a common problem, but the solution is not easy to find. For a time I was playing with .symver statements in the C++ code, with negative results.
Then finally, I stumbled on a link that contained exactly what I wanted:

http://www.acsu.buffalo.edu/~charngda/elf.html

The root of the problem is in the hash section of the binary, which follows a new convention in newer versions of GCC. The default should be compatible with older versions, but a lot of distros overwrite this. Thank you, binutils guys, for breaking something which should have been left alone.

So, what's the fix? Just include the following link flag in your Makefile:

-Wl,--hash-style=both

Of course, this fix will be in the next version of GDS3D, as we strive to minimize the number of dependencies and maximize the compatibility of our compiled binaries.

Posted by Michiel Soer 2012-04-11

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.