?
Solved

Compile and Link for Compatibility With Older Versions of GLIBC

Posted on 2006-03-31
8
Medium Priority
?
509 Views
Last Modified: 2008-02-01
I thought this would be easy.  I retired my old Linux 7.3 system and we now do our development on a brand new CentOS system (REL 3.4).  Now, however, some of the things we compile generate an error when run on older Linux systems saying that GLIB_2_3 is required.   I have spend a considerable amount of time researching this and have found no satisfactory solution and yet there must be an obvious one as all developers don't keep old Linux boxes around just to do compile and links or do they?

I tried using the compat-gcc-32 packages but the particular package I am compiling (a DBD-mysql-3.002 perl module in one case) generates compile errors I include these headers.

Would appreciate any input on best practices for compiling and linkingin a way that will be back compatible to at least Linux 7.x (say GLIBC 2.2.4).
0
Comment
Question by:magixman
  • 3
  • 3
  • 2
8 Comments
 
LVL 35

Accepted Solution

by:
Duncan Roe earned 1600 total points
ID: 16347621
You're not going to like this: compile and link on the old box if you want compatibility. Glibc is just too fundamental a part of the system to offer it backwards.
0
 

Author Comment

by:magixman
ID: 16348041
This is an answer I have heard and it may be the right one but I don't accept it.  Sure I can set up a VMWare environment with an old Linux version but there just has to be a better way.  I cannot believe that all developers kick the dust off their ancient versions of Linux every time they compile stuff.  God help them if these old insecure kernels are out on the net.
0
 
LVL 35

Expert Comment

by:Duncan Roe
ID: 16348153
It's not Linux versions, it's library versions that make a difference. Changing those is not to be undertaken lightly. What exactly is the error you get BTW?
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 

Author Comment

by:magixman
ID: 16348181
I realize that I am trivializing things by equating GLIBC versions with Linux versions.  As you point out, changing GLIBC versions is not to be taken lightly and so one generally goes with the one that comes with the particular version of Linux you install.  What I don't understand is why everyone who creates binary products does not run into this problem and why there is not an obvious procedure for compiling/linking with older versions of GLIBC.

The error that I run into is ./mysql.so: /lib/i686/libc.so.6: version `GLIBC_2.3' not found (required by ./mysql.so)
 
0
 
LVL 35

Expert Comment

by:Duncan Roe
ID: 16348632
"everyone who creates binary products" generally tell you what revs of what distros they're tested against. And I agree you don't want to revert glibc on your new system.
When I worked for a coy that produced binary packages for distribution, they had a build environment on old revs just like you say. Sure, develop on your new system, but recompile all code from source on your old one - it's common practice.
0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 400 total points
ID: 16355579
You have to link against a glibc which is available on the other system, this also requires that all other libraries you're using can use that old glibc. IIRC you also have to use a proper compiler for that, in particular the compiler relies on glibc too (as duncan_roe already pointed out). And finally don't forget to use the proper include files for that old glibc.
To do all that, you have to tweak the compiler and linker with a couple of options and ensure that it only finds those includes and libs.
I'd use a chrooted sandbox for that (even it can be done directly).
0
 

Author Comment

by:magixman
ID: 16355636
OK I stand corrected.  Developers such as us who go against the grain and opt for binary distros of our software might as well get used to kicking the dust off of our old environments whether they be full metal, virtual or chroot.  There is no 'Easy Button' such as just including some old headers.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 16355647
>  There is no 'Easy Button' such as just including some old headers.
use the old tools, cause they are not forward-compatible, probably ... :-)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month15 days, left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question