Libcurl compilation detailed

Source: Internet
Author: User
Tags ldap

The project applies libcurl, anyway is open source, that compiles on OK, just in the use process encountered n more egg pain problem, record down, for the same problem of friends to provide a reference.

Normal use of the compilation, the internet is more than a column also

./configure--prefix=/usr/local/curl the installation path.

Make;make Install

So it's done.

My problem is need to support HTTPS, then need to put OpenSSL compiled in, if your system installed SSL, check it yourself, in/lib,/lib64,/usr/local,/usr/local/lib anyway, if not, then congratulations. , you have to download or compile OpenSSL first, this part jumps over and I think you have.

./configure--prefix=/usr/local/curl--with-ssl=/usr/local/ssl If your SSL is executed in/USR/LOCAL/SSL, SSL support will appear : Enabled (OpenSSL) you think you're done? Try curl-v to see if there is a hint to find libssl.so bar, if there is no prompt, then you are luckier than me, if prompted, please perform the following

Env ldflags=-r/usr/local/ssl/lib./configure--prefix=/usr/local/curl--with-ssl=/usr/local/ssl It's basically a sure way to help you find LIB. It's ssl.so.

Well, you can get your program to load Libcurl.

What, you still have a problem, compile to pass, hint below this pile of mess of mistake

.. /LIB64/LIBCURL.A (LDAP.O): in function ' Curl_ldap ':
LDAP.C: (. text+0xa0): Undefined reference to ' ldap_url_parse '
LDAP.C: (. text+0xb8): Undefined reference to ' ldap_err2string '
LDAP.C: (. Text+0xee): Undefined reference to ' Ldap_msgfree '
LDAP.C: (. text+0x107): Undefined reference to ' Ldap_free_urldesc '
LDAP.C: (. text+0x119): Undefined reference to ' ldap_unbind_s '
LDAP.C: (. text+0x1bf): Undefined reference to ' ldap_set_option '
LDAP.C: (. text+0x1ce): Undefined reference to ' ldap_set_option '
LDAP.C: (. text+0x1e1): Undefined reference to ' ldap_init '
LDAP.C: (. text+0x255): Undefined reference to ' ldap_set_option '
LDAP.C: (. text+0x264): Undefined reference to ' ldap_set_option '
LDAP.C: (. text+0x293): Undefined reference to ' ldap_simple_bind_s '
LDAP.C: (. text+0x2c0): Undefined reference to ' ldap_set_option '
LDAP.C: (. text+0x2e6): Undefined reference to ' ldap_simple_bind_s '
LDAP.C: (. text+0x300): Undefined reference to ' ldap_err2string '
LDAP.C: (. text+0x350): Undefined reference to ' ldap_search_s '
LDAP.C: (. text+0x369): Undefined reference to ' ldap_err2string '
LDAP.C: (. text+0x39d): Undefined reference to ' ldap_first_entry '
LDAP.C: (. text+0x3e1): Undefined reference to ' ldap_get_dn '
LDAP.C: (. text+0x44f): Undefined reference to ' Ldap_first_attribute '
LDAP.C: (. text+0x46e): Undefined reference to ' Ldap_get_values_len '
LDAP.C: (. text+0x5a4): Undefined reference to ' Ldap_value_free_len '
LDAP.C: (. text+0x5d6): Undefined reference to ' Ldap_memfree '
LDAP.C: (. text+0x5ea): Undefined reference to ' Ldap_next_attribute '
LDAP.C: (. text+0x600): Undefined reference to ' Ldap_memfree '
LDAP.C: (. text+0x611): Undefined reference to ' Ber_free '
LDAP.C: (. text+0x620): Undefined reference to ' ldap_next_entry '
Collect2:ld returned 1 exit status

So congratulations, the LDAP content is not found in your system. Anyway, my system is not found, I do not want to use him, then in the compile time to disable it off, as follows:

Env ldflags=-r/usr/local/ssl/lib./configure--prefix=/usr/local/curl--with-ssl=/usr/local/ssl--disable-ldap-- Disable-ldaps

After this configuration, in theory you will be the LDAP thing shielding, what is called Theory, is the TM of others OK, and I can not. Look at the source code of curl, these error place in ldap.c, and this function is called, are based on CURL_DISABLE_LDAP this macro can control, define this macro, LDAP function completely with you no, OK, since I configure no matter, I'll just change the source code and define the macro in Curl_ldap.h. Reconfigure the compilation.

Compile the Libcurl into your project again, OK. If there are any other compile errors, then there may be some options in curl that you chose, but not in the system, and do it the same way.

Libcurl compilation detailed

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.