如何使用自定义 OpenSSL 编译 Python 3.4? [英] How do I compile Python 3.4 with custom OpenSSL?

查看:28
本文介绍了如何使用自定义 OpenSSL 编译 Python 3.4?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have my own OpenSSL installation in a non-standard location (/my/path for the sake of this example) and I want Python 3.4 to build against that when I compile it against source. What I tried is this (directories abbreviated)

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

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

I also tried with C_INCLUDE_PATH and colon separated paths.

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

Then, I run make and get this:

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,但肯定是这样定义的:

It's looking for SSL_get0_next_proto_negotiated, but that's most certainly defined:

$ 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,

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

I'm not sure what I'm doing wrong, any ideas?

推荐答案

我费了好大劲才弄明白.这是一堆环境变量......我想我可能做得有点矫枉过正,但这基本上有效:

I managed to figure it out after a lot of hair-pulling. It was a bunch of environment variables... I think I might have done a little overkill, but this basically worked:

# 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

这篇关于如何使用自定义 OpenSSL 编译 Python 3.4?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆