我在一个非标准的位置安装了自己的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,
我不知道我做错了什么,有什么想法吗?
我做了很多次头发拉扯后终于弄明白了。是一堆环境变量。。。我想我可能做得有点过头了,但这基本上起作用了:
这就是我在3.4中解决它的方法。适用于2.7和3.4。重要的是./configure中的--with ssl config参数:
谢谢@ScottFrazer的回答。帮我省了很多麻烦。
这是我在ubuntu中用最新的
openssl 1.0.2g
编译python的脚本。注意,安装是一个altinstall这意味着它将而不是覆盖ubuntu上的默认python。要验证安装是否成功:
相关问题 更多 >
编程相关推荐