Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xcode 运行configure命令时出现问题(检查C编译器是否工作…否)_Xcode_Macos_Unix_Gcc_Osx Lion - Fatal编程技术网

Xcode 运行configure命令时出现问题(检查C编译器是否工作…否)

Xcode 运行configure命令时出现问题(检查C编译器是否工作…否),xcode,macos,unix,gcc,osx-lion,Xcode,Macos,Unix,Gcc,Osx Lion,我正在尝试运行configure命令,但它会生成以下错误: 我正在运行山狮OSX10.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-

我正在尝试运行configure命令,但它会生成以下错误: 我正在运行山狮OSX10.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.
知道为什么会有这样的错误吗?我已经安装了Xcode命令行工具,并且正在从终端运行configure命令

我已经安装了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.
我试过做:

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
但它不起作用。如果需要的话,这里有我的链接。似乎从日志中找不到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

这怎么可能呢?

从config.log文件中,它试图使用不存在的编译器
gcc-4.2
。您需要告诉它使用一个确实存在的编译器,这通常是通过设置环境变量
CC

完成的,我刚刚编辑了.bash_配置文件,并注释掉了CC=行,因为我似乎认为它是以前安装MacPorts时留下的。

我有一行:export CFLAGS=“-arch-ppc-arch x86\u 64-g-O2-m64”在我的.profile文件中。删除-arch-ppc后,我可以成功运行./configure。

建议您可能需要选择其他gcc版本。