1

My application links to libraries which are built on RHEL 6. When I compile this application on RHEL 7 linker throws errors for glibc version. Following is one of the error :

undefined reference to symbol '__tls_get_addr@@GLIBC_2.12' /lib64/ld-linux-x86-64.so.2: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status

For fixing I copied libc and libm from RHEL 6 to RHEL 7 and linked to these along with libc and libm from RHEL 7. Will it cause issue at runtime if I copy libc and libm from RHEL 6 to RHEL 7? Any other way to get away with such issues?

Thanks, Mangesh Sawant.

2 Answers2

1

Will it cause issue at runtime if I copy libc and libm from RHEL 6 to RHEL 7?

Copying libc.so.6 and libm.so.6 from RHEL6 to e.g. ~/rhel6/libs or /tmp will not cause any issues (you've already done it).

But overwriting the RHEL7's /lib64/libc.so.6 with RHEL6's copy is likely to make every program on the RHEL7 system to crash, and render that system unbootable. Make sure you have backups and a rescue disk, and know how to use it if you decide to try this.

Any other way to get away with such issues?

Correct way to deal with this is to build with a toolchain that targets desired GLIBC. More info here.

Employed Russian
  • 199,314
  • 34
  • 295
  • 362
0

While Red Hat Enterprise Linux 6 came with glibc 2.12, it does not have a __tls_get_addr@GLIBC_2.12 versioned symbol, only __tls_get_addr@GLIBC_2.3. That symbol is also present in later glibc versions.

I don't think the problem you are facing can be solved by downgrading glibc. As Employed Russian said, overwriting the system glibc will make the system unbootable anyway.

Florian Weimer
  • 32,022
  • 3
  • 48
  • 92