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

이러한 세부 사항은 중요하지 않을 수 있지만 업그레이드가 가능할 때마다 PKGBUILD를 직접 편집할 필요 없이 suexec docroot를 원하는 대로 변경할 수 있도록 yaourt 및 custompkg를 사용하여 소스에서 Apache를 빌드합니다.

과거에는 이 접근 방식이 완벽하게 작동했습니다. 그러나 이제 어떤 이유로든 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을 빌드하려고 할 때 동일한 문제가 발생했기 때문에 이 문제는 오랫동안 존재해 왔습니다.

관련 정보