简体   繁体   English

如何使用最新的openssl编译curl

[英]How to compile curl with latest openssl

I download curl7.40 source code, and I have already compile openssl 1.0.2 source code, Now I want to compile curl with openssl 1.0.2. 我下载了curl7.40源代码,我已经编译了openssl 1.0.2源代码,现在我想用openssl 1.0.2编译curl。

./configure --prefix=/usr/local/curl-7.40.0 --with-ssl 
--with-libssl-prefix=/usr/local/openssl-1.0.2

make && make install

After I install, I ldd curl library but still link with system default library. 我安装后,我发现卷曲库但仍然与系统默认库链接。 ldd libcurl.so linux-vdso.so.1 => (0x00007fff2db2e000) libidn.so.11 => /usr/lib/x86_64-linux-gnu/libidn.so.11 (0x00007fafb9b6e000) librtmp.so.0 => /usr/lib/x86_64-linux-gnu/librtmp.so.0 (0x00007fafb9954000) libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007fafb96f5000) libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007fafb931b000) ...

UPDATE UPDATE
After some search, I use below command to config. 经过一些搜索,我使用下面的命令来配置。

./configure --prefix=/usr/local/curl-7.40.0 --with-ssl=/usr/local/openssl-1.0.2

But when make install, it will show below error information. 但是当make install时,它会显示以下错误信息。

../lib/.libs/libcurl.so: undefined reference to `SSLv2_client_method'
collect2: error: ld returned 1 exit status

The problem is likely with how you have build the OpenSSL library. 问题可能在于您如何构建OpenSSL库。

It is likely you have built openssl with SSLv2 disabled as some distributions have SSLv2 disable by default. 您可能已禁用SSLv2构建openssl,因为某些发行版默认情况下禁用SSLv2。 Look at the ./config for your system when you are compiling OpenSSL, and find the option that controls the OPENSSL_NO_SSL2 preprocessor flag. 在编译OpenSSL时查看系统的./config ,并找到控制OPENSSL_NO_SSL2预处理器标志的选项。
In order to use proper version of openssl while making from source, you can make openssl like this: 为了在从源代码制作时使用正确版本的openssl,你可以像这样制作openssl:

cd <path-to-openssl-dir>
./config enable-ssl2 enable-ssl3 --prefix=<path-to-openssl-install-dir>

Then, you can link your curl version properly to openssl by: 然后,您可以通过以下方式将您的卷曲版本正确链接到openssl:

./configure --with-ssl=<path-to-openssl-install-dir>

SSLv2_client_method() is used in lib/vtls/openssl.c, line 1575 with a check for availability of this function via autoconf . SSLv2_client_method()用于lib / vtls / openssl.c,第1575行,并通过autoconf 检查此功能的可用性。 It seems to me that autoconf's AC_CHECK_FUNCS incorrectly finds your system installation of openssl which has SSLv2 enabled before #include ing your own installation of openssl-1.0.2 which doesn't have SSLv2_client_method() and thus assumes the function to be available. 在我看来,autoconf的AC_CHECK_FUNCS错误地找到了你的系统安装openssl,它启用了SSLv2,然后#include你自己的openssl-1.0.2安装,它没有SSLv2_client_method() ,从而假设该功能可用。

Try passing CFLAGS=-I/usr/local/openssl-1.0.2/include or even "CFLAGS=-I/usr/local/openssl-1.0.2/include -DOPENSSL_NO_SSL2" as arguments to ./configure to force openssl.c to make do without the SSLv2_client_method() incorrectly assumed to be available. 尝试将CFLAGS=-I/usr/local/openssl-1.0.2/include甚至"CFLAGS=-I/usr/local/openssl-1.0.2/include -DOPENSSL_NO_SSL2"作为./configure参数传递给强制openssl.c如果没有错误地认为SSLv2_client_method()被认为是可用的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM