Debian编译BitchX指定--with-ssl时无法找到OpenSSL的问题
I’ve dealt with this exact headache before when compiling older autotools-based projects against modern Debian’s OpenSSL packages—let’s break down the most reliable fixes step by step:
First, install
pkg-config(it’s often missing by default)
Many legacyconfigurescripts rely onpkg-configto correctly locate library paths and compiler flags, especially when system libraries live in locations the script doesn’t expect. Run this to install it:sudo apt update && sudo apt install pkg-configVerify it can detect your OpenSSL installation with:
pkg-config --cflags --libs opensslYou should see output like
-I/usr/include/openssl -L/usr/lib/x86_64-linux-gnu -lssl -lcrypto. If that works, re-run your original configure command:./configure --with-sslManually specify OpenSSL paths to
configure
Ifpkg-configdoesn’t resolve the issue, the script might be looking in the wrong directories. Debian installs libssl-dev headers in/usr/include/openssland libraries in/usr/lib/x86_64-linux-gnu/(for 64-bit systems). Try explicitly pointingconfigureto these locations:./configure --with-ssl=/usr --with-ssl-lib=/usr/lib/x86_64-linux-gnuAlternatively, pass the required flags directly via
CFLAGSandLDFLAGS:CFLAGS="-I/usr/include/openssl" LDFLAGS="-L/usr/lib/x86_64-linux-gnu -lssl -lcrypto" ./configure --with-sslCheck for OpenSSL version compatibility
BitchX’sconfigurescript is quite old, and it’s likely checking for deprecated OpenSSL functions likeSSLeay—which were removed or renamed in OpenSSL 1.1.0+ (the version you have installed). If the above steps fail, you have two options:- Install the legacy OpenSSL 1.0 dev package (if available on your Debian version):
Then run configure with the legacy library path:sudo apt install libssl1.0-dev./configure --with-ssl=/usr/lib/x86_64-linux-gnu/openssl-1.0.0/ - Patch the
configurescript to use modern OpenSSL checks. Open theconfigurefile and look for lines that check forSSLeay(e.g.,AC_CHECK_LIB(crypto, SSLeay, ...)). Replace that line with a check for a modern function likeOPENSSL_version:
Then install# Original line (or similar): AC_CHECK_LIB(crypto, SSLeay, [SSL_LIBS="-lcrypto"], [AC_MSG_ERROR(--with-ssl given, but could not find OpenSSL)]) # Replace with: AC_CHECK_LIB(crypto, OPENSSL_version, [SSL_LIBS="-lcrypto"], [AC_MSG_ERROR(--with-ssl given, but could not find OpenSSL)])autoconf(if you don’t have it) and regenerate the configure script:
Try runningsudo apt install autoconf && autoconf./configure --with-sslagain after this.
- Install the legacy OpenSSL 1.0 dev package (if available on your Debian version):
Verify library permissions
Rarely, permission issues can blockconfigurefrom accessing the libraries. Run these commands to ensure the files are readable:ls -l /usr/lib/x86_64-linux-gnu/libcrypto.so ls -l /usr/include/openssl/ssl.hIf they’re owned by root (which is standard), just confirm other users have read access (they should by default).
内容的提问来源于stack exchange,提问作者Jeffrey L. Roberts

