Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何向SWIG提供包含路径?_Python_Openssl_Swig_Setup.py_M2crypto - Fatal编程技术网

Python 如何向SWIG提供包含路径?

Python 如何向SWIG提供包含路径?,python,openssl,swig,setup.py,m2crypto,Python,Openssl,Swig,Setup.py,M2crypto,我正在尝试构建M2Crypto库,但swig找不到头文件: M2Crypto@(master=)$ python setup.py build running build running build_py running build_ext building 'M2Crypto.__m2crypto' extension swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c swig -python -I/usr/include/python2.7

我正在尝试构建M2Crypto库,但
swig
找不到头文件:

M2Crypto@(master=)$ python setup.py build
running build
running build_py
running build_ext
building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -I/usr/include/python2.7 -I/usr/include -includeall -modern -builtin -outdir build/lib.linux-i686-2.7/M2Crypto -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
SWIG/_evp.i:12: Error: Unable to find 'openssl/opensslconf.h'
SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'
error: command 'swig' failed with exit status 1
我在
/usr/include/i386 linux gnu
中有OpenSSL头文件,包括
OpenSSL/opensslconf.h
——这就是
OpenSSL dev
包安装它们的地方。此路径未传递给swig
setup.py
似乎对此一无所知


这看起来像是软件包的bug(或问题),即M2Crypto吗?正确的修复方法是什么?

原因是libssl dev将opensslconf.h移动到依赖于体系结构的子树/usr/include/x86\u 64-linux-gnu中。根据您的体系结构,目录可能会有所不同

有两种可能的解决办法(其中一种可行):

选项1:将文件软链接到更改前的位置:

sudo ln -s /usr/include/x86_64-linux-gnu/openssl/opensslconf.h /usr/include/openssl/opensslconf.h
这在中也有描述

选项2:在M2Crypto的setup.py中,将特定于体系结构的目录添加到swig命令使用的include路径:

-I/usr/include/x86_64-linux-gnu
这在中也有描述

在M2Crypto项目中,也有针对这一点的开放

Andy

可能重复的