在 Debian8 64b 上为 Python3.9 编译 SSL 模块时出错
Error compiling SSL module for Python3.9 on Debian8 64b
我需要在 GNU/Linux Debian8 64b 系统[=19= 上构建 python3.9 ]
我得到了3.9.7
版本的源代码并编译了它,但是我得到了以下关于ssl模块的错误:
Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
很公平:我从 github 下载了 openssl 代码,检查标签 OpenSSL_1_1_1l
并将其安装在本地路径中;
- 重新配置 python 3.9 源代码树
./configure --enable-optimizations --prefix=/opt/python3.9 --enable-shared --with-openssl=/root/develop/iQAC/openssl-1.1.1
- 检查了
config.log
文件以验证它确实找到了新的 openssl 安装
configure:17478: checking for openssl/ssl.h in /root/develop/iQAC/openssl-1.1.1
configure:17485: result: yes
configure:17501: checking whether compiling and linking against OpenSSL works
Trying link with OPENSSL_LDFLAGS=-L/root/develop/iQAC/openssl-1.1.1/lib; OPENSSL_LIBS=-lssl -lcrypto; OPENSSL_INCLUDES=-I/root/develop/iQAC/openssl-1.1.1/include
configure:17523: gcc -pthread -o conftest -I/root/develop/iQAC/openssl-1.1.1/include -L/root/develop/iQAC/openssl-1.1.1/lib conftest.c -lssl -lcrypto -lcrypt -lpthread -ldl -lutil -lm >&5
configure:17523: $? = 0
configure:17525: result: yes
configure:17548: checking for X509_VERIFY_PARAM_set1_host in libssl
configure:17577: gcc -pthread -o conftest -I/root/develop/iQAC/openssl-1.1.1/include -L/root/develop/iQAC/openssl-1.1.1/lib conftest.c -lssl -lcrypto -lcrypt -lpthread -ldl -lutil -lm >&5
configure:17577: $? = 0
configure:17588: result: yes
所以,据我所知,我应该能够正确地 link openssl 1.1.1 到我的 python 3.9 构建,仍然,关于 openssl 版本
我遇到了同样的错误
关于我做错了什么的任何建议and/or我可以做些什么来完成编译过程?
更新 #1
- 尝试 运行 以下命令,试图超越 Makefiles ;)
OPENSSL_LDFLAGS='-L/root/develop/iQAC/openssl-1.1.1/lib' OPENSSL_LIBS=-lssl OPENSSL_INCLUDES=-I/root/develop/iQAC/openssl-1.1.1/include make -j 3
仍然没有成功
更新#2
详细检查了编译日志,实际上构建本身并没有真正失败; openssl-1.1.1 的 include 和 lib 路径也是正确的:
building '_ssl' extension
gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-generate -I./Include/internal -I/root/develop/iQAC/openssl-1.1.1/include -I./Include -I. -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/root/develop/iQAC/build-folder/Python-3.9.7/Include -I/root/develop/iQAC/build-folder/Python-3.9.7 -c /root/develop/iQAC/build-folder/Python-3.9.7/Modules/_ssl.c -o build/temp.linux-x86_64-3.9/root/develop/iQAC/build-folder/Python-3.9.7/Modules/_ssl.o
gcc -pthread -shared -fprofile-generate build/temp.linux-x86_64-3.9/root/develop/iQAC/build-folder/Python-3.9.7/Modules/_ssl.o -L/root/develop/iQAC/openssl-1.1.1/lib -L. -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-x86_64-3.9/_ssl.cpython-39-x86_64-linux-gnu.so
经过反复试验,我成功构建了所有 python 3.9 模块
实际上我所做的只是更改 configure
选项:
./configure --enable-optimizations --prefix=/opt/python3.9 --enable-shared --with-openssl=/root/develop/iQAC/openssl-1.1.1
到
./configure --enable-optimizations --prefix=/opt/python3.9 --with-openssl=/root/develop/iQAC/openssl-1.1.1 --with-computed-gotos --enable-loadable-sqlite-extensions --enable-shared
在我看来,这听起来像是 confiugration/build 系统中的一个问题,但我不确定。欢迎评论
我需要在 GNU/Linux Debian8 64b 系统[=19= 上构建 python3.9 ]
我得到了3.9.7
版本的源代码并编译了它,但是我得到了以下关于ssl模块的错误:
Could not build the ssl module!
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
很公平:我从 github 下载了 openssl 代码,检查标签 OpenSSL_1_1_1l
并将其安装在本地路径中;
- 重新配置 python 3.9 源代码树
./configure --enable-optimizations --prefix=/opt/python3.9 --enable-shared --with-openssl=/root/develop/iQAC/openssl-1.1.1
- 检查了
config.log
文件以验证它确实找到了新的 openssl 安装
configure:17478: checking for openssl/ssl.h in /root/develop/iQAC/openssl-1.1.1
configure:17485: result: yes
configure:17501: checking whether compiling and linking against OpenSSL works
Trying link with OPENSSL_LDFLAGS=-L/root/develop/iQAC/openssl-1.1.1/lib; OPENSSL_LIBS=-lssl -lcrypto; OPENSSL_INCLUDES=-I/root/develop/iQAC/openssl-1.1.1/include
configure:17523: gcc -pthread -o conftest -I/root/develop/iQAC/openssl-1.1.1/include -L/root/develop/iQAC/openssl-1.1.1/lib conftest.c -lssl -lcrypto -lcrypt -lpthread -ldl -lutil -lm >&5
configure:17523: $? = 0
configure:17525: result: yes
configure:17548: checking for X509_VERIFY_PARAM_set1_host in libssl
configure:17577: gcc -pthread -o conftest -I/root/develop/iQAC/openssl-1.1.1/include -L/root/develop/iQAC/openssl-1.1.1/lib conftest.c -lssl -lcrypto -lcrypt -lpthread -ldl -lutil -lm >&5
configure:17577: $? = 0
configure:17588: result: yes
所以,据我所知,我应该能够正确地 link openssl 1.1.1 到我的 python 3.9 构建,仍然,关于 openssl 版本
我遇到了同样的错误关于我做错了什么的任何建议and/or我可以做些什么来完成编译过程?
更新 #1
- 尝试 运行 以下命令,试图超越 Makefiles ;)
OPENSSL_LDFLAGS='-L/root/develop/iQAC/openssl-1.1.1/lib' OPENSSL_LIBS=-lssl OPENSSL_INCLUDES=-I/root/develop/iQAC/openssl-1.1.1/include make -j 3
仍然没有成功
更新#2
详细检查了编译日志,实际上构建本身并没有真正失败; openssl-1.1.1 的 include 和 lib 路径也是正确的:
building '_ssl' extension
gcc -pthread -fPIC -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden -fprofile-generate -I./Include/internal -I/root/develop/iQAC/openssl-1.1.1/include -I./Include -I. -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/root/develop/iQAC/build-folder/Python-3.9.7/Include -I/root/develop/iQAC/build-folder/Python-3.9.7 -c /root/develop/iQAC/build-folder/Python-3.9.7/Modules/_ssl.c -o build/temp.linux-x86_64-3.9/root/develop/iQAC/build-folder/Python-3.9.7/Modules/_ssl.o
gcc -pthread -shared -fprofile-generate build/temp.linux-x86_64-3.9/root/develop/iQAC/build-folder/Python-3.9.7/Modules/_ssl.o -L/root/develop/iQAC/openssl-1.1.1/lib -L. -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-x86_64-3.9/_ssl.cpython-39-x86_64-linux-gnu.so
经过反复试验,我成功构建了所有 python 3.9 模块
实际上我所做的只是更改 configure
选项:
./configure --enable-optimizations --prefix=/opt/python3.9 --enable-shared --with-openssl=/root/develop/iQAC/openssl-1.1.1
到
./configure --enable-optimizations --prefix=/opt/python3.9 --with-openssl=/root/develop/iQAC/openssl-1.1.1 --with-computed-gotos --enable-loadable-sqlite-extensions --enable-shared
在我看来,这听起来像是 confiugration/build 系统中的一个问题,但我不确定。欢迎评论