无法编译 Apache:“错误,SSL/TLS 库丢失或无法使用”

Hug*_*ney 7 arch-linux make pacman openssl apache-httpd

  • Arch Linux 2011.08.19 (Linux 3.4.2 i686)
  • 阿帕奇 2.2.22 ? 2.2.22(重新编译并重新安装)
  • OpenSSL 1.0.1.c-1

这些细节可能无关紧要,但是:每次有可用升级时,我都会使用带有 custompkg 的 yaourt 从源代码构建 Apache,这样我就可以将 suexec docroot 更改为我想要的内容,而无需自己手动编辑 PKGBUILD。

在过去,这种方法完美无缺。但是,现在看来,无论出于何种原因,Apache 都无法编译。我刚刚进行了完整的系统升级,因此可能与此有关。

这是修改后的 PKGBUILD 中的配置行:

../configure --enable-layout=Arch \
    --enable-modules=all \
    --enable-mods-shared=all \
    --enable-so \
    --enable-suexec \
    --with-suexec-caller=http \
    --with-suexec-docroot=/srv/www \
    --with-suexec-logfile=/var/log/httpd/suexec.log \
    --with-suexec-bin=/usr/sbin/suexec \
    --with-suexec-uidmin=99 --with-suexec-gidmin=99 \
    --enable-ldap --enable-authnz-ldap \
    --enable-cache --enable-disk-cache --enable-mem-cache --enable-file-cache \
    --enable-ssl --with-ssl \
    --enable-deflate --enable-cgid \
    --enable-proxy --enable-proxy-connect \
    --enable-proxy-http --enable-proxy-ftp \
    --enable-dbd \
    --with-apr=/usr/bin/apr-1-config \
    --with-apr-util=/usr/bin/apu-1-config \
    --with-pcre=/usr \
    --with-mpm=${mpm}
Run Code Online (Sandbox Code Playgroud)

当我尝试构建时,它似乎运行良好,直到它到达 OpenSSL 的东西:

mkdir modules/ssl
checking whether to enable mod_ssl... checking dependencies
checking for SSL/TLS toolkit base... none
checking for OpenSSL version... checking openssl/opensslv.h usability... yes
checking openssl/opensslv.h presence... yes
checking for openssl/opensslv.h... yes
checking openssl/ssl.h usability... yes
checking openssl/ssl.h presence... yes
checking for openssl/ssl.h... yes
OK
  forcing SSL_LIBS to "-lssl -lcrypto  "
  adding "-lssl" to LIBS
  adding "-lcrypto" to LIBS
checking openssl/engine.h usability... yes
checking openssl/engine.h presence... yes
checking for openssl/engine.h... yes
checking for SSLeay_version... no
checking for SSL_CTX_new... no
checking for ENGINE_init... no
checking for ENGINE_load_builtin_engines... no
checking for SSL_set_cert_store... no
configure: error: ... Error, SSL/TLS libraries were missing or unusable
==> ERROR: A failure occurred in build().
    Aborting...
==> ERROR: Makepkg was unable to build apache.
==> Restart building apache ? [y/N]
==> -------------------------------
==> 
Run Code Online (Sandbox Code Playgroud)

谷歌搜索,许多人报告解决方案是export LDFLAGS=-ldl,但这对我没有影响,无论是在构建脚本中还是在我的 bash 配置文件中设置。

小智 2

看起来 httpd 配置包含错误版本的 OpenSSL。

checking for openssl/engine.h... yes
checking for SSLeay_version... no
checking for SSL_CTX_new... no
Run Code Online (Sandbox Code Playgroud)

如果您安装了多个 OpenSSL,则可能会发生这种情况。尝试设置该--with-ssl选项以匹配最新 OpenSSL 安装的前缀。

--enable-ssl \
--with-ssl=/usr/local \
Run Code Online (Sandbox Code Playgroud)