ldd with 32-bit binaries on 64-bit system - runs but won't report

5,365

Turns out this is pretty easy.

/usr/bin/ldd is just a script file.

Opening the script file shows a line near the top, which initially reads (on my system):

RTLDLIST="/lib/ld-linux.so.2 /lib64/ld-linux-x86-64.so.2 /libx32/ld-linux-x32.so.2".

Changing this line to RTLDLIST="/lib32/ld-linux.so.2 /lib64/..." immediately fixed the problem.

P.s. (adding here in case it helps someone else struggling to install gobject-introspection) The solution is also useful if trying to install gobject-introspection, because that calls ldd to resolve libraries.

The error message I got there was : ERROR: can't resolve libraries to shared libraries: gobject-2.0, glib-2.0

Share:
5,365

Related videos on Youtube

chrisb2244
Author by

chrisb2244

Updated on September 18, 2022

Comments

  • chrisb2244
    chrisb2244 over 1 year

    My linkers are in

    /lib{32,64}/ld-2.20.so, with symbolic links at

    /lib32/ld-linux.so.2 and

    /lib64/ld-linux-x86-64.so.2 (to the appropriate ld-2.20.sos)

    When I attempt to execute a 32 bit binary, all is well. They compile fine (I am using a slightly modified gcc specs file) and seemingly link fine, and run fine.

    When I try ldd /path/to/example/32bit/binary, I am told not a dynamic executable. My understanding is that this is due to being unable to find a linker to open the executable.

    readelf -l example_binary | grep interpreter gives [Requesting program interpreter: /lib32/ld-linux.so.2], as expected.

    Any ideas why this is happening / how I can fix it?

    P.s. - "Install 32-bit compatibility libraries using sudo apt get ... " not helpful, since don't have apt/pacman/etcetera. If I need to reinstall a specific (32-bit) library, then knowing that would be helpful!

    P.p.s - The script files installed by gcc at /usr/lib{32,64}/libc.so group the appropriate (real) libc.so.6 and libc_nonshared.a files, with the AS_NEEDED ( /lib32/ld-linux.so.2 ) ) at the tail end for lib32