Static library creation and viewing under Linux, and how to see which dynamic libraries an executable depends on
To create a static library:
Ar-rcs test.a *.O
To view the static library:
Ar-tv TEST.A
Unzip the Static library:
Ar-x TEST.A
To view the dynamic libraries that the program relies on:
Readelf-a Xxx|grep Library
As can be seen, the following cross-program Hello execution relies on the following two dynamic libraries.
[Email protected]:~/test$ arm-none-linux-gnueabi-readelf-a hello|grep "library"
0x00000001 (NEEDED) Shared Library: [Libgcc_s.so.1]
0x00000001 (NEEDED) Shared Library: [libc.so.6]
[Email protected]:~/test$
Or: Readelf-l hello.
NM XXX View Symbols
where T represents the code snippet, u means it is defined elsewhere, so you need to make sure that it must be defined in a. o or library.
LDD command to view
Static library creation and viewing under Linux, and how to see which dynamic libraries an executable depends on