I already have xcode installed on OSX Yosemite. I have also run it and accepted terms and conditions.

I can also do gcc --version and I see

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.0 (clang-700.1.76)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

Now if I do

wget http://apache.mirrors.pair.com//httpd/httpd-2.4.17.tar.bz2
brew install pcre
tar zxvf httpd-2.4.17.tar.bz2
cd httpd-2.4.17

The error I get is

configure: Configuring Apache Portable Runtime Utility library...
checking for APR-util... yes
checking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.10.xctoolchain/usr/bin/cc
checking whether the C compiler works... no
configure: error: in `/Users/abhi/Downloads/httpd-2.4.17':
configure: error: C compiler cannot create executables
See `config.log' for more details

Why can't the C compiler create executable? I showed you that the C compiler is installed correctly on my machine.

  • For current OS X gcc is not the C compiler - you have not shown the C compiler is installed correctly - The C compiler is clang – Mark Nov 20 '15 at 21:45
  • 1
    @Mark but gcc is symlinked to clang by default, and in straightforward case the invocation is gcc-compatible. @KnowsNotMuch have you indeed See `config.log' for more details as the autoconf suggested? – Saran Nov 20 '15 at 21:48
  • @Saran it is not linked to clang - could you point to some documentation that says so – Mark Nov 20 '15 at 21:52
  • Have you installed the command line tools? – Mark Nov 20 '15 at 21:52
  • @Mike OK my bad it's not symlinked. However it does just run a copy of clang: here's my shell output oxygen:~ saran$ gcc clang: error: no input files. Also if I recall correctly, the command gcc wouldn't even run without the command line tools installed. – Saran Nov 20 '15 at 21:55

You need to convince configure that there are more c compilers than gcc. Try:

export CC=clang

Start Xcode, select 'Preferences', then 'Locations'. You'll notice a dropdown control at 'Command Line Tools'. Select the newest version, close the dialog window, then call brew again.


In general, having Xcode installed isn't enough to get some open source projects to compile.

The actual error you are seeing is probably listed in config.log since the test it makes is failing on OS X. It's hard to guess if that's because it doesn't like clang/llvm which is what your "gcc" binary actually is.

Some boilerplate things to try:

xcode-select --install

That should issue an error like "xcode-select: error: command line tools are already installed, use "Software Update" to install updates" when you have all the tools actually installed. If you don't have the tools and include files installed, you should get a prompt to install the tools and have to possibly type an admin user/password.

Next, you could dig into the actual specific error log or you could try getting a gcc compiler instead of using Apple's llvm.

brew install gcc

That would get a gnu gcc-5 installed in the /usr/local/bin path and if that's used over Apple's /usr/bin/gcc you might not have the build error in the first place.

  • I tried both your suggestions and this is what i got Last login: Sat Nov 21 22:58:10 on ttys000 MacBook-Pro:~$ xcode-select --install xcode-select: error: command line tools are already installed, use "Software Update" to install updates MacBook-Pro:~$ brew install gcc Warning: gcc-5.2.0 already installed MacBook-Pro:~$ – Knows Not Much Nov 23 '15 at 16:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .