I have a library that was compiled on an unknown Ubuntu machine, And I'd like to determine what version of Ubuntu that machine had at the compile time.

My idea was to try and find the versions of different libraries used (e.g. the kernel), knowing that these versions changed with different releases. Iv'e tried using nm and ldd, but I can't seem to find any relevant info.

Any suggestions?



 readelf -a 

It displays information about ELF files. If the object you are studying still contains the comment section, you may try to extract it by

 readelf -p .comment yourfile

For example

$ cat test.c
int main () {
  return 0;
$ gcc test.c
$ readelf -p .comment a.out

String dump of section '.comment':
  [     0]  GCC: (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1

objdump could provide the same information.

If the comment section is stripped, you may try to read the GCC runtime symbol version info from the readelf -a command if it is a c++ compiled library. Note, that is the version of symbols supplied to the compiler and not necessarily the version of the compiler. I don't know how useful that would be to track down the Ubuntu version.

  • Nope.. It doesn't look promising: OS/ABI: UNIX - System V ABI Version: 0 – nbubis Jun 21 '12 at 15:11
  • Could you explain how you you go about doing this? Iv'e gone through the readelf output, and haven't found anything useful. Thanks! – nbubis Jun 22 '12 at 6:51
  • I've edited the answer to contain an example. – Jari Laamanen Jun 22 '12 at 10:10

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.