Problems with compiling apache2 on Mac OS X Mountain Lion
apache, macos
Solution
I was just struggling with a similar issue in this post I created and answered so I thought I would share my findings. Simply create the symlink by doing this:
# Create a symlink to default Xcode toolchain for OS X lion
sudo ln -s \
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain \
/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain
# Create a symlink to default Xcode toolchain for OS X maverick
sudo ln -s \
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain \
/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain
and you should at least get to the next step.
Problem
While trying to compile the latest version of the apache web server(2.4.3) on my Mac (10.8) I run into a problem. When I run the ./configure command I got the following output: ``` checking for chosen layout... Apache checking for working mkdir -p... yes checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking build system type... x86_64-apple-darwin12.0.0 checking host system type... x86_64-apple-darwin12.0.0 checking target system type... x86_64-apple-darwin12.0.0 configure: configure: Configuring Apache Portable Runtime library... configure: checking for APR... yes setting CC to "/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc" setting CPP to "/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -E" setting CFLAGS to " " setting CPPFLAGS to " -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK" setting LDFLAGS to " " configure: configure: Configuring Apache Portable Runtime Utility library... configure: checking for APR-util... yes checking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc checking whether the C compiler works... no configure: error: in `/Users/cti/Downloads/Applications/httpd-2.4.3': configure: error: C compiler cannot create executables See `config.log' for more details ``` Here are the last few lines in the log file: ``` ## ----------- ## ## Core tests. ## ## ----------- ## configure:3056: checking for chosen layout configure:3058: result: Apache configure:3861: checking for working mkdir -p configure:3877: result: yes configure:3886: checking for grep that handles long lines and -e configure:3944: result: /usr/bin/grep configure:3949: checking for egrep configure:4011: result: /usr/bin/grep -E configure:4027: checking build system type configure:4041: result: x86_64-apple-darwin12.0.0 configure:4061: checking host system type configure:4074: result: x86_64-apple-darwin12.0.0 configure:4094: checking target system type configure:4107: result: x86_64-apple-darwin12.0.0 configure:4137: configure:4139: Configuring Apache Portable Runtime library... configure:4141: configure:4182: checking for APR configure:4327: result: yes configure:4587: configure:4589: Configuring Apache Portable Runtime Utility library... configure:4591: configure:4628: checking for APR-util configure:4707: result: yes configure:4968: checking for gcc configure:4995: result: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc configure:5224: checking for C compiler version configure:5233: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc --version >&5 ./configure: line 5235: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc: No such file or directory configure:5244: $? = 127 configure:5233: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -v >&5 ./configure: line 5235: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc: No such file or directory configure:5244: $? = 127 configure:5233: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -V >&5 ./configure: line 5235: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc: No such file or directory configure:5244: $? = 127 configure:5233: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -qversion >&5 ./configure: line 5235: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc: No such file or directory configure:5244: $? = 127 configure:5264: checking whether the C compiler works configure:5286: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK conftest.c >&5 ./configure: line 5288: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc: No such file or directory configure:5290: $? = 127 configure:5328: result: no configure: failed program was: | /* confdefs.h */ | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" | #define PACKAGE_URL "" | /* end confdefs.h. */ | | int | main () | { | | ; | return 0; | } configure:5333: error: in `/Users/cti/Downloads/Applications/httpd-2.4.3': configure:5335: error: C compiler cannot create executables See `config.log' for more details ``` As you can see in the log output the script in ./configure couldn't find the path to my C compiler because it's in `/Applications/Xcode.app/Contents/Developer/usr/bin/cc` and not in `/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc`as it's stated in the log output You may say that the solution is simple all I have to do is to modify the configure script, right?? well the problem with that is that I know nothing about shell script which is why I've been struggling with it for the last 3 hours. Help please. Thanks in advance.