首页 > 解决方案 > 使用 ssl 在 Freebsd 11 上安装 Python 3.7

问题描述

我正在尝试在具有 ssl 支持的 Freebsd 11.1 上安装 Python 3.7。

尝试 #1:由于未找到 libdl.so.1,预构建的二进制文件将无法运行

pkg install python37
...
root@s0001:~ # python3.7
Shared object "libdl.so.1" not found, required by "python3.7"

尝试 #2:我下载了 python 3.7 源代码并尝试使用默认值构建,但找不到 ssl 模块

./configure
make
...
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_gdbm                 _sqlite3              _ssl
_tkinter              spwd
To find the necessary bits, look in setup.py in detect_modules() for the module's name.

尝试#3:我注意到python tarball中有openssl 1.1.1的源代码,所以我尝试了--with-openssl,但得到了编译器错误:

./configure --with-openssl=openssl-1.1.1
make

openssl-1.1.1/include/openssl/bn.h:332:1: error: expected function body after function declarator

DEPRECATEDIN_0_9_8(int
^
openssl-1.1.1/include/openssl/bn.h:403:1: error: expected function body after function declarator
DEPRECATEDIN_0_9_8(int BN_get_params(int which)) /* 0, mul, 1 high, 2 low, 3
^
In file included from /root/Python-3.7.0/Modules/_hashopenssl.c:23:
In file included from openssl-1.1.1/include/openssl/evp.h:28:
In file included from openssl-1.1.1/include/openssl/objects.h:15:

似乎安装支持 ssl 的 Python(我认为使用 tarball 中的 openssl)应该很简单。这样做的正确方法是什么?

标签: pythonopensslfreebsd

解决方案


我有同样的问题,但我选择升级 FreeBSD 而不是重建 python。

FreeBSD 11.2 在此提交中添加了 libdl ,我们在11.2 源代码中看到了它,但在 11.1 源代码 (404)中没有。自 2018-09-30 起,11.1 已不受支持

因此,此包和可能的其他包在 11.1 上可能具有相同的症状(缺少 libdl),因为正在进行的包构建不再需要支持 11.1。


推荐阅读