adit
adit

Reputation: 33674

issue when running configure command (checking whether the C compiler works... no)

I am trying to run the configure command however it generates the following error: I am running 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.

I have XCode 4.4 and I am pretty sure gcc is already installed, because it gives me:

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.log if needed. Seems that from the log it can't find 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?

Upvotes: 3

Views: 8453

Answers (3)

user2166489
user2166489

Reputation: 1

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.

Upvotes: 0

xyberpix
xyberpix

Reputation: 21

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.

Upvotes: 2

Chris Dodd
Chris Dodd

Reputation: 126536

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

Upvotes: 0

Related Questions