我正在尝试在OS X 10.11.6上构建clamav-0.99.2。 ./configure
收到以下错误:
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
可能与Anaconda的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 :(得分:0)
$ 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
后,您应该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/include
和LDFLAGS=-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。
答案 1 :(得分:-1)
编译时仍然存在相同的问题,
解决方案:安装libxml2-dev libcurl4-openssl-dev