Linux compile and use Curl Static library __linux

Source: Internet
Author: User
Tags curl ldap

Compile and use the Curl Static library under Windows I won't say it, it's simple ...

Linux is compiled below the Libcurl.a file,

However, in the program statically linked to this LIBCURL.A file, there will be a lot of link errors, if the dynamic link LIBCURL.A file will not be a problem.

/USR/LIB/LIBCURL.A (SSLUSE.O): in function ' Curl_ossl_init ':
(. text+0xcd1): Undefined reference to ' ssl_library_init '

/USR/LIB/LIBCURL.A (SSLUSE.O): in function ' Curl_ossl_connect_common ':
(. text+0x1ba9): Undefined reference to ' ssl_get1_session '

Pick a few mistakes above ...

Later after a toss, suddenly Shung, only need to add the following link, the problem can be solved AH

-lcrypto-lidn-lssl/usr/lib/libcurl.a

This compiles the generated executable program with the command

After the LDD filename is executed, there is no libcurl.so.4 dependency in the dependency library ....

[Root@localhost rtspproxy]# ldd proxy_d linux-gate.so.1 => (0x00bd5000) libstdc++.so.6 =>-/usr/lib/libstdc++.so.6 (0x00cb7000) libpthread.so.0 =>/lib/libpthread.so.0 (0x009da000), libcrypto.so.6 =>/lib/libcrypto.so.6 ( 0x00243000) libidn.so.11 =>/usr/lib/libidn.so.11 (0x0061a000) libssl.so.6 =>/lib/libssl.so.6 (0x007b0000) Libm.so.6 =>/lib/libm.so.6 (0x009ab000) libgcc_s.so.1 => (/lib/libgcc_s.so.1) 0x00b37000 libc.so.6-=> Libc.so.6 (0x00863000) libdl.so.2 =>/lib/libdl.so.2 (0x009d4000) libz.so.1 =>/usr/lib/libz.so.1 (0x009f3000) Libgssapi_krb5.so.2 =>/usr/lib/libgssapi_krb5.so.2 (0x003a0000)/lib/ld-linux.so.2 0x00841000 (libkrb5.so.3) = >/usr/lib/libkrb5.so.3 (0x00411000) libcom_err.so.2 =>/lib/libcom_err.so.2 (0x00df1000) libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x004be000) libresolv.so.2 =>/lib/libresolv.so.2 (0x0022e000) libkrb5support.so.0 = >/usr/lib/libkrb5support.so.0 (0x004b3000) libkeyutils.so.1 =>/lib/libkeyutils.so.1 (0x0039b000) libselinux.so.1 =>/lib/libselinux.so.1 (0x00101000) libsepol.so.1 => Libsepol.so.1 (0x00da4000)

If you use the above option or there is a link error, such as the following stuff

LDAP.C: (. text+0x91): Undefined reference to ' ldap_url_parse '

Please compile the Curl library using the following instructions to generate the makefile file

./configure--disable-ldap--disable-ldaps,

The link can be done after compiling.

Related Article

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.