2

I just followed the advice here:

How to update glibc to 2.14 in CentOS 6.5

as an Android related program has been complaining about glibc-2.29

Everything seemed to compile and now in the /opt folder there you can see a folder for the newly installed library:

$ ls /opt/glibc-2.29/
bin  etc  include  lib  libexec  sbin  share  var

The original program however, even after a reboot, is still producing its error message:

.....because /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.29' not found

I am thinking that the last line of the solution:

export LD_LIBRARY_PATH="/opt/glibc-2.14/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"

possibly works in Centos 6 but not in Debian. If I type env | grep LD after a reboot it does not find anything. I just checked my history, and did change 2.14 to 2.29 before running that.

I am running Debian 10.4 Buster. Any ideas how to make this work or fault find it?

update:

I found that running that last line to export LD_LIBRARY_PATH inside the same terminal window before the program which needs it, makes the error go away, but it really kills everything in that terminal - whatever I enter, even ls returns a memory access error. I can do nothing but close that terminal. It seems that Debian really does not like that LD path to be changed like that.

cardamom
  • 550

1 Answers1

5

You can't blindly change glibc and expect everything to cope happily. Programs that expect 2.14 will need to continue using 2.14, but programs expecting 2.29 can be set up to use that.

If you set LD_LIBRARY_PATH you are telling the linker where to find a library. If you call 2.29 the same as 2.14 then the linker will try to link older programs with the newer library, with the unhappy consequences you've found.

Fortunately you can set LD_LIBRARY_PATH just for the necessary executable, and then it won't affect anything else:

LD_LIBRARY_PATH=/opt/glibc-2.29/lib /path/to/my/program
Chris Davies
  • 116,213
  • 16
  • 160
  • 287
  • Your little edit then /lib made a big difference in that without it there was no change to the error message with your solution and afterwards it would throw 'memory access error'. It would not however break the terminal and could still run commands like ls and get the usual output. Is probably not easily possible to get this legacy software to run on Debian 10. Probably my only hope is to try to run that software in a version of linux in a VM which is about as old as the legacy software. From what I read these C libraries are not propertly backwards compatible.. – cardamom Jun 10 '20 at 10:58
  • I run Debian and I have no problem using LD_LIBRARY_PATH as necessary to switch libraries (although not specifically glibc) – Chris Davies Jun 10 '20 at 11:09
  • And the missing /lib was a typo. Unfortunately – Chris Davies Jun 10 '20 at 11:10
  • If you need only one shared lib, use LD_PRELOAD instead: LD_PRELOAD=/opt/glibc-2.29/lib/libm.so.6 /path/to/my/program. – Danijel May 23 '22 at 06:20