Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get the version of a shared object?

I'm trying to track down a bug in my software line. I have two release build version 2.0.962 and 2.0.966. The only difference between these versions is a lib.so file. In order to figure out where to start looking in the source tree for lib.so, I need to know its version number in each of the release builds.

Is there a command line tool for printing the version of a shared object?

like image 501
bstar55 Avatar asked Jul 16 '15 20:07

bstar55


People also ask

What does the number after .so mean?

Each file has a different number at the end of it. These numbers represent versions of the library. They're very important as it's these versions that determine the role of each file. They're two popular versioning schemes.

How do I check the version of a file in Linux?

The safest option is to query /etc/os-release file using grep or cat command. Systemd based Linux distro users can use the hostnamectl command. About the author: Vivek Gite is the founder of nixCraft, the oldest running blog about Linux and open source.

What is the difference between .so and so 1?

Yes, the ". 1" indicates the version number. This makes it possible to have multiple versions of the same library side-by-side, whereas the most common version has a link with no version number. If there is no need to distinguish between different versions, the version suffix might not be present.

Are shared libraries linked?

Shared libraries (also called dynamic libraries) are linked into the program in two stages. First, during compile time, the linker verifies that all the symbols (again, functions, variables and the like) required by the program, are either linked into the program, or in one of its shared libraries.


1 Answers

I never did native android programming but as Android uses Linux kernel, the executable format used will most likely be "ELF". As far as ELF is concerned, there is no version information of Shared object stored in the file. So unless the file name itself is saying something like "libXXX.VERSION.so", there is no other way to find out the version number of the shared object. This technique is generally used in Linux.

My suggestions for solving your issue are:

  1. Use Date modified if possible to differentiate the shared objects
  2. Use dlopen() or similar to open the shared object and try to see the functions being exported.

Source: http://man7.org/linux/man-pages/man5/elf.5.html Note: E_VERSION in the executable is the version of ELF format, not of executable.

like image 87
Sreekar Avatar answered Nov 15 '22 00:11

Sreekar