0

我已经从源代码成功构建了 openssl、zlib 和 nghttp2。我曾经git repo安装每个库,并且没有弄乱它们中的任何一个的安装路径。他们位于这里

coke@DESKTOP-1B2KV2R:~$ ls
curl  nghttp2  openssl  wolfssl  zlib
coke@DESKTOP-1B2KV2R:~$

现在,我想使用这些库中的每一个构建 libcurl 7.78.0 DEV。从位于 INSTALL.MD 中的安装指南,我会做

./configure --with-wolfssl=PATH --with-zlib=PATH

然后运行

make

然后出于非错误目的,我会像这样在 make install 中包含 sudo

sudo make install

当我尝试用 wolfssl 构建它时,我得到了这个:

  Host setup:       x86_64-pc-linux-gnu
  Install prefix:   /usr/local
  Compiler:         gcc
   CFLAGS:          -Werror-implicit-function-declaration -O2 -Wno-system-headers -pthread
   CPPFLAGS:        -isystem PATH/include -isystem PATH/include -isystem /usr/local/include
   LDFLAGS:         -LPATH/lib -LPATH/lib -L/usr/local/lib
   LIBS:            -lnghttp2 -lwolfssl -lm -lz

  curl version:     7.80.0-DEV
  SSL:              enabled (WolfSSL)
  SSH:              no      (--with-{libssh,libssh2})
  zlib:             enabled

这表明 wolfssl 已启用,zlib 也已启用......所以我运行 make 命令并得到这个

coke@DESKTOP-1B2KV2R:~/curl$ make
Making all in lib
make[1]: Entering directory '/home/coke/curl/lib'
make  all-am
make[2]: Entering directory '/home/coke/curl/lib'
  CC       libcurl_la-http_aws_sigv4.lo
In file included from http_aws_sigv4.c:33:0:
curl_sha256.h:35:10: fatal error: openssl/sha.h: No such file or directory
 #include <openssl/sha.h>

如果我指定了 wolfssl,为什么它会尝试查找 openssl 库文件?

所以相反,我想也许出于某种原因我需要 wolfssl 的 openssl?所以我尝试了这个:

./configure --with-openssl=PATH

得到这个

configure: error: PATH is a bad --with-openssl prefix!

无论我输入什么,路径都是“错误的前缀”。我究竟将 --with-wolfssl/openssl 标志指向哪里?每个相应的下载目录中有许多文件。我在 Ubuntu 18.04 中使用 wsl。我还尝试按照此处的建议添加 without-ssl 标志https://www.wolfssl.com/wolfssl-build-option-in-curl/ ./configure 的完整输出并制作:

  Host setup:       x86_64-pc-linux-gnu
  Install prefix:   /usr/local
  Compiler:         gcc
   CFLAGS:          -Werror-implicit-function-declaration -O2 -Wno-system-headers -pthread
   CPPFLAGS:        -isystem /usr/local/include -isystem /usr/local/include -isystem /usr/local/include
   LDFLAGS:         -L/usr/local/lib -L/usr/local/lib -L/usr/local/lib
   LIBS:            -lnghttp2 -lwolfssl -lm -lz

  curl version:     7.80.0-DEV
  SSL:              enabled (WolfSSL)
  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:   /etc/ssl/certs/ca-certificates.crt
  ca cert path:     no
  ca fallback:      no
  LDAP:             no      (--enable-ldap / --with-ldap-lib / --with-lber-lib)
  LDAPS:            no      (--enable-ldaps)
  RTSP:             enabled
  RTMP:             no      (--with-librtmp)
  PSL:              no      (libpsl not found)
  Alt-svc:          enabled (--disable-alt-svc)
  HSTS:             enabled (--disable-hsts)
  HTTP1:            enabled (internal)
  HTTP2:            enabled (nghttp2)
  HTTP3:            no      (--with-ngtcp2, --with-quiche)
  ECH:              no      (--enable-ech)
  Protocols:        DICT FILE FTP FTPS GOPHER GOPHERS HTTP HTTPS IMAP IMAPS MQTT POP3 POP3S RTSP SMTP SMTPS TELNET TFTP
  Features:         AsynchDNS HSTS HTTP2 IPv6 Largefile SSL UnixSockets alt-svc libz

coke@DESKTOP-1B2KV2R:~/curl$ make
Making all in lib
make[1]: Entering directory '/home/coke/curl/lib'
make  all-am
make[2]: Entering directory '/home/coke/curl/lib'
  CC       libcurl_la-http_aws_sigv4.lo
In file included from http_aws_sigv4.c:33:0:
curl_sha256.h:35:10: fatal error: openssl/sha.h: No such file or directory
 #include <openssl/sha.h>
          ^~~~~~~~~~~~~~~
compilation terminated.
Makefile:2094: recipe for target 'libcurl_la-http_aws_sigv4.lo' failed
make[2]: *** [libcurl_la-http_aws_sigv4.lo] Error 1
make[2]: Leaving directory '/home/coke/curl/lib'
Makefile:1055: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/coke/curl/lib'
Makefile:1261: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

安装 libssl-dev 后(由于评论说 wolfssl 使用了一些 openssl 文件,我安装了)我已经摆脱了丢失的 openssl 头文件错误,但是我现在在运行时得到了这个make

Making all in lib
make[1]: Entering directory '/home/coke/curl/lib'
make  all-am
make[2]: Entering directory '/home/coke/curl/lib'
  CC       vtls/libcurl_la-wolfssl.lo
vtls/wolfssl.c: In function ‘wolfssl_connect_step1’:
vtls/wolfssl.c:385:11: error: implicit declaration of function ‘SSL_CTX_set1_curves_list’; did you mean ‘SSL_CTX_set1_groups_list’? [-Werror=implicit-function-declaration]
       if(!SSL_CTX_set1_curves_list(backend->ctx, curves)) {
           ^~~~~~~~~~~~~~~~~~~~~~~~
           SSL_CTX_set1_groups_list
cc1: some warnings being treated as errors
Makefile:2696: recipe for target 'vtls/libcurl_la-wolfssl.lo' failed
make[2]: *** [vtls/libcurl_la-wolfssl.lo] Error 1
make[2]: Leaving directory '/home/coke/curl/lib'
Makefile:1055: recipe for target 'all' failed
make[1]: *** [all] Error 2
make[1]: Leaving directory '/home/coke/curl/lib'
Makefile:1261: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

按照建议运行 cMake 会产生此问题:

../lib/libcurl.so: undefined reference to `wolfSSL_ERR_clear_error'
../lib/libcurl.so: undefined reference to `SSL_CTX_set1_curves_list'
collect2: error: ld returned 1 exit status
src/CMakeFiles/curl.dir/build.make:1328: recipe for target 'src/curl' failed
make[2]: *** [src/curl] Error 1
CMakeFiles/Makefile2:172: recipe for target 'src/CMakeFiles/curl.dir/all' failed
make[1]: *** [src/CMakeFiles/curl.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

运行这个``` cmake -D CMAKE_USE_WOLFSSL=YES -D CMAKE_USE_NGHTTP2=YES CMAKE_USE_ZLIB=YES "/home/cok e/curl" -- curl version=[7.80.0-DEV]

Produces this:
-- curl version=[7.80.0-DEV]
-- Found NGHTTP2: /usr/local/lib/libnghttp2.so
-- Could NOT find LibSSH2 (missing: LIBSSH2_LIBRARY LIBSSH2_INCLUDE_DIR)
-- Enabled features: SSL IPv6 unixsockets libz AsynchDNS Largefile alt-svc HSTS NTLM HTTP2 MultiSSL HTTPS-proxy
-- Enabled protocols: DICT FILE FTP FTPS GOPHER GOPHERS HTTP HTTPS IMAP IMAPS MQTT POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP
-- Enabled SSL backends: OpenSSL wolfSSL
-- Configuring done
-- Generating done
-- Build files have been written to: /home/coke/curl-build

然后 cmake --build 。生成上面给出的 libcurl.so
我接受了 MN 的建议并运行了他的回答
问题中列出的命令:
我究竟将 --with-wolfssl/openssl 标志指向哪里?如果我指定了 wolfssl,为什么它会尝试查找 openssl 库文件?

4

0 回答 0