10

我正在尝试通过从源代码编译在 CentOS 上安装 M2Crypto。我正在做一个 python setup.py build 但我收到以下错误,

/usr/local/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'test_suite'
  warnings.warn(msg)
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/local/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
SWIG/_m2crypto.i:28: Error: Unable to find 'openssl/opensslv.h'
SWIG/_evp.i:9: 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

请指教 ...

普拉萨纳

4

5 回答 5

11

以下应该有效:

env SWIG_FEATURES="-cpperraswarn -includeall -D__`uname -m`__ -I/usr/include/openssl" python setup.py build

编辑:openssl-devel当然也需要包。

于 2010-12-07T18:30:46.703 回答
7

我刚遇到这个问题。在 M2Crypto 的安装文件中:

Note about Fedora Core -based Distributions
----------------------------------------------------

Fedora Core (and RedHat, CentOS etc.) have made changes to OpenSSL
configuration compared to many other Linux distributions. If you can not
build M2Crypto normally, try the fedora_setup.sh script included with
M2Crypto sources.

我的解决方案是从 PyPI或source 获取源代码。然后在 M2Crypto 目录中:

$ chmod +x fedora_setup.py
$ ./fedora_setup.py install

如果您使用的是 virtualenv,请更改该文件中 python 解释器的路径,或在构建之前激活您的环境。

我的系统唯一不满意的依赖是openssl-devel.

于 2011-09-27T15:15:28.490 回答
3

安装openssl-devel.

于 2010-12-07T18:30:37.077 回答
0

按照布赖恩的指示,并确保你有 install openssl-devel。如果您遇到这样的错误:

./fedora_setup.sh 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.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
SWIG/_evp.i:12: Error: Unable to find 'openssl/opensslconf-i686.h'
SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf-i686.h'
error: command 'swig' failed with exit status 1

您在 64 位硬件上运行 i386 操作系统。arch =´uname -m´将产生i686。解决此问题的最简单方法是创建符号链接。

sudo ln -s /usr/include/openssl/opensslconf-i386.h /usr/include/openssl/opensslconf-i686.h

或者,如果您遇到以下错误:

./fedora_setup.sh build
running build
running build_py
running build_ext
SWIG/_m2crypto_wrap.c:27555: error: ‘Swig_var__evp_err_set’ undeclared (first use in this function)
SWIG/_m2crypto_wrap.c:27564: error: ‘Swig_var__dh_err_get’ undeclared (first use in this function)
SWIG/_m2crypto_wrap.c:27564: error: ‘Swig_var__dh_err_set’ undeclared (first use in this function)
SWIG/_m2crypto_wrap.c:27576: error: ‘Swig_var__rsa_err_get’ undeclared (first use in this function)
...

缺少某些标头,只需发出以下命令并重试:

sudo yum install python-devel
于 2013-05-26T04:43:21.513 回答
0

我现在(2018 年)遇到了这个问题,我通过安装解决了这个问题openssl-develgcc并且make

yum install gcc gcc-c++ make openssl-devel

于 2018-03-14T12:33:05.510 回答