I am attempting to build the python package pycrypto. OS X has gcc-4.2 installed and not gcc-4.0, but python continues to attempt to use gcc-4.0. How can I get it to use gcc-4.2? Or should I go about this a different way.
I am getting the following error:
bash-3.2$
bash-3.2$ sudo python setup.py build
running build
running build_py
running build_ext
warning: GMP library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash.MD2' extension
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/MD2.c -o build/temp.macosx-10.3-fat-2.6/src/MD2.o
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
bash-3.2$
bash-3.2$
bash-3.2$
I am using Mac OS X 10.6.7 with python 2.6.6 and XCode is installed.
EDIT: If I add CC=gcc-4.2, then I still get the error:
bash-3.2$
bash-3.2$ export CC=gcc-4.2
bash-3.2$ python setup.py build
running build
running build_py
running build_ext
warning: GMP library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash.MD2' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -std=c99 -O3 -fomit-frame-pointer -arch i386 -arch x86_64 -Isrc/ -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/MD2.c -o build/temp.macosx-10.3-intel-2.6/src/MD2.o
gcc-4.0 -g -bundle -undefined dynamic_lookup -arch i386 -arch x86_64 build/temp.macosx-10.3-intel-2.6/src/MD2.o -o build/lib.macosx-10.3-intel-2.6/Crypto/Hash/MD2.so
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
bash-3.2$
EDIT: It seems that using sudo makes a difference here.
I tried using both CC and CXX as suggest by Adam, and I get the following error without sudo:
bash-3.2$ python setup.py build
running build
running build_py
creating build/lib.macosx-10.3-fat-2.6
creating build/lib.macosx-10.3-fat-2.6/Crypto
copying lib/Crypto/__init__.py -> build/lib.macosx-10.3-fat-2.6/Crypto
copying lib/Crypto/pct_warnings.py -> build/lib.macosx-10.3-fat-2.6/Crypto
...
warning: GMP library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash.MD2' extension
creating build/temp.macosx-10.3-fat-2.6
creating build/temp.macosx-10.3-fat-2.6/src
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/MD2.c -o build/temp.macosx-10.3-fat-2.6/src/MD2.o
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
lipo: can't open input file: /var/tmp//ccxan625.out (No such file or directory)
error: command 'gcc-4.2' failed with exit status 1
If I use sudo, I get the following error where it tries to use 4.0:
bash-3.2$ sudo python setup.py build
Password:
running build
running build_py
running build_ext
warning: GMP library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash.MD2' extension
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c src/MD2.c -o build/temp.macosx-10.3-fat-2.6/src/MD2.o
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1
bash-3.2$
bash-3.2$
Does this extra info make it more obvious what is going on and how to fix it? Any idea why the call without sudo is getting that other error?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…