Macos 从源代码构建ClamAV和OpenSSL时出现配置问题
我正在尝试在OSX10.11.6上构建clamav-0.99.2<代码>/configure出现以下错误:Macos 从源代码构建ClamAV和OpenSSL时出现配置问题,macos,openssl,anaconda,Macos,Openssl,Anaconda,我正在尝试在OSX10.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
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--没有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\u library\u 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
这是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克隆后
,您应该git签出OpenSSL\u 1\u 0\u 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解释了这一结果: 您将拥有
OPENSSL\u init\u ssl
,而不是ssl\u library\u init
。相关的,请参见OpenSSL wiki上的
关于“它只是运行一个简单的测试程序…”,我们需要了解更多。特别是配置期间使用的
-I
和-L
我觉得运行configure时需要cppfagas=-I/usr/local/ssl/include
,CFLAGS=-I/usr/local/ssl/include
和LDFLAGS=-L/usr/local/ssl/lib
您可以在中看到一些配置Autools项目的示例。您可以通过在build-ssh.sh脚本上复制/粘贴来构建ClamAV。您需要zLib和OpenSSL;只需交换ClamAV和SSH
然而,我厌倦了从源代码构建ClamAV的快速端口,它失败了,因为ClamAV无法使用
/usr/local/lib64
中的库。我上传了buildclamav.sh
,因此如果需要,您可以将其用作起点。另请参见。编译时仍然存在相同的问题
解决方案:安装libxml2 dev libcurl4 openssl dev
-rwxr-xr-x 1根控制盘…
-您应该作为普通用户进行构建;而不是根。您需要root的唯一时间是在安装时-sudo make install
$nm/usr/local/lib/libssl.*grep OPENSSL\U init\U ssl 0000000000019b20 T\U OPENSSL\U init\U ssl 000000603e4 b\U OPENSSL\U init\U ssl.stoperset 0000000000000000 T\U OPENSSL\U init\U ssl 0000000000000 540 b\U OPENSSL\U init\U ssl\U OPENSSL\U init\UOPENSSL\U init\U ssl 0000000000019b20 T\U OPENSSL\U init\U ssl 00000000000603e4 b\U OPENSSL\U init\U ssl.stoperset David Laxers MacBook Pro:OPENSSL davidlaxer$“clamav-0.99.2/”中的“configure”程序正在调用ssl\U library\U init();在线17958。似乎是版本问题。“要求”页面似乎没有列出openssl版本要求@dbl001-右;您需要使用OpenSSL 1.0.2及以下版本;不是OpenSSL 1.1.0或更高版本。这是软件包的常见问题。即使是OpenSSH也无法使用OpenSSL 1.1.0进行构建。但在解决OpenSSL版本问题后,您可能会遇到更多问题。我使用OpenSSL 1.0.2-stable重建了此版本。$nm/usr/local/ssl/lib/libssl.a | grep ssl_library_init 00000000 T_ssl_library_init$CPPFLAGS=“-I/usr/local/ssl/include”LDFLAGS=“-L/usr/local/ssl/lib”CFLAGS=“-I/usr/local/ssl/include.”/configurance这个问题是针对Mac OS而不是基于Debian的系统提出的。
$ 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'
$ 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
| #ifdef __cplusplus
| extern "C"
| #endif
| char SSL_library_init ();
| int
| main ()
| {
| return SSL_library_init ();
| ;
| return 0;
| }