7

I downloaded a program that unfortunately doesn't come as a source distribution. When I go to run it, I get the error

error while loading shared libraries: libjpeg.so.62: cannot open shared object file: No such file or directory

The program seems to have been linked against a specific version of libjpeg which my distro does not have. Creating a symlink named /usr/lib32/libjpeg.so.62 to my actual libjpeg.so fixes the problem, but poking around in /usr/lib32 just to make one program work seems stupid and over the top.

Is there any way (sans recompiling) to make the program dynamically link libjpeg.so instead of libjpeg.so.62?

FWIW, file info for the program is

ELF 32-bit LSB  executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
5

Binary-edit the file (with vim -b for instance) and replace any occurrence of /usr/lib32/libjpeg.so.62 with some path to your libjpeg.so that is exactly the same size like for instance /usr/lib//////libjpeg.so

/usr/lib32/libjpeg.so.62
/usr/lib//////libjpeg.so
  • 1
    Replacing the .62 with null characters did the trick. Thanks! – Matt Kline Aug 27 '13 at 17:29
  • I daresay that meddling with /usr/lib32/ by creating symlinks is much safer than a binary edit. My 2 cents. Also whats wrong with softlinks again? – Arpith Aug 27 '13 at 17:36
  • @Arpith Nothing's wrong with symlinks, but I see no point in making changes to my entire system just to support a single application that was questionably linked. – Matt Kline Aug 27 '13 at 18:45
  • 2
    The app is probably linked correctly, libraries have versions for a reason. ABI compatibility is the main concern, see upstream-tracker.org/versions/libjpeg.html for example. Such a naming method is coarse, but effective, there are alternatives. – mr.spuratic Aug 27 '13 at 22:40
  • 1
    @mr.spuratic, different distributions have different numbering schemes. This kind of issue typically occurs with libjpeg and with openssl where for instance debian and redhat do it differently. Binary-editing is as safe as adding symlinks. – Stéphane Chazelas Aug 28 '13 at 5:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.