为什么GCC忽视雪豹中的ARCHFLAGS? [英] Why is GCC ignoring ARCHFLAGS in Snow Leopard?

查看:157
本文介绍了为什么GCC忽视雪豹中的ARCHFLAGS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在 AMFAST =http://pypi.python.org/pypi/virtualenv =noreferrer> virtual_env 位置的依赖关系文件。在我的本地.profile文件中有 export ARCHFLAGS = - arch x86_64,并通过运行 env 并看到它上市。但是,每当我运行PIP以虚拟环境为目标时,gcc被设置为目标i386和ppc。我也尝试过预先添加 env ARCHFLAGS = - arch i386 -arch x86_64 env ARCHFLAGS = - arch x86_64到PIP命令,但gcc总是有标志 -arch i386 -arch ppc -arch x86_64



例子:

  sudo pip install -E〜/ Documents / project / project_env -r〜/ Documents / project / trunk / django / dependencies.txt` 

输出

...

 为amfast运行setup.py install 
构建'amfast.encode'扩展
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict- prototype -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:汇编器(/usr/bin/../libexec / gcc / darwin / ppc / as或/usr/bin/../local/libexec/gcc/darwin/ppc/as)架构ppc未安装
安装的汇编程序为:
/ usr / bin /../libexec/gcc/darwin/x86_64/as架构师e x86_64
/usr/bin/../libexec/gcc/darwin/i386/as体系结构i386
amfast / ext_src / encoder.c:2121:致命错误:错误写入 - :损坏的管道
编译终止。
lipo:无法打开输入文件:/var/tmp//ccoYlfhN.out(没有这样的文件或目录)
错误:命令'gcc-4.2'失败,退出状态1


解决方案

很可能问题在于 ARCHFLAGS 环境变量未被 sudo 传递。默认情况下, sudo 的某些版本会将大多数env变量过滤为安全措施(请参阅 man sudo )。试试这样运行:
$ b $ pre $ sudo ARCHFLAGS = - arch x86_64pip install -E〜/ Documents / project / project_env - r〜/ Documents / project / trunk / django / dependencies.txt`


I'm trying to install AMFAST in a virtual_env location based on a dependencies file. I have export ARCHFLAGS="-arch x86_64" in my local .profile, and have confirmed its presence by running env and seeing it listed. However, whenever I run PIP targeting the virtual environment, gcc is set to target i386 and ppc. I've also tried prepending env ARCHFLAGS="-arch i386 -arch x86_64" and env ARCHFLAGS="-arch x86_64" to the PIP command, but gcc always has the flags -arch i386 -arch ppc -arch x86_64. How can I get gcc to read my archflags?

example:

sudo pip install -E ~/Documents/project/project_env -r ~/Documents/project/trunk/django/dependencies.txt`  

output
...

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

解决方案

Most likely the problem is that the ARCHFLAGS environment variable is not being passed through by sudo. By default, some versions of sudo filter out most env variables as a security measure (see man sudo). Try running it this way:

sudo ARCHFLAGS="-arch x86_64" pip install -E ~/Documents/project/project_env -r ~/Documents/project/trunk/django/dependencies.txt`

这篇关于为什么GCC忽视雪豹中的ARCHFLAGS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆