我在非标准位置(在本示例中为/my/path
)中安装了自己的OpenSSL,并且我希望针对源代码编译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