Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

Maybe

 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 usefull that would be to track down the Ubuntu version.

share|improve this answer
    
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

 
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.