linux下编译libcurl报错ldapsb_tls

使用configure时,库找不到,比如:使用pkgconfig查找库,详见

[root@localhost curl-master]# pkg-config  --variable pc_path pkg-config
/usr/lib64/pkgconfig:/usr/share/pkgconfig

然后去这两个路径下查找库的  .pc   文件(比如openssl库就是libssl.pc),没有就将   .pc   文件放入这两个文件夹中的一个中;

比如:
[root@localhost pkgconfig]# ll /usr/lib64/pkgconfig
total 560
-rw-r--r-- 1 root root  323 Mar 13  2020 appstream-builder.pc
-rw-r--r-- 1 root root  215 Mar 13  2020 atk.pc
-rw-r--r-- 1 root root  193 Oct 15  2020 blkid.pc
-rw-r--r-- 1 root root  297 Mar 13  2020 blockdev.pc
-rw-r--r-- 1 root root  310 Mar 13  2020 blockdev-utils.pc
-rw-r--r-- 1 root root  203 Apr  1  2020 bzip2.pc
-rw-r--r-- 1 root root  245 Mar 13  2020 cairo-fc.pc
-rw-r--r-- 1 root root  242 Mar 13  2020 cairo-ft.pc
-rw-r--r-- 1 root root  279 Mar 13  2020 cairo-gobject.pc

对于这个错误(报错ldapsb_tls),是由于openssl导致的,可以将openssl的pkgconfig下面的pc文件放到 使用 pkg-config --variable pc_path pkg-config指令查找出的路径下(/usr/lib64/pkgconfig:/usr/share/pkgconfig当中,两个选一个就行了);
******************************************************** 分割线 ************************************************

错误流程

1.运行指令 ./buildconf
2…/configure --prefix=你希望安装的目录


  Host setup:       aarch64-unknown-linux-gnu
  Install prefix:   /chenbin/3th_library/curl-master/install
  Compiler:         gcc
   CFLAGS:          -Werror-implicit-function-declaration -O2 -Wno-system-headers -pthread
   CPPFLAGS:        
   LDFLAGS:         
   LIBS:            -lpsl -lldap -llber -lz

  curl version:     7.76.1-DEV
  SSL:              no      (--with-{ssl,gnutls,nss,mbedtls,wolfssl,schannel,secure-transport,mesalink,amissl,bearssl,rustls} )
  SSH:              no      (--with-{libssh,libssh2})
  zlib:             enabled
  brotli:           no      (--with-brotli)
  zstd:             no      (--with-zstd)
  GSS-API:          no      (--with-gssapi)
  GSASL:            no      (libgsasl not found)
  TLS-SRP:          no      (--enable-tls-srp)
  resolver:         POSIX threaded
  IPv6:             enabled
  Unix sockets:     enabled
  IDN:              no      (--with-{libidn2,winidn})
  Build libcurl:    Shared=yes, Static=yes
  Built-in manual:  enabled
  --libcurl option: enabled (--disable-libcurl-option)
  Verbose errors:   enabled (--disable-verbose)
  Code coverage:    disabled
  SSPI:             no      (--enable-sspi)
  ca cert bundle:   no
  ca cert path:     
  ca fallback:      
  LDAP:             enabled (OpenLDAP)
  LDAPS:            enabled
  RTSP:             enabled
  RTMP:             no      (--with-librtmp)
  Metalink:         no      (--with-libmetalink)
  PSL:              enabled
  Alt-svc:          enabled
  HTTP1:            enabled (internal)
  HTTP2:            no      (--with-nghttp2, --with-hyper)
  HTTP3:            no      (--with-ngtcp2, --with-quiche)
  ECH:              no      (--enable-ech)
  Protocols:        DICT FILE FTP GOPHER HTTP IMAP LDAP MQTT POP3 RTSP SMTP TELNET TFTP
  Features:         AsynchDNS IPv6 Largefile PSL UnixSockets alt-svc libz

3.make
make报错

[root@localhost curl-master]# make
Making all in lib
make[1]: Entering directory '/chenbin/3th_library/curl-master/lib'
make  all-am
make[2]: Entering directory '/chenbin/3th_library/curl-master/lib'
  CC       libcurl_la-altsvc.lo
  CC       libcurl_la-amigaos.lo
  CC       libcurl_la-asyn-ares.lo
  CC       libcurl_la-asyn-thread.lo
  CC       libcurl_la-base64.lo
  ...
  ...//省略
  ...
  CC       libcurl_la-non-ascii.lo
  CC       libcurl_la-nonblock.lo
  CC       libcurl_la-openldap.lo
openldap.c: In function ?.dap_disconnect?.
openldap.c:374:33: error: ?.dapsb_tls?.undeclared (first use in this function); did you mean ?.dap_do?.
         ber_sockbuf_add_io(sb, &ldapsb_tls, LBER_SBIOD_LEVEL_TRANSPORT, data);
                                 ^~~~~~~~~~
                                 ldap_do
openldap.c:374:33: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [Makefile:2514: libcurl_la-openldap.lo] Error 1
make[2]: Leaving directory '/chenbin/3th_library/curl-master/lib'
make[1]: *** [Makefile:1345: all] Error 2
make[1]: Leaving directory '/chenbin/3th_library/curl-master/lib'
make: *** [Makefile:1252: all-recursive] Error 1

原因:未指定openssl的安装路径;
在进行configure的时候,输出了这样一行:

 SSL:              no      (--with-{ssl,gnutls,nss,mbedtls,wolfssl,schannel,secure-transport,mesalink,amissl,bearssl,rustls} )

表示没有找到openssl;

正确流程

1.编译openssl,并指定openssl的安装目录;
2.执行buildconf生成configure文件;
3.执行configure,命令如下:

./configure --prefix=/chenbin/3th_library/curl-master/install --with-ssl=/chenbin/3th_library/openssl-1.1.1c/install

命令输出如下(可以发现SSL项目的输出变了):


  Host setup:       aarch64-unknown-linux-gnu
  Install prefix:   /chenbin/3th_library/curl-master/install
  Compiler:         gcc
   CFLAGS:          -Werror-implicit-function-declaration -O2 -Wno-system-headers -pthread
   CPPFLAGS:        -isystem /chenbin/3th_library/openssl-1.1.1c/install/include
   LDFLAGS:         -L/chenbin/3th_library/openssl-1.1.1c/install/lib
   LIBS:            -lpsl -lssl -lcrypto -lssl -lcrypto -lldap -llber -lz

  curl version:     7.76.1-DEV
  SSL:              enabled (OpenSSL)
  SSH:              no      (--with-{libssh,libssh2})
  zlib:             enabled
  brotli:           no      (--with-brotli)
  zstd:             no      (--with-zstd)
  GSS-API:          no      (--with-gssapi)
  GSASL:            no      (libgsasl not found)
  TLS-SRP:          enabled
  resolver:         POSIX threaded
  IPv6:             enabled
  Unix sockets:     enabled
  IDN:              no      (--with-{libidn2,winidn})
  Build libcurl:    Shared=yes, Static=yes
  Built-in manual:  enabled
  --libcurl option: enabled (--disable-libcurl-option)
  Verbose errors:   enabled (--disable-verbose)
  Code coverage:    disabled
  SSPI:             no      (--enable-sspi)
  ca cert bundle:   /etc/pki/tls/certs/ca-bundle.crt
  ca cert path:     no
  ca fallback:      no
  LDAP:             enabled (OpenLDAP)
  LDAPS:            enabled
  RTSP:             enabled
  RTMP:             no      (--with-librtmp)
  Metalink:         no      (--with-libmetalink)
  PSL:              enabled
  Alt-svc:          enabled
  HTTP1:            enabled (internal)
  HTTP2:            no      (--with-nghttp2, --with-hyper)
  HTTP3:            no      (--with-ngtcp2, --with-quiche)
  ECH:              no      (--enable-ech)
  Protocols:        DICT FILE FTP FTPS GOPHER GOPHERS HTTP HTTPS IMAP IMAPS LDAP LDAPS MQTT POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP
  Features:         AsynchDNS HTTPS-proxy IPv6 Largefile NTLM NTLM_WB PSL SSL TLS-SRP UnixSockets alt-svc libz

使用 –with-ssl= 来指定openssl的安装位置;
4.make
5.make install

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值