How do I install M2Crypto on Ubuntu?
Asked Answered
G

3

21

I'm trying to build and install M2Crypto on Ubuntu 10.04 LTS. I downloaded and untarred M2Crypto-0.20.2.tar, and from the M2Crypto-0.20.2 directory I tried python setup.py build. I got an error because I don't have swig. So I ran sudo apt-get install swig. Then I tried python setup.py build again and got:

/usr/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/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
SWIG/_bio.i:64: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_rand.i:19: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_evp.i:156: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_dh.i:36: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_rsa.i:43: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_dsa.i:31: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_ssl.i:207: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_x509.i:313: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_pkcs7.i:42: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_pkcs7.i:42: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_util.i:9: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_ec.i:111: Warning(454): Setting a pointer/reference variable may leak memory.
SWIG/_engine.i:162: Warning(454): Setting a pointer/reference variable may leak memory.
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.6 -I/usr/include -I/home/dspitzer/M2Crypto-0.20.2/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-i686-2.6/SWIG/_m2crypto_wrap.o -DTHREADING
SWIG/_m2crypto_wrap.c:126:20: error: Python.h: No such file or directory
SWIG/_m2crypto_wrap.c:757: error: expected ‘)’ before ‘*’ token
SWIG/_m2crypto_wrap.c:781: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

...and so on.

Has anyone succeeded in doing this?

Update: I changed the title, since it didn't occur to me that M2Crypto would be a pre-build Ubuntu package.

Garthgartner answered 24/6, 2010 at 3:25 Comment(1)
That just didn't occur to me. It worked just like it should. If you put your comment in an answer I'll accept it.Garthgartner
B
30

You probably need to install the python development packages:

sudo apt-get install python-dev

Better yet, don't bother building m2crypto yourself. It's already in the Ubuntu repositories as a fully supported package. This way, you'll get automatic updates through the same means as the rest of your Ubuntu system:

sudo apt-get install python-m2crypto
Bussy answered 24/6, 2010 at 4:3 Comment(1)
Unfortunately, M2Crypto hasn't been ported to Python 3, yet :(Parquetry
E
3

do you have the python2.6-dev package installed? this is the package that contains the Python.h file you are missing

Earthbound answered 24/6, 2010 at 3:44 Comment(0)
C
2

Maybe someone will get openssl related errors, try this:

sudo apt-get install openssl
sudo apt-get install libssl-dev
Chlorpromazine answered 24/6, 2019 at 16:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.