linux - [Solved-3 Solutions] Multiple glibc libraries on a single host - ubuntu - red hat - debian - linux server - linux pc



Linux - Problem :

Is it possible to have multiple glibcs installed on the same host ?

Linux - Solution 1:

To build an executable that will work with the new glibc, do this:

g++ main.o -o myapp ... \
   -Wl,--rpath=/path/to/newglibc \
   -Wl,--dynamic-linker=/path/to/newglibc/ld-linux.so.2
click below button to copy the code. By - Linux tutorial - team
  • The -rpath linker option will make the runtime loader search for libraries in /path/to/newglibc
  • The -dynamic-linker option will "bake" path to correct ld-linux.so.2 into the application.

Linux - Solution 2:

Use LD_PRELOAD:

LD_PRELOAD='mylibc.so anotherlib.so' program
click below button to copy the code. By - Linux tutorial - team

Linux - Solution 3:

Using Nix http://nixos.org/nix/

  • Nix supports multi-user package management
  • Multiple users can share a common Nix store securely, don’t need to have root privileges to install software, and can install and use different versions of a package.

Related Searches to - linux - linux tutorial - Multiple glibc libraries on a single host