How to set CFLAGS and LDFLAGS to compile pycrypto

qrtt1 picture qrtt1 · Mar 24, 2012 · Viewed 20k times · Source

I am trying to install the fabric library to an old machine. There are some legacy libraries in /usr/lib, such as libgmp.

(py27)[qrtt1@hcservice app]$ ls /usr/lib|grep gmp
libgmp.a
libgmp.so
libgmp.so.3
libgmp.so.3.3.3
libgmpxx.a
libgmpxx.so
libgmpxx.so.3
libgmpxx.so.3.0.5

I have compiled the libgmp 5.x in my $HOME/app, and then am trying to install pycrypto (it is the dependency of fab):

CFLGAS=-I/home/qrtt1/app/include LDFLGAS=-L/home/qrtt1/app/lib  pip install pycrypto

I observed that none of my include or lib directories are in the in the compilation / linking options:

gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/ -I/home/qrtt1/app/include/python2.7 -c src/_fastmath.c -o build/temp.linux-i686-2.7/src/_fastmath.o
gcc -pthread -shared build/temp.linux-i686-2.7/src/_fastmath.o -lgmp -o build/lib.linux-i686-2.7/Crypto/PublicKey/_fastmath.so
building 'Crypto.Hash._MD2' extension
gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/home/qrtt1/app/include/python2.7 -c src/MD2.c -o build/temp.linux-i686-2.7/src/MD2.o
gcc -pthread -shared build/temp.linux-i686-2.7/src/MD2.o -o build/lib.linux-i686-2.7/Crypto/Hash/_MD2.so
building 'Crypto.Hash._MD4' extension
gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/home/qrtt1/app/include/python2.7 -c src/MD4.c -o build/temp.linux-i686-2.7/src/MD4.o
gcc -pthread -shared build/temp.linux-i686-2.7/src/MD4.o -o build/lib.linux-i686-2.

How do I assign the CFLAGS and LDFLAGS correctly for building pycrypto ?


I try to download pycrypto-2.5 and install it:

(py27)[qrtt1@hcservice pycrypto-2.5]$ CFLGAS=-I/home/qrtt1/app/include LDFLGAS=-L/home/qrtt1/app/lib python setup.py install

No CFLAGS or LDFLAGS set up with it. May be the pycrypto-2.5 going wrong ?

Answer

Phyo Arkar Lwin picture Phyo Arkar Lwin · Nov 2, 2012

Please check what you have typed :

CFLAGS=-I/home/qrtt1/app/include LDFLAGS=-L/home/qrtt1/app/lib  pip install pycrypto

it should be CFLAGS