簡體   English   中英

無法用 OpenSSL 交叉編譯 PostgreSQL,失敗<openssl opensslconf.h>未找到 - 盡管指定了包含搜索路徑</openssl>

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM