Static library creation and viewing under Linux, and how to see which dynamic libraries an executable depends on

Source: Internet
Author: User


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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.