从源代码构建ClamAV和OpenSSL时的配置问题

问题描述:

我试图在OS X 10.11.6上构建clamav-0.99.2。 ./configure越来越以下错误:从源代码构建ClamAV和OpenSSL时的配置问题

configure:17977: error: Your OpenSSL installation is misconfigured or missing 

configure:17963: gcc -o conftest -I/usr/local/include -L/usr/local/lib -lssl -lcrypto -lz conftest.c -lssl -lcrypto -lz >&5 
Undefined symbols for architecture x86_64: 
    "_SSL_library_init", referenced from: 
     _main in conftest-256c9a.o 
ld: symbol(s) not found for architecture x86_64 

它只是运行一个简单的测试程序:

| Use char because int might match the return type of a GCC 
| builtin and then its argument prototype would still apply. */ 
| #ifdef __cplusplus 
| extern "C" 
| #endif 
| char SSL_library_init(); 
| int 
| main() 
| { 
| return SSL_library_init(); 
| ; 
| return 0; 
| } 

我试过./configure --without-ssl,同样的问题。

checking for OpenSSL installation... /usr/local 
checking for SSL_library_init in -lssl... no 
configure: error: Your OpenSSL installation is misconfigured or missing 

我从github上安装OpenSSL和它建立没有错误:

$ openssl 
OpenSSL> version 
OpenSSL 1.0.2l 25 May 2017 

可能有蟒蛇的OpenSSL的冲突:

$ which openssl 
/Users/davidlaxer/anaconda/bin/openssl 
$ whereis openssl 
/usr/bin/openssl 

功能SSL_library_init()不库:

$ nm /usr/local/lib/libssl.* | grep SSL_l 
00000000000143a0 T _SSL_load_client_CA_file 
0000000000001590 T _SSL_load_client_CA_file 
00000000000143a0 T _SSL_load_client_CA_file 

$ ls -l /usr/local/lib/libssl.* 
-rwxr-xr-x 1 root wheel 501464 Oct 14 14:41 /usr/local/lib/libssl.1.1.dylib 
-rw-r--r-- 1 root wheel 711256 Oct 14 14:41 /usr/local/lib/libssl.a 
lrwxr-xr-x 1 root wheel  16 Oct 14 14:41 /usr/local/lib/libssl.dylib -> libssl.1.1.dylib 

$ gcc --version 
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 
Apple LLVM version 8.0.0 (clang-800.0.42.1) 
Target: x86_64-apple-darwin15.6.0 
Thread model: posix 
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin 

Openssl的似乎有构建和传递给它的测试:

$ make test 
... 
All tests successful. 
Files=136, Tests=1116, 643 wallclock secs (3.69 usr 0.55 sys + 261.00 cusr 239.88 csys = 505.12 CPU) 
Result: PASS 
+0

*'-rwxr-xr-x 1个根轮...'* - 您应该以普通用户身份建立;而不是根。唯一需要root的时候是安装 - 'sudo make install'。 – jww

$ make test 
... 
All tests successful. 
Files=136, Tests=1116, 643 wallclock secs (3.69 usr 0.55 sys + 261.00 cusr 239.88 csys = 505.12 CPU) 
Result: PASS 

这是OpenSSL 1.1.0测试报告。 OpenSSL的1.0.2测试与完成:

$ make test 
... 

../util/shlib_wrap.sh ./bad_dtls_test 
make[1]: Leaving directory '/home/jwalton/openssl/test' 
OPENSSL_CONF=apps/openssl.cnf util/opensslwrap.sh version -a 
OpenSSL 1.0.2m-dev xx XXX xxxx 
built on: reproducible build, date unspecified 
platform: linux-x86_64 
options: bn(64,64) rc4(16x,int) des(idx,cisc,16,int) idea(int) blowfish(idx) 
compiler: gcc -I. -I.. -I../include -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN 
-DHAVE_DLFCN_H -Wa,--noexecstack -m64 -DL_ENDIAN -O3 -Wall -DOPENSSL_IA32_SSE2 - 
DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DRC4_ASM -DSH 
A1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DW 
HIRLPOOL_ASM -DGHASH_ASM -DECP_NISTZ256_ASM 
OPENSSLDIR: "/usr/local/ssl" 

您执行的git clone,你768,16 git checkout OpenSSL_1_0_2-stable后。

相关,我可以复制你的OpenSSL 1.1.0结果:

$ git checkout OpenSSL_1_1_0-stable 
Branch OpenSSL_1_1_0-stable set up to track remote branch OpenSSL_1_1_0-stable from origin. 
Switched to a new branch 'OpenSSL_1_1_0-stable' 

$ ./config 
... 
$ make -j 10 
... 
$ make check 
... 
All tests successful. 
Files=95, Tests=555, 173 wallclock secs (1.29 usr 0.16 sys + 112.13 cusr 78.73 csys = 192.31 CPU) 
Result: PASS 
make[1]: Leaving directory '/home/jwalton/openssl' 

OpenSSL的1.1.0解释了这一结果:

$ nm /usr/local/lib/libssl.* | grep SSL_l 
00000000000143a0 T _SSL_load_client_CA_file 
0000000000001590 T _SSL_load_client_CA_file 
00000000000143a0 T _SSL_load_client_CA_file 

您将有OPENSSL_init_ssl,不SSL_library_init。相关内容请参阅OpenSSL wiki上的Library Initialization


| #ifdef __cplusplus 
| extern "C" 
| #endif 
| char SSL_library_init(); 
| int 
| main() 
| { 
| return SSL_library_init(); 
| ; 
| return 0; 
| } 

关于,“这只是运行一个简单的测试程序......”,我们需要看到更多。特别是在配置期间使用的-I-L

当你运行configure时,我有一种感觉,你需要CPPFLAGS=-I/usr/local/ssl/include,CFLAGS=-I/usr/local/ssl/includeLDFLAGS=-L/usr/local/ssl/lib

您可以在Noloader | Build-Scripts上看到一些配置Autools项目的示例。您可以通过复制/粘贴build-ssh.sh脚本来构建ClamAV。你需要zLib和OpenSSL;只需交换ClamAV和SSH。

但是,我厌倦了从源码构建ClamAV的快速端口,并且因为ClamAV无法使用/usr/local/lib64中的库而失败。我上传了build-clamav.sh,所以如果需要,你可以用它作为起点。另见ClamAV Issue 11929

+0

$ nm /usr/local/lib/libssl.* | grep的OPENSSL_init_ssl 0000000000019b20牛逼_OPENSSL_init_ssl 00000000000603e4 b _OPENSSL_init_ssl.stoperrset 0000000000000000牛逼_OPENSSL_init_ssl 0000000000000540 b _OPENSSL_init_ssl.stoperrset ü_OPENSSL_init_ssl ü_OPENSSL_init_ssl 0000000000019b20牛逼_OPENSSL_init_ssl 00000000000603e4 b _OPENSSL_init_ssl.stoperrset 大卫 - Laxers-的MacBook-PRO:OpenSSL的davidlaxer $ – dbl001

+0

'clamav-0.99.2 /'中的'configure'程序正在调用SSL_library_init(); 17958线。看起来像版本问题。需求页面似乎没有列出openssl版本的要求。 https://www.clamav.net/documents/installing-clamav#requirements – dbl001

+0

@ dbl001 - 正确;您需要使用OpenSSL 1.0.2及更低版本;不是OpenSSL 1.1.0或更高版本。它是包的常见问题。即使OpenSSH也不能使用OpenSSL 1.1.0构建。但是,在您解决OpenSSL版本问题之后,您可能会遇到更多问题。 – jww