9

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?

2 Answers 2

3

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.

3
  • 3
    Another reason can be that the binary was built for 32-bit system but you're checking it on a 64-bit system. May 27, 2013 at 6:37
  • @FerdinandPrantl If it's built for 32 bit, ldd still prints the 32bit dependencies.
    – Calmarius
    Aug 14, 2013 at 10:33
  • @Calmarius that is not true, when you don't have basic 32-bit libgcc1. Just verified on a fresh Ubuntu Server installation: You need to install libgcc1:i386 to make ldd happy for 32-bit binaries.
    – falstaff
    May 15, 2015 at 16:59
1

@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)

1
  • Installing wine is a very clever trick for getting all the 32 bit libraries you need!!
    – psitae
    Sep 12, 2019 at 8:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .