8

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
./configure

The error I get is

Configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
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.

7
  • 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
    – mmmmmm
    Commented Nov 20, 2015 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? Commented Nov 20, 2015 at 21:48
  • @Saran it is not linked to clang - could you point to some documentation that says so
    – mmmmmm
    Commented Nov 20, 2015 at 21:52
  • Have you installed the command line tools?
    – mmmmmm
    Commented Nov 20, 2015 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. Commented Nov 20, 2015 at 21:55

4 Answers 4

9

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

export CC=clang
2

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.

1
  • 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:~$ Commented Nov 23, 2015 at 16:22
2

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.

0
1

After doing

xcode-select --install

run

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

This worked for me.

You must log in to answer this question.

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