0

I am writing an application which uses different glibc versions. Lower version of rpm is already installed in my RHEL(6.5) box but i need an higher version of glibc rpm which is available in RHEL(7.x).

  1. Is it possible to install different version of same rpm in RHEL
  2. If yes how to use different version of rpm's in a single application by providing absolute path or can i install the higher version in a separate folder and make use of it?
ie) /opt/higherverison/glibc <file>
    /usr/bin/glibc <file>
Shriram
  • 4,343
  • 8
  • 37
  • 64
  • 1
    Possible duplicate of [Multiple glibc libraries on a single host](http://stackoverflow.com/questions/847179/multiple-glibc-libraries-on-a-single-host) – Employed Russian Nov 29 '16 at 07:40

2 Answers2

1

Red Hat has created an option, that's part of the RHEL subscription, to do exactly what you want - it's called Red Hat Developer Toolset.

https://developers.redhat.com/products/developertoolset/get-started-rhel6-cpp/

Currently at gcc 6, but gcc 5 also available.

It works by installing the new gcc versions "along side" the original, so doesn't create conflicts with the OS.

Mike Guerette
  • 533
  • 3
  • 6
0
  1. No. A newer version of foo will override the older version of foo. For glibc, this would mean you only have the new version. This will break everything. Red Hat provides something called Software Collections (SCL) that lets you install multiple RPMs such that they don't conflict, but there's no SCL for glibc.

  2. I advice against using a version of RHEL 7's glibc on RHEL 6. It will probably look for things not available on RHEL 6. Perhaps you can build RHEL 7's glibc (with appropriate flags adjusted) on RHEL 6, put in a custom location and link against that explicitly? You would still have to maintain this glibc version yourself. You can make your application use a different libc by using an RPATH.

How do you set a custom RPATH? This answer has one possible approach:

RPATH specifies where the provided libraries are located. This folder should contain: libc.so.6, libdl.so.2, libgcc_s.so.1 and maybe more. Check with strace to find out which libraries your binary file uses.

ld.so is the provided linker

gcc -Xlinker -rpath=/default/path/to/libraries -Xlinker -I/default/path/to/libraries/ld.so program.c

Community
  • 1
  • 1
omajid
  • 14,165
  • 4
  • 47
  • 64