[英]Unable to cross compile PostgreSQL with OpenSSL, fails on <openssl/opensslconf.h> not found - despite specifying include search path
我正在尝试在 x86 主机上为 AArch64 目标交叉编译 PostgreSQL,并希望在 OpenSSL 支持下进行编译。
我已经继续并使用以下 arguments 为 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
现在开始交叉编译 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)
配置命令的 output 显示包含目录已正确设置:
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>
但是,如果我运行find../../openssl-OpenSSL_1_1_1k/build_aarch64/packaged/include/ | grep opensslconf.h
find../../openssl-OpenSSL_1_1_1k/build_aarch64/packaged/include/ | grep opensslconf.h
它输出:
../../openssl-OpenSSL_1_1_1k/build_aarch64/packaged/include/openssl/opensslconf.h
所以该文件肯定存在于包含路径中。 这是一个错误吗? 我做错了什么吗?
想通了,看起来我必须使用绝对路径而不是搜索目录的相对路径:
../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)/
添加到搜索目录路径的开头。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.