patchelf icon indicating copy to clipboard operation
patchelf copied to clipboard

patchelf: cannot find section '.interp'. The input file is most likely statically linked

Open cgy0627 opened this issue 2 years ago • 1 comments

Describe the bug + Steps To Reproduce

I'm trying to install mysql using cpanm DBD::mysql but that ends with an error:

/lib64/libc.so.6: version `GLIBC_2.35' not found (required by /home/linuxbrew/.linuxbrew/opt/gcc/lib/gcc/current/libgcc_s.so.1)

Now I have glibc packages installed in /opt and tried patchelf --set-interpreter /opt/glibc-2.35/lib/ld-linux-x86-64.so.2 --set-rpath /opt/glibc-2.35/lib/ /home/linuxbrew/.linuxbrew/opt/gcc/lib/gcc/current/libgcc_s.so.1, but this results in an error:

patchelf: cannot find section '.interp'. The input file is most likely statically linked

Expected behavior

Since the first error stated that GLIBC_2.35 is "required by /home/linuxbrew/.linuxbrew/opt/gcc/lib/gcc/current/libgcc_s.so.1", I assumed that I needed to link the new glibc lib to /home/linuxbrew/.linuxbrew/opt/gcc/lib/gcc/current/libgcc_s.so.1, so that cpanm DBD::mysql could work with the new glibc package.

patchelf --set-interpreter /opt/glibc-2.35/lib/ld-linux-x86-64.so.2 --set-rpath /opt/glibc-2.35/lib/ /home/linuxbrew/.linuxbrew/opt/gcc/lib/gcc/current/libgcc_s.so.1

cgy0627 avatar Jul 25 '23 00:07 cgy0627

Similar issue:

# ldd lib/libm.so.6
    linux-vdso.so.1 (0x00007ffff3cc8000)
    /usr/local0/lib/libc.so.6 (0x00007f46dda56000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f46ddd3c000)
# patchelf --set-interpreter /usr/local0/lib/ld-linux-x86-64.so.2 lib/libm.so.6
patchelf: cannot find section '.interp'. The input file is most likely statically linked

It seems --set-interpreter needs an additional way to force change the dynamic loader path?

duanev avatar Feb 15 '25 00:02 duanev