The. La dynamic library generated in make. Am must be linked to the. A static library at the same time.

Source: Internet
Author: User

The Libnet. A static library must be linked at the same time as the. La dynamic library is generated during the recent project process.

 

Libcharon_la_libadd + =/usr/lib/Libnet.

 

However, an error is reported during compilation:

/Usr/bin/ld:/usr/lib/Libnet. A (libnet_build_ip.o): Relocation r_x86_64_32 against 'a local symplo' can not

Be used when making a shared object; recompile with-FPIC

 

This should be in conflict with the 64-bit system. Later, I tried to add the-FPIC compilation option in makefile, but the error still persists. There should be solutions in this article,

However, if you have time to try it, you may need to create a sub-directory for the. A static library and write a makefile. Am file, which specifies the content similar to the following:

 

Noinst_libraries = libjupcommon.
Libjupcommon_a_sources = jupcommon. h print. c
Libjupcommon_a_cflags =-FPIC

 

Another officially recommended method is to replace the. A static library with the. La dynamic library for link.

 

My current practice is to link. the code of a static library is divided into makefile of executable files. am, so use charon_ldadd =/usr/lib/Libnet. A.

And will not conflict with the link of the static library.

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.