xcode 运行配置命令时出现问题(检查 C 编译器是否工作......否)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12015226/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
issue when running configure command (checking whether the C compiler works... no)
提问by adit
I am trying to run the configure command however it generates the following error: I am running Mountain Lion OS X 10.8
我正在尝试运行配置命令,但它生成以下错误:我正在运行 Mountain Lion OS X 10.8
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking build system type... i386-apple-darwin12.0.0
checking host system type... i386-apple-darwin12.0.0
checking target system type... i386-apple-darwin12.0.0
checking whether the C compiler works... no
configure: error: in `/Users/aditya15417/php-5.4.6':
configure: error: C compiler cannot create executables
See `config.log' for more details.
any idea why this error? I've installed Xcode command line tools and I am running the configure command from Terminal.
知道为什么会出现这个错误吗?我已经安装了 Xcode 命令行工具,并且正在从终端运行配置命令。
I have XCode 4.4 and I am pretty sure gcc is already installed, because it gives me:
我有 XCode 4.4,我很确定已经安装了 gcc,因为它给了我:
686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I've tried doing:
我试过这样做:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
but it doesn't work as well. Here's the link to my config.logif needed. Seems that from the log it can't find gcc4.2
但它不起作用。如果需要,这是我的config.log的链接。似乎从日志中找不到 gcc4.2
configure:3524: checking for C compiler version
configure:3533: gcc-4.2 --version >&5
./configure: line 3535: gcc-4.2: command not found
configure:3544: $? = 127
configure:3533: gcc-4.2 -v >&5
./configure: line 3535: gcc-4.2: command not found
configure:3544: $? = 127
configure:3533: gcc-4.2 -V >&5
./configure: line 3535: gcc-4.2: command not found
configure:3544: $? = 127
configure:3533: gcc-4.2 -qversion >&5
./configure: line 3535: gcc-4.2: command not found
configure:3544: $? = 127
configure:3564: checking whether the C compiler works
configure:3586: gcc-4.2 conftest.c >&5
./configure: line 3588: gcc-4.2: command not found
configure:3590: $? = 127
configure:3628: result: no
How is this possible?
这怎么可能?
回答by xyberpix
I just edited .bash_profile, and commented out the CC= line, as I seem to think that it's left over from a previous MacPorts install.
我刚刚编辑了 .bash_profile,并注释掉了 CC= 行,因为我似乎认为它是从以前的 MacPorts 安装中遗留下来的。
回答by user2166489
I had the line: export CFLAGS="-arch ppc -arch x86_64 -g -O2 -m64" in my .profile file. After removing -arch ppc, I could successfully run ./configure.
我有一行: export CFLAGS="-arch ppc -arch x86_64 -g -O2 -m64" 在我的 .profile 文件中。删除 -arch ppc 后,我可以成功运行 ./configure。
回答by Chris Dodd
From your config.log file, its trying to use the compiler gcc-4.2
, which doesn't exist. You need to tell it to use a compiler that does exist, which is usually done by setting the environment variable CC
从您的 config.log 文件中,它试图使用gcc-4.2
不存在的 compiler 。您需要告诉它使用确实存在的编译器,这通常通过设置环境变量来完成CC