Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a 64 bit Ubuntu Linux box. Recently I was given an old compiled binary that used to run on an old, retired server, which I THINK was a 2007-era Redhat distribution.

As you might expect, the binary does not work because of library incompatabilities. Binary-only sucks and isn't MEANT to be portable. Yet I'm still stuck with just the binary, and a need to run it. So my question becomes how to deal with the (painful) problem of figuring just what libraries the binary is expecting, finding those libraries, and forcing the program to use them. What's the proper strategy for doing this?

I'll give you the specific example of my binary, which runs but immediately fails with the error message

datab2txt: relocation error: /lib64/libnss_files.so.2: symbol __rawmemchr, version GLIBC_2.2.5 not defined in file libc.so.6 with link time reference

I'm interested in the strategy to diagnose this since I expect that if I solve this problem (by finding an old version of glibc??) there may be yet more libraries to resolve.

What's the best strategy for solving this? I am guessing I need to identify the libraries needed (how?), find them, and force the program to use them (how? overriding LD_LIBRARY_PATH ?)

Thanks!

Edit: using "ldd datab2txt" gives the error "not a dynamic executable". Uhoh.. what does that mean?

Additionally, I ran file and got:

% file datab2txt

datab2txt: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, for GNU/Linux 2.4.0, not stripped

share|improve this question
    
That's very old. You have a little bit of luck since it's statically linked, but it's written for an older (2.4) kernel. Is there no way you can get the source code? or just find out what it does and duplicate it with some script? –  Keith May 8 '11 at 21:23

3 Answers 3

Identifying the libraries is done with ldd. Finding them is another problem, but try digging around on packages.ubuntu.com for older Ubuntu releases. Then you're looking at unpacking the packages manually and installing the shared objects into their own dedicated directory (or directory tree if needed) and using LD_LIBRARY_PATH to point to them. (Note: using apt-get or dpkg won't work, and if you try to force the issue you might break your system. Just don't.)

share|improve this answer

You're in luck, there is a command for finding out which libraries a binary needs, with versions expected:

ldd -v /path/to/binary
share|improve this answer

In theory, using a chroot should do the trick for running the software - one of the situations its designed for is to run unsupported, old software with unsupported ABIs- you will likely need the old box to copy the required libraries from, or find and compile the necessary libraries yourself.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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