Linux 无法将PostgreSQL与OpenSSL交叉编译,在<;openssl/opensslconf.h>;未找到-尽管指定了包含搜索路径
我试图在x86主机上为AArch64目标交叉编译PostgreSQL,并希望使用OpenSSL支持进行编译 我已经使用以下参数成功地为AArch64交叉编译了OpenSSL:Linux 无法将PostgreSQL与OpenSSL交叉编译,在<;openssl/opensslconf.h>;未找到-尽管指定了包含搜索路径,linux,postgresql,openssl,autotools,autoconf,Linux,Postgresql,Openssl,Autotools,Autoconf,我试图在x86主机上为AArch64目标交叉编译PostgreSQL,并希望使用OpenSSL支持进行编译 我已经使用以下参数成功地为AArch64交叉编译了OpenSSL: ../Configure linux-aarch64 --prefix=$(pwd)/packaged no-dso --cross-compile-prefix="/usr/bin/aarch64-linux-gnu-" make -j$(nproc) make -j$(nproc) install
../Configure linux-aarch64 --prefix=$(pwd)/packaged no-dso --cross-compile-prefix="/usr/bin/aarch64-linux-gnu-"
make -j$(nproc)
make -j$(nproc) install
现在开始交叉编译PostgreSQL,我使用以下构建脚本:
test -e postgresql-12.2.tar.gz || wget https://ftp.postgresql.org/pub/source/v12.2/postgresql-12.2.tar.gz
test -e postgresql-12.2 || tar -xzvf postgresql-12.2.tar.gz
cd postgresql-12.2
test -e build_aarch64 && rm -rf build_aarch64
mkdir build_aarch64
cd build_aarch64
../configure --host=aarch64-linux-gnu --without-readline --without-zlib CFLAGS="-O3 -fPIC" CXXFLAGS="-fPIC" CPPFLAGS="-fPIC" --prefix=$PWD/packaged USE_DEV_URANDOM=1 --with-openssl --with-libraries=../../openssl-OpenSSL_1_1_1k/build_aarch64/packaged/lib/ --with-includes=../../openssl-OpenSSL_1_1_1k/build_aarch64/packaged/include/
make -j$(nproc)
configure命令的输出显示include目录已正确设置:
configure: using CPPFLAGS=-fPIC -D_GNU_SOURCE -I../../openssl-OpenSSL_1_1_1k/build_aarch64/packaged/include/
configure: using LDFLAGS= -L../../openssl-OpenSSL_1_1_1k/build_aarch64/packaged/lib/
在以下情况下运行make
命令失败:
/usr/include/openssl/e_os2.h:13:11: fatal error: openssl/opensslconf.h: No such file or directory
13 | # include <openssl/opensslconf.h>
所以文件肯定在include路径中。这是虫子吗?我做得不对吗?弄明白了,似乎我必须使用绝对路径而不是相对路径来搜索目录:
../configure --host=aarch64-linux-gnu --without-readline --without-zlib CFLAGS="-O3 -fPIC" CXXFLAGS="-fPIC" CPPFLAGS="-fPIC" --prefix=$PWD/packaged USE_DEV_URANDOM=1 --with-openssl --with-libraries=$(pwd)/../../openssl-OpenSSL_1_1_1k/build_aarch64/packaged/lib/ --with-includes=$(pwd)/../../openssl-OpenSSL_1_1_1k/build_aarch64/packaged/include/
因此,基本上只是在搜索目录路径的开头添加了
$(pwd)/
。/usr/include/openssl/e_os2.h:13:11:致命错误:openssl/opensslconf.h:
该错误消息(即路径
)表明make
正在查看构建系统/usr
,不在你的交叉编译环境中?我甚至没听清楚,谢谢@tink
../configure --host=aarch64-linux-gnu --without-readline --without-zlib CFLAGS="-O3 -fPIC" CXXFLAGS="-fPIC" CPPFLAGS="-fPIC" --prefix=$PWD/packaged USE_DEV_URANDOM=1 --with-openssl --with-libraries=$(pwd)/../../openssl-OpenSSL_1_1_1k/build_aarch64/packaged/lib/ --with-includes=$(pwd)/../../openssl-OpenSSL_1_1_1k/build_aarch64/packaged/include/