0

I have an older version of glib that all applications are compiled against and use. I need to install a new application that requires a newer version of glib to compile and run. I installed the new version of glib in a separate folder (without uninstalling the older version) and am able to compile the new application (using pkg-config). The compilation script uses a linker flag like -lglib-2.0 to link against the library.

However, I am not sure of the best way to have the two libraries together so that they can be used by their applications that need them. Setting LD_LIBRARY_PATH to point to the location of the new library breaks the old applications.

I could set LD_LIBRARY_PATH everytime the new application runs to point to the new glib path (through an sh script for example), but I am wondering if there's a better way.

1 Answer 1

1

Try changing the compile script to specify -rpath= with the directory containing the old libraries. The rpath will be embedded into the actual compiled binaries.

(It is even possible for the rpath to contain certain expansions like \$ORIGIN/../lib if you want it to be relative to the binary's location.)

However, in practice a shellscript wrapper that sets LD_LIBRARY_PATH is indeed common for binary-distributed software (the kind that usually goes in /opt).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .