Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best way to build software that doesn't require the newest glibc?

I'm attempting to build a binary package that can be run on multiple Linux distributions. It's currently built on Ubuntu 10.04, but it fails on Ubuntu 8.04 with the following error:

./test: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by ./test)
./test: /usr/lib/libstdc.so.6: version `GLIBC_2.11' not found (required by ./test)

What's the preferred way to solve this problem? Is there a way to install an old glibc on a new box and build against it, or do I have to build on an old distribution? And if I build against an old glibc, will it work on a new glibc?

Or, alternatively, are there just some handy compiler flags or packages I could install to solve the problem?

like image 527
ZorbaTHut Avatar asked May 04 '10 18:05

ZorbaTHut


People also ask

How do I use specific version of glibc?

One option is to statically link your binary. This is probably the easiest option. You could also build your binary in a chroot build environment, or using a glibc-new => glibc-old cross-compiler.

Does GCC need glibc?

glibc documents the min required version of binutils & gcc in its INSTALL file. typically if you want to go newer than those, glibc will generally work with the version of gcc that was in development at the time of the release.

How do I compile glibc on my arm?

Installation of GlibcCompile the package using make . This will take about 20-25min. Then install the package with make install . Now we can compile the program with arm-linux-gcc instead of cc to make output run on ARM board with Linux in it.

What is glibc compiler?

THE GNU C LIBRARY, popularly known as Glibc, is the unseen force that makes. GCC, most C language applications compiled with GCC on Linux systems, and all GNU /Linux systems themselves work.


2 Answers

The best solution I've found is to install a virtual machine running Debian stable, and build on that. Debian stable is old enough that any packages built with it will run on any other Debian-based distribution like Ubuntu. You may have to work around non-critical bugs that have been fixed in later versions of various software but not backported to Debian stable.

like image 131
ptomato Avatar answered Sep 18 '22 15:09

ptomato


If you really want to make sure it runs on every recent distribution, you might also consider statically linking against a libC you select. However you may then still run into problems if you use features that are only provided by newer kernels (newer system calls e.g.).

like image 32
BjoernD Avatar answered Sep 20 '22 15:09

BjoernD