gpt4 book ai didi

python - 如何使用自定义 OpenSSL 编译 Python 3.4?

转载 作者:IT老高 更新时间:2023-10-28 22:20:35 27 4
gpt4 key购买 nike

我在非标准位置安装了自己的 OpenSSL(/my/path),我希望 Python 3.4 在针对源代码进行编译时构建它。我试过的是这个(目录缩写)

CPPFLAGS="-I/my/path/include -I/my/path/include/openssl" ./configure --prefix=/my/path/

我也尝试使用 C_INCLUDE_PATH 和冒号分隔的路径。

然后,我运行 make 并得到这个:

building '_ssl' extension
gcc -pthread -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I./Include -I. -IInclude -I/my/path/include -I/my/path/include/openssl -I/usr/local/include -I/my/path/Python-3.4.0/Include -I/my/path/Python-3.4.0 -c /my/path/Python-3.4.0/Modules/_ssl.c -o build/temp.linux-x86_64-3.4/my/path/Python-3.4.0/Modules/_ssl.o
gcc -pthread -shared build/temp.linux-x86_64-3.4/my/path/Python-3.4.0/Modules/_ssl.o -L/my/path/lib -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-x86_64-3.4/_ssl.cpython-34m.so
*** WARNING: renaming "_ssl" since importing it failed: build/lib.linux-x86_64-3.4/_ssl.cpython-34m.so: undefined symbol: SSL_get0_next_proto_negotiated

它正在寻找 SSL_get0_next_proto_negotiated,但这是最确定的:

$ grep SSL_get0_next_proto_negotiated /my/path/include/openssl/*
/my/path/include/openssl/ssl.h:void SSL_get0_next_proto_negotiated(const SSL *s,

我不确定我做错了什么,有什么想法吗?

最佳答案

经过大量的拉扯,我设法弄明白了。这是一堆环境变量......我想我可能做得有点过头了,但这基本上奏效了:

# OpenSSL 1.0.1g
./config shared --prefix=/my/path --openssldir=/my/path/openssl
make
make install

# Python 3.4
export LDFLAGS="-L/my/path/lib/ -L/my/path/lib64/"
export LD_LIBRARY_PATH="/my/path/lib/:/my/path/lib64/"
export CPPFLAGS="-I/my/path/include -I/my/path/include/openssl"
./configure --prefix=/my/path/
make
make install

关于python - 如何使用自定义 OpenSSL 编译 Python 3.4?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23548188/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com