【问题标题】:Configuration issue when building ClamAV and OpenSSL from sources从源代码构建 ClamAV 和 OpenSSL 时的配置问题
【发布时间】:2017-10-16 16:56:07
【问题描述】:

我正在尝试在 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

【问题讨论】:

  • -rwxr-xr-x 1 root wheel ... - 您应该以普通用户的身份进行构建;而不是根。唯一需要 root 的时间是安装时 - sudo make install

标签: macos openssl anaconda


【解决方案1】:

编译的时候还是一样的问题,

解决方法:安装libxml2-dev libcurl4-openssl-dev

【讨论】:

  • 这个问题针对的是 Mac OS,而不是基于 Debian 的系统。
【解决方案2】:
$ 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/includeCFLAGS=-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

【讨论】:

  • $ 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 $ 跨度>
  • “clamav-0.99.2/”中的“配置”程序正在调用 SSL_library_init ();在第 17,958 行。好像是版本问题。要求页面似乎没有列出 openssl 版本要求。 clamav.net/documents/installing-clamav#requirements
  • @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 " ./configure
猜你喜欢
  • 2017-05-23
  • 1970-01-01
  • 1970-01-01
  • 2015-12-20
  • 2011-09-30
  • 2020-12-20
  • 1970-01-01
  • 2021-06-07
  • 1970-01-01
相关资源
最近更新 更多