One of my blogs needed Apache HTTPD 2.4.x on Mac but quickly realized that the binaries are available only for Netware and Win32. Even the build instructions were only for RPM-based systems. So I downloaded the source code and started building it.
Complete compile instructions are explained here. However there were some issues on Mavericks and so decided to document it.
Let’s go!
- Download the source bundle and unzip:
123tar xzvf ~/Downloads/httpd-2.4.10.tar.bz2 - Source code comes with INSTALL instructions and per that the following should’ve worked:
123456./configure --prefix=PREFIXmakemake installPREFIX/bin/apachectl start
So gave the command
123./configure --prefix=/usr/local/apache2
and got the first error:
12345678910111213141516171819202122232425262728httpd-2.4.10> <strong>./configure --prefix=/usr/local/apache2</strong>checking for chosen layout... Apachechecking for working mkdir -p... yeschecking for grep that handles long lines and -e... /usr/bin/grepchecking for egrep... /usr/bin/grep -Echecking build system type... x86_64-apple-darwin13.3.0checking host system type... x86_64-apple-darwin13.3.0checking target system type... x86_64-apple-darwin13.3.0configure:configure: Configuring Apache Portable Runtime library...configure:checking for APR... yessetting CC to "/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc"setting CPP to "/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.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... yeschecking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/ccchecking whether the C compiler works... noconfigure: error: in `/Users/arungupta/workspaces/httpd-2.4.10':configure: error: C compiler cannot create executablesSee `config.log' for more details - Moved past “checking whether the C compiler works… no” error by following instructions on stackoverflow #13587001.In short, do the following for Mavericks
123sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain - Issued the command to compile the server again and got the error as shown:
123456789101112131415161718192021222324252627282930313233343536httpd-2.4.10> <strong>./configure --prefix=/usr/local/apache2</strong>checking for chosen layout... Apachechecking for working mkdir -p... yeschecking for grep that handles long lines and -e... /usr/bin/grepchecking for egrep... /usr/bin/grep -Echecking build system type... x86_64-apple-darwin13.3.0checking host system type... x86_64-apple-darwin13.3.0checking target system type... x86_64-apple-darwin13.3.0configure:configure: Configuring Apache Portable Runtime library...configure:checking for APR... yessetting CC to "/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc"setting CPP to "/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.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... yeschecking for gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/ccchecking whether the C compiler works... yeschecking for C compiler default output file name... a.outchecking for suffix of executables...checking whether we are cross compiling... nochecking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc accepts -g... yeschecking for /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc option to accept ISO C89... none neededchecking how to run the C preprocessor... /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc -Echecking for /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc option to accept ISO C99... none neededchecking for pcre-config... falseconfigure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
This was resolved using stackoverflow #10663180. In short:- Download PCRE as:
123curl -O ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.33.zip - Compile and install as:
12345./configure --prefix=/usr/local/pcremakesudo make install
The compilation output is shown here.
- Download PCRE as:
- Compile HTTPD source again as:
123456789101112131415161718192021222324252627282930313233343536373839404142httpd-2.4.10> <strong>./configure --prefix=/usr/local/apache2 --with-pcre=/usr/local/pcre</strong>checking for chosen layout... Apachechecking for working mkdir -p... yeschecking for grep that handles long lines and -e... /usr/bin/grepchecking for egrep... /usr/bin/grep -Echecking build system type... x86_64-apple-darwin13.3.0checking host system type... x86_64-apple-darwin13.3.0checking target system type... x86_64-apple-darwin13.3.0configure:. . .creating server/Makefilecreating support/Makefilecreating test/Makefileconfig.status: creating docs/conf/httpd.confconfig.status: creating docs/conf/extra/httpd-autoindex.confconfig.status: creating docs/conf/extra/httpd-dav.confconfig.status: creating docs/conf/extra/httpd-default.confconfig.status: creating docs/conf/extra/httpd-info.confconfig.status: creating docs/conf/extra/httpd-languages.confconfig.status: creating docs/conf/extra/httpd-manual.confconfig.status: creating docs/conf/extra/httpd-mpm.confconfig.status: creating docs/conf/extra/httpd-multilang-errordoc.confconfig.status: creating docs/conf/extra/httpd-ssl.confconfig.status: creating docs/conf/extra/httpd-userdir.confconfig.status: creating docs/conf/extra/httpd-vhosts.confconfig.status: creating docs/conf/extra/proxy-html.confconfig.status: creating include/ap_config_layout.hconfig.status: creating support/apxsconfig.status: creating support/apachectlconfig.status: creating support/dbmmanageconfig.status: creating support/envvars-stdconfig.status: creating support/log_server_statusconfig.status: creating support/logresolve.plconfig.status: creating support/phf_abuse_log.cgiconfig.status: creating support/split-logfileconfig.status: creating build/rules.mkconfig.status: creating build/pkg/pkginfoconfig.status: creating build/config_vars.shconfig.status: creating include/ap_config_auto.hconfig.status: executing default commands
Complete output of this configuration is here.
- Now issue the command
make
:12345678910111213141516httpd-2.4.10> <strong>make</strong>Making all in srclibMaking all in osMaking all in unix/usr/share/apr-1/build-1/libtool --silent --mode=compile /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I. -I/Users/arungupta/workspaces/httpd-2.4.10/os/unix -I/Users/arungupta/workspaces/httpd-2.4.10/include -I/usr/include/apr-1 -I/usr/local/pcre/include -I/Users/arungupta/workspaces/httpd-2.4.10/modules/aaa -I/Users/arungupta/workspaces/httpd-2.4.10/modules/cache -I/Users/arungupta/workspaces/httpd-2.4.10/modules/core -I/Users/arungupta/workspaces/httpd-2.4.10/modules/database -I/Users/arungupta/workspaces/httpd-2.4.10/modules/filters -I/Users/arungupta/workspaces/httpd-2.4.10/modules/ldap -I/Users/arungupta/workspaces/httpd-2.4.10/modules/loggers -I/Users/arungupta/workspaces/httpd-2.4.10/modules/lua -I/Users/arungupta/workspaces/httpd-2.4.10/modules/proxy -I/Users/arungupta/workspaces/httpd-2.4.10/modules/session -I/Users/arungupta/workspaces/httpd-2.4.10/modules/ssl -I/Users/arungupta/workspaces/httpd-2.4.10/modules/test -I/Users/arungupta/workspaces/httpd-2.4.10/server -I/Users/arungupta/workspaces/httpd-2.4.10/modules/arch/unix -I/Users/arungupta/workspaces/httpd-2.4.10/modules/dav/main -I/Users/arungupta/workspaces/httpd-2.4.10/modules/generators -I/Users/arungupta/workspaces/httpd-2.4.10/modules/mappers -prefer-non-pic -static -c unixd.c && touch unixd.lo/usr/share/apr-1/build-1/libtool --silent --mode=link /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc -o libos.la -static unixd.loMaking all in serverMaking all in mpmMaking all in worker. . .warning: no debug symbols in executable (-arch x86_64)/usr/share/apr-1/build-1/libtool --silent --mode=compile /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I. -I/Users/arungupta/workspaces/httpd-2.4.10/os/unix -I/Users/arungupta/workspaces/httpd-2.4.10/include -I/usr/include/apr-1 -I/usr/local/pcre/include -I/Users/arungupta/workspaces/httpd-2.4.10/modules/aaa -I/Users/arungupta/workspaces/httpd-2.4.10/modules/cache -I/Users/arungupta/workspaces/httpd-2.4.10/modules/core -I/Users/arungupta/workspaces/httpd-2.4.10/modules/database -I/Users/arungupta/workspaces/httpd-2.4.10/modules/filters -I/Users/arungupta/workspaces/httpd-2.4.10/modules/ldap -I/Users/arungupta/workspaces/httpd-2.4.10/modules/loggers -I/Users/arungupta/workspaces/httpd-2.4.10/modules/lua -I/Users/arungupta/workspaces/httpd-2.4.10/modules/proxy -I/Users/arungupta/workspaces/httpd-2.4.10/modules/session -I/Users/arungupta/workspaces/httpd-2.4.10/modules/ssl -I/Users/arungupta/workspaces/httpd-2.4.10/modules/test -I/Users/arungupta/workspaces/httpd-2.4.10/server -I/Users/arungupta/workspaces/httpd-2.4.10/modules/arch/unix -I/Users/arungupta/workspaces/httpd-2.4.10/modules/dav/main -I/Users/arungupta/workspaces/httpd-2.4.10/modules/generators -I/Users/arungupta/workspaces/httpd-2.4.10/modules/mappers -prefer-pic -c mod_rewrite.c && touch mod_rewrite.slo/usr/share/apr-1/build-1/libtool --silent --mode=link /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain/usr/bin/cc -o mod_rewrite.la -rpath /usr/local/apache2/modules -module -avoid-version mod_rewrite.lowarning: no debug symbols in executable (-arch x86_64)Complete output of the command is shown here.
- Finally install Apache2 as:
12345678910111213141516171819httpd-2.4.10> <strong>sudo make install</strong>Password:Making install in srclibMaking install in osMaking install in unixMaking install in serverMaking install in mpmMaking install in workermkdir /usr/local/apache2mkdir /usr/local/apache2/modulesMaking install in modules. . .Installing man pages and online manualmkdir /usr/local/apache2/manmkdir /usr/local/apache2/man/man1mkdir /usr/local/apache2/man/man8mkdir /usr/local/apache2/manual
Complete output of this command is shown here.
Version for HTTPD can be checked as:
1
2
3
4
5
|
httpd-2.4.10> /usr/local/apache2/bin/httpd -v
Server version: Apache/2.4.10 (Unix)
Server built: Aug 22 2014 16:00:19
|
Server can be started as:
1
2
3
|
sudo /usr/local/apache2/bin/apachectl start
|
Stopped as:
1
2
3
|
sudo /usr/local/apache2/bin/apachectl stop
|
Restarted as:
1
2
3
|
sudo /usr/local/apache2/bin/apachectl restart
|
Enjoy!