-   Programming (
-   -   Linking with different versions of glibc. (

dimm_coder 11-25-2003 04:25 AM

Linking with different versions of glibc.
Presently, we provide our applications builded with glibc 2.2 and 2.3.
We build these 2 versions on different machines: one with 2.2, another with 2.3.
One client has an old distributive with glibc 2.0.
I wonder, is any clever way to have more than one glibc installed on the same machine and choose the version to link with, instead of installing the old distro or removing the current version for the old one; or the way to build an application with the new glibc, but to have compatibility with the old one?

jim mcnamara 11-25-2003 07:01 AM

We do this with Oracle and other products. Create an environment variable
that points to the tree for the product. Plus, the product installs have to live in physcially different directories, strictly for linking.


# for ver 2.2, assuming the libraries are all in in /usr/glib/2.2/lib....
export GLIB_HOME=/usr/glib/2.2
# for version 2.3
export GLIB_HOME=/usr/glib/2.2

Then you have the unenviable task of changing the makefiles to use
the $GLIB_HOME variable to point to where the libraries live -

# for example use the -L to search where you're aiming first
ld module.o -c  # will look in GLIB_HOME first

In reality you may need several different environment variables and have scripts that move you back and forth between versions and in our case Oracle instances. We do this. Note that the PATH variable will also have to change, and if you use SHLIB_PATH, etc. these will also have to change.

dimm_coder 11-25-2003 07:25 AM

Thanks, Jim. That is an obvious way.

All times are GMT -5. The time now is 05:15 PM.