Does a file reported as "not a dynamic executable" by 'ldd' depend on other libraries?
Just making sure I got this right - I call
ldd /path/to/executable
and it returns "not a dynamic executable". This means that it doesn't depend on other libraries, correct? If so, does it mean that it can be transferred to another Ubuntu box without worrying about dependencies?
Correct, but there's something to take into account.
From the ldd
manpage:
ldd does not work on a.out shared libraries.
ldd does not work with some extremely old a.out programs which were built before ldd support was added to the compiler releases. If you use ldd on one of these programs, the program will attempt to run with argc = 0 and the results will be unpredictable.
@Calmarius is correct, this happens if you consider a 32bit exe, without even basic 32bit libraries.
I'm attempting to upgrade my system (a fresh install of Ubuntu 16.04, from 12.04), I have to install an old propitiatory 32bit service, avserver
, that requires ia32-libs
(no-longer available). This means both dpkg
and apt-get
are unhappy (whatever I do, it prompts me to apt-get -f install
, and if I run that, it insists I uninstall the service package), and my service won't start.
To prove that this is down to missing 32bit libraries, I have mounted my old system (Ubuntu 12.04, with ia32-libs
and 32bit libraries) on /sda2
. Ensuring /opt
(containing my 32bit binary) is mounted in /sda2/opt
, I can chroot /sda2
and ldd
then runs as intended.
To fix this, I could have manually installed all the dependent library packages with :i386 (arch). However I decided rather than try to figure out what my dependencies were, I installed wine (which is mostly 32bit, and so installs the basic libraries and a load more that I don't really need, but I'm ok with that).
To fix dpkg
and apt-get
, I edited /var/lib/dpkg/status
, finding the package for my service, and removed ia32-libs
. Now dpkg
and apt-get
are happy
That done, ldd
happily reports:-
root@withnail:/opt/<service path># ldd avserver
linux-gate.so.1 => (0xf77a6000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf778f000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf7772000)
libuuid.so.1 => /lib/i386-linux-gnu/libuuid.so.1 (0xf776b000)
libresolv.so.2 => /lib/i386-linux-gnu/libresolv.so.2 (0xf7752000)
libcrypt.so.1 => /lib/i386-linux-gnu/libcrypt.so.1 (0xf7720000)
libktssl.so.1.0.0 => /opt/<service path>/libktssl.so.1.0.0 (0xf76cb000)
libktcrypto.so.1.0.0 => /opt/<service path>/libktcrypto.so.1.0.0 (0xf756b000)
libktz.so.1 => /opt/<service path>/libktz.so.1 (0xf7558000)
librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xf754f000)
libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xf73d8000)
libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7383000)
libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf7366000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf71af000)
/lib/ld-linux.so.2 (0x565b1000)