Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problems with compiling apache2 on Mac OS X Mountain Lion

Tags:

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

like image 881
Codejunky Avatar asked Nov 27 '12 15:11

Codejunky


People also ask

Is Mountain Lion compatible with my Mac?

System Requirements To install Mountain Lion, you need one of these Macs: iMac (Mid 2007-2020) MacBook (Late 2008 Aluminum, or Early 2009 or newer) MacBook Pro (Mid/Late 2007 or newer)

Where is Apache on macOS?

By default, Apache is enabled and installed in /etc/apache2/ , inside httpd. conf file, find DocumentRoot to tell where is the default localhost folder.

Is Apache preinstalled on Mac?

Apache and php comes pre installed in mac OS Big Sur, You will just need to activate them using terminal. To start apache type the following command in the terminal and run. You need to write “sudo” before the actual command.


4 Answers

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.

like image 186
Adrian Rodriguez Avatar answered Oct 01 '22 01:10

Adrian Rodriguez


For OSX 10.9 Mavericks Apache is already installed, you can directly go to the terminal and type in the following commands

To Find the Apache Version

httpd -v

To start :

sudo apachectl start 

To stop :

sudo apachectl stop

To restart :

sudo apachectl restart
like image 29
user3097424 Avatar answered Sep 30 '22 01:09

user3097424


I'm on OSX Mavericks and was trying to compile Apache 2.2.24 and ran into this error. I saw from other answers that the problem was with apxr and thus APR returning the wrong location for gcc. Apple supplies this and the Apache config was using the Apple supplied one.

On a whim, I looked and saw that the configure script has an option to ignore the system supplied APRs and use its own.

So I did this:

./configure --with-included-apr

And it got past the configure step and compiled without errors.

like image 9
Michael Helmke Avatar answered Sep 29 '22 01:09

Michael Helmke


checking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc accepts -g... yes
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc option to accept ISO C89... none needed
checking how to run the C preprocessor... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc -E
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc option to accept ISO C99... none needed
checking for pcre-config... false

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

====

I've downloaded the pcre-config, ran: ./configure;make;make install

and now..... Tcharammmm! Httpd apache full installed :D

like image 2
0x69676f72 Avatar answered Oct 03 '22 01:10

0x69676f72