【问题标题】:Apache 2.4.23 undefined reference to CRYPTO_malloc_init?Apache 2.4.23 未定义对 CRYPTO_malloc_init 的引用?
【发布时间】:2017-03-29 03:29:25
【问题描述】:

您好,我正在尝试使用 openssl 版本 1.1.0c 安装 Apache 2.4.23,同时执行 make 命令时出现以下错误, 我搜索了很多网站,但我看不到任何相关的答案。我也附上了错误。你能解决我的问题吗?

./configure --prefix=/usr/local/apache2 --with-included-apr --enable-so  --with-ssl=/usr/local/openssl --enable-ssl=shared  --with-pcre=/usr/local/pcre/

make

ab.o: In function main': /usr/src/httpd-2.4.23/support/ab.c:2417:   undefined reference to `CRYPTO_malloc_init'
collect2: error: ld returned 1 exit status
Makefile:73: recipe for target 'ab' failed
make[2]: \*** [ab] Error 1
make[2]: Leaving directory '/usr/src/httpd-2.4.23/support' /usr/src/httpd-2.4.23/build/rules.mk:75: recipe for target 'all-recursive' failed
make[1]: \*** [all-recursive] Error 1
make[1]: Leaving directory '/usr/src/httpd-2.4.23/support' /usr/src/httpd-2.4.23/build/rules.mk:75: recipe for target 'all-recursive' failed
make: *** [all-recursive] Error 1

提前致谢

【问题讨论】:

    标签: linux apache openssl


    【解决方案1】:

    archlinux 用户存储库中有一个用于 httpd 2.4.23 的 patch,用于处理不同 openssl 版本之间的差异。除其他外,它通过以下方式修改ab.c

    @@ -2465,7 +2499,11 @@ int main(int argc, const char * const argv[])
     #ifdef RSAREF
         R_malloc_init();
     #else
    +#if OPENSSL_VERSION_NUMBER < 0x10100000L
         CRYPTO_malloc_init();
    +#else
    +    OPENSSL_malloc_init();
    +#endif
     #endif
         SSL_load_error_strings();
         SSL_library_init();
    

    我应用了整个补丁,构建成功。

    P.S.:当从源代码构建流行软件时遇到问题时,查看您的发行版如何构建软件包可能会有所帮助(查找 PKGFILE/specfile/rules 等)。

    【讨论】:

      【解决方案2】:

      Apache 2.4.23 未定义对 CRYPTO_malloc_init 的引用?

      OpenSSL 1.0.2 及更早版本提供CRYPTO_malloc_init

      openssl-1.0.2h$ grep -R CRYPTO_malloc_init *
      apps/apps.h:                        do { do_pipe_sig(); CRYPTO_malloc_init(); \
      apps/apps.h:                        do { do_pipe_sig(); CRYPTO_malloc_init(); \
      crypto/crypto.h:# define CRYPTO_malloc_init()    CRYPTO_set_mem_functions(\
      crypto/dh/dhtest.c:    CRYPTO_malloc_init();
      crypto/ecdh/ecdhtest.c:    CRYPTO_malloc_init();
      ...
      

      OpenSSL 1.1.0 及更高版本似乎不提供CRYPTO_malloc_init

      openssl-1.1.0b$ grep -R CRYPTO_malloc_init *
      openssl-1.1.0b$
      

      另见Apache Issue 60061 - OpenSSL 1.1.0 support

      【讨论】:

      • 如何解决这个问题或者我应该安装OpenSSL 1.0.2h 吗?
      • 好吧,我想你有三个选择。首先是使用1.0.2。二是在SVN中使用Apache tip。三是修改 Apache 2.4 源码。在 Apache 赶上之前,我个人可能会使用 (1)。我个人会避免(3),因为不知道兔子洞有多深。但是你必须做对你有用的事情。我不应该放弃解决方案,因为对我有用的可能对你不起作用。
      猜你喜欢
      • 2012-04-09
      • 2013-02-23
      • 2018-12-24
      • 1970-01-01
      • 2011-03-27
      • 2022-01-22
      • 2016-04-04
      • 2015-11-03
      • 2011-08-11
      相关资源
      最近更新 更多