Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing M2Crypto on CentOS

I am trying to install M2Crypto on CentOS by compiling from the source. i am doing a python setup.py build But I get the following error,

/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

Please advise ...

Prasanna

like image 229
Prasanna Avatar asked Dec 07 '10 18:12

Prasanna


3 Answers

The following should work:

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

Edit: and openssl-devel package is of course also required.

like image 178
abbot Avatar answered Oct 08 '22 09:10

abbot


I just had this problem. In M2Crypto's INSTALL file:

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.

My solution was to get the sources from PyPI or from the source. Then in the M2Crypto directory:

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

If you're using a virtualenv, change the path of the python interpreter in that file, or activate your environment before building.

The only dependency that I had that wasn't satisfied on my system was openssl-devel.

like image 23
Brian Hicks Avatar answered Oct 08 '22 11:10

Brian Hicks


Install openssl-devel.

like image 26
Ignacio Vazquez-Abrams Avatar answered Oct 08 '22 10:10

Ignacio Vazquez-Abrams