Installing M2Crypto on CentOS
Asked Answered
B

6

10

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

Bury answered 7/12, 2010 at 18:26 Comment(1)
Why do you do it? m2crypto is packaged in RHEL 6. Which version of CentOS you have?Civil
W
11

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.

Wool answered 7/12, 2010 at 18:30 Comment(2)
/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'Bury
I learn't that I had to use this command to complete the installation ... Also I was running this command as any another user ... make sure when u are installing stuff from source .. u should be logged in as root .. Thanks a ton "abbot" for this commandBury
S
7

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.

Serow answered 27/9, 2011 at 15:15 Comment(2)
fedora_setup.py or fedora_setup.sh? The source I just downloaded (17-Sep-2012) has the .sh file, does not nave the .py file.Splenic
See if it says anything in INSTALL. Just follow the instructions in there.Serow
R
3

Install openssl-devel.

Renovate answered 7/12, 2010 at 18:30 Comment(8)
Let say you do: $> updatedb& $> locate openssl Can you locate the missing headers on your system?Woermer
i have never used updatedb. I tried it though, it gives me an error, updatedb: can not open a temporary file for `/var/lib/mlocate/mlocate.db' i have been using yum and rpm .. how can i find out the missing headers ?Bury
Actually i had openssl installed and devel was missing ... Thanks Ignacio ..this suggestion solved a part of my problemBury
Does anyone know the corresponding Ubuntu package?Manns
@JoeJ: I believe it's libssl-dev.Renovate
I have libssl-dev installed, but I'm still having problems.Antisepticize
@Antisepticize try this : DEB_HOST_MULTIARCH=x86_64-linux-gnu pip install "git+git://anonscm.debian.org/collab-maint/m2crypto.git@debian/0.21.1-3#egg=M2Crypto"Glengarry
THIS IS THE ANSWER!Matherly
H
0

Follow Brian's instruction, and make sure you have install openssl-devel. if you experience error like this:

./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

You are running i386 operating system on 64 bit hardware. arch =´uname -m´ will yields i686. The easiest way is to work around this is to create a symbolic link.

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

Or if you experience errors like:

./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)
...

Some headers are missing, just issue the following command and try again:

sudo yum install python-devel
Heliocentric answered 26/5, 2013 at 4:43 Comment(0)
G
0

I had this problem now (in 2018), I solved it by installing openssl-devel, gcc and make

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

Gallicize answered 14/3, 2018 at 12:33 Comment(0)
J
0

This worked for RHEL 8.7 and will all probably work CentOS 8

pip install swig wheel M2Crypto
yum -y install gcc gcc-c++ make openssl-devel python3-devel 
Journalistic answered 25/3, 2023 at 17:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.