Apache를 컴파일할 수 없습니다: "오류, SSL/TLS 라이브러리가 누락되었거나 사용할 수 없습니다."

Apache를 컴파일할 수 없습니다: "오류, SSL/TLS 라이브러리가 누락되었거나 사용할 수 없습니다."
  • 아치리눅스 2011.08.19 (리눅스 3.4.2 i686)
  • Apache 2.2.22 → 2.2.22 (재컴파일 및 재설치)
  • OpenSSL 1.0.1.c-1

이러한 세부 사항은 관련이 없을 가능성이 높지만: 업그레이드가 가능할 때마다 소스에서 Apache를 빌드하기 위해custompkg와 함께 yaourt를 사용하고 있으므로 PKGBUILD를 직접 편집하지 않고도 suexec docroot를 원하는 대로 변경할 수 있습니다.

과거에는 이것이 완벽하게 작동했습니다. 그러나 이제는 어떤 이유로든 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}

하지만 빌드하려고 하면 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]
==> -------------------------------
==> 

인터넷 검색을 통해 많은 사람들이 솔루션이 이라고 보고했지만 export LDFLAGS=-ldl이는 빌드 스크립트에서 설정했든 내 bash 프로필에서 설정했든 나에게는 아무런 효과가 없었습니다.

답변1

openssl을 0.9.8zb에서 1.0.1i로 업그레이드할 때도 동일한 문제가 발생했습니다.

$/tmp/src/openssl-1.0.1i/ ./config --prefix=/usr/local/openssl -fPIC
$/tmp/src/openssl-1.0.1i/ make test
$/tmp/src/openssl-1.0.1i/ sudo make install

$/tmp/src/httpd-2.2.27/ ./config --enable-so --enable-ssl=shared --with-ssl=/usr/local/openssl
...
$configure: error: ... Error, SSL/TLS libraries were missing or unusable

환경을 설정하는 솔루션 중 어느 것도 내가 받은 오류 메시지를 수정하지 못합니다.

내 해결책은 다음과 같습니다.

$/tmp/src/openssl-1.0.1i/ ./config --prefix=/usr/local/openssl-1.0.1 -shared -fPIC
$/tmp/src/openssl-1.0.1i/ make clean
$/tmp/src/openssl-1.0.1i/ make
$/tmp/src/openssl-1.0.1i/ make test
$/tmp/src/openssl-1.0.1i/ sudo make install

$sudo /sbin/ldconfig -v /usr/local/openssl-1.0.1/lib

$/tmp/src/httpd-2.2.27/ make clean && make distclean
$/tmp/src/httpd-2.2.27/ ./configure --enable-so --enable-ssl=shared --with-ssl=/usr/local/openssl-1.0.1
$/tmp/src/httpd-2.2.27/ make
$/tmp/src/httpd-2.2.27/ sudo make install

openssl 구성의 -shared 값으로 문제가 해결되었습니다. 이제 sslv2 메소드에 액세스할 수 없다는 또 다른 문제에 직면했습니다. 하지만 그건 이 문제와는 관련이 없고 아직 답변도 없습니다..

계속해서 sslv2 문제에 대한 답변을 검색하고 해결되면 관련 stackexchange 주제에 게시하겠습니다.

답변2

다른 Google 검색을 통해 다음과 같은 일부 환경 변수를 설정할 수 있습니다.

$ env LDFLAGS=-ldl

또는

$ export LIBS=-ldl

첫 번째는 실패했고 같은 오류가 발생했지만 두 번째는 작동했습니다.

첫 번째 명령이 작동하지 않으면 명령을 한 줄로 실행해야 합니다. LDFLAGS 변수 런타임이 걸리므로 저장되지 않습니다.

예: env LDFLAGS="-ldl" \ ./configure --prefix=/some/path ...

답변3

httpd 구성에 잘못된 OpenSSL 버전이 포함된 것 같습니다.

checking for openssl/engine.h... yes
checking for SSLeay_version... no
checking for SSL_CTX_new... no

OpenSSL을 여러 개 설치한 경우 이런 일이 발생할 수 있습니다. --with-ssl최신 OpenSSL 설치의 접두사와 일치하도록 옵션을 설정해 보세요 .

--enable-ssl \
--with-ssl=/usr/local \

답변4

이는 openssl의 pkg-config 파일이 더 이상 libdl에 대한 종속성을 지정하지 않기 때문에 발생합니다. openssl.pc의 최신 버전을 보면 -ldl이 더 이상 포함되지 않은 것을 볼 수 있습니다.

이것이 설정이 LIBS=-ldl작동하는 이유입니다(그리고 공유 객체 사용에 영향을 미치는 다른 접근 방식도 가능).

CHANGES 로그에 따르면 openssl이 항상 동적 공유 객체 로딩을 필요로 하지 않도록 0.9.6h에서 0.9.7로 수정되었습니다. 나는 openssl.pc 파일에 대한 변경이 동시에 일어났다고 믿지 않습니다. 언제 변경되었는지는 찾지 못했습니다.

따라서 이것은 기술적으로 Apache가 빌드에 필요한 라이브러리를 결정하기 위해 pkg-config를 사용할 때 발생하는 버그라고 생각합니다. 방금 Apache 2.2.31을 빌드하려고 할 때 동일한 문제가 발생했기 때문에 문제는 꽤 오랫동안 지속되었습니다.

관련 정보