nginx/unit的配置脚本失败,因为无法编译如下所示的python扩展代码:
#include <Python.h>
int main() {
Py_Initialize();
return 0;
}我使用的是python3.10,它是用openssl-1.1.1编译的。编译给出了几个symbol not found错误,包括"OPENSSL_sk_num“。这个符号似乎在libcrypto中,我在编译命令中手动链接了它。
是否需要重新编译Python才能静态链接libpython.a中的libcrypto和libssl?下面是完整的编译命令。
cc -pipe -fPIC -fvisibility=hidden -O -W -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -fstrict-aliasing -Wstrict-overflow=5 -Wmissing-prototypes -Werror -g -I/home/shared/Builds/Python-3.1
0.0/include/python3.10 -I/home/shared/Builds/Python-3.10.0/include/python3.10 -o build/autotest build/autotest.c -L/home/shared/Builds/Python-3.10.0/lib/python3.10/config-3.10 -L/home/shared/Buil
ds/Python-3.10.0/lib -lcrypto -lssl -lpython3.10 -lpthread -lutil -lm -lm发布于 2021-11-24 04:06:44
幸运的是,我找到了解决方法。下面的作品--不知道为什么
cc -pipe -fPIC -fvisibility=hidden -O -W -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -fstrict-aliasing -Wstrict-overflow=5 -Wmissing-prototypes -Werror -g -I/home/shared/Builds/Python-3.10.0/include/python3.10 -I/home/shared/Builds/Python-3.10.0/include/python3.10 -o build/autotest build/autotest.c -L/home/shared/Builds/Python-3.10.0/lib/ -lpython3.10 -lpthread -lutil -lm -L/usr/local/lib/eopenssl11 -lssl -lcrypto -lpython3.10必须在-lssl之前,-lcrypto之前。
https://stackoverflow.com/questions/70081502
复制相似问题