为什么GCC在Snow Leopard中忽略ARCHFLAGS?
我正在尝试在一个基于依赖文件的 虚拟环境 中安装 AMFAST。我在本地的 .profile 文件中设置了 export ARCHFLAGS="-arch x86_64"
,并通过运行 env
命令确认它已经设置好。然而,每次我在虚拟环境中运行 PIP 时,gcc 总是设置为 i386 和 ppc。 我还尝试在 PIP 命令前加上 env ARCHFLAGS="-arch i386 -arch x86_64"
和 env ARCHFLAGS="-arch x86_64"
,但 gcc 总是带有 -arch i386 -arch ppc -arch x86_64
的标志。我该如何让 gcc 读取我的 archflags 呢?
示例:
sudo pip install -E ~/Documents/project/project_env -r ~/Documents/project/trunk/django/dependencies.txt`
输出
...
Running setup.py install for amfast
building 'amfast.encode' extension
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c amfast/ext_src/encoder.c -o build/temp.macosx-10.6-universal-2.6/amfast/ext_src/encoder.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
amfast/ext_src/encoder.c:2121: fatal error: error writing to -: Broken pipe
compilation terminated.
lipo: can't open input file: /var/tmp//ccoYlfhN.out (No such file or directory)
error: command 'gcc-4.2' failed with exit status 1
1 个回答
14
很可能问题出在 ARCHFLAGS
这个环境变量没有被 sudo
传递过去。默认情况下,一些版本的 sudo
会出于安全考虑过滤掉大部分环境变量(你可以查看 man sudo
来了解更多)。你可以试着这样运行:
sudo ARCHFLAGS="-arch x86_64" pip install -E ~/Documents/project/project_env -r ~/Documents/project/trunk/django/dependencies.txt`