[CentOS] Building a newer glibc RPM for CentOS 6 and installing into an alternate path

Mon Mar 30 19:23:33 UTC 2015
James Pearson <james-p at moving-picture.com>

Alfred von Campe wrote:
> We have a third party shared library from a vendor that requires glib 2.15 or newer. 
> We are using CentOS 6.6 which comes with glibc 2.12, and I know it can’t be replaced
> as it’s an integral part of the OS.
>
> However, is it possible to build a glib 2.15 RPM from source to be installed in /opt/centos
> (or somewhere else other than /usr/lib) so that I can link the one application that requires
> the third party shared library with this version of glib?  If so, does anyone have instructions
> on how to build such an RPM, or better yet, has already build such an RPM?

I don't think it is as straight forward as that ...

I did something like this _many_ years ago (to get a RedHat 9 binary to run on RedHat 7.2) - which involved copying the /lib tree from a 'newer' OS install to a separate tree - and then using the ld-linux.so.2 binary from the newer tree to load the binary - and if memory serves me right, something like (for a 32 bit binary, as they were then):

 /path/to/newer/glibc/lib/ld-linux.so.2 --library-path /path/to/newer/glibc/lib /path/to/binary

You will probably have problems if the binary uses dlopen() to load other shared libs ...

I have no idea if this is still valid - as the last time I tried this was over 10 years ago ...

James Pearson