我正在尝试交叉编译pycrypto包,并且越来越接近了,然而,我遇到了一个我无法解决的问题。
我想让distutils使用交叉编译的特定gcc-所以我设置了CC env var,它似乎尊重第一次调用编译器的设置,但仅此而已。
export CC="/opt/teeos/buildroot/output/host/usr/bin/i586-linux-gcc"
/opt/teeos/buildroot/output/host/usr/bin/i586-linux-gcc -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 --sysroot=/opt/teeos/buildroot/output/staging -I/opt/teeos/buildroot/output/staging/usr/include/python2.7 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/_fastmath.c -o build/temp.linux-i686-2.7/src/_fastmath.o
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions build/temp.linux-i686-2.7/src/_fastmath.o -lgmp -o build/lib.linux-i686-2.7/Crypto/PublicKey/_fastmath.so
unable to execute gcc: No such file or directory我暂时移动了我的系统,所以它找不到了,gcc。
如何让distutils在每次调用编译器时都遵守CC=/opt/buildroot...选项/设置我希望distutils使用的GCC / LD的路径?
发布于 2011-05-13 10:33:50
这听起来和我最近给customizing the distutils compiler的另一个答案很相似。您还需要定义LDSHARED,这是用于生成最终共享对象的命令。看看这是否起作用:
>>> from distutils import sysconfig
>>> sysconfig.get_config_var('LDSHARED')
'gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions'
>>> sysconfig.get_config_var('CC')
'gcc -pthread'然后将gcc替换为所需的编译器以及CC和LDSHARED环境变量中的选项:
% LDSHARED="i586-linux-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions" \
CC="i586-linux-gcc -pthread" python setup.py buildhttps://stackoverflow.com/questions/5986256
复制相似问题