Wednesday, January 14, 2015

Compiling mod_jk on Mac OS X 10.10 (Yosemite)

First, check that you have the most recent version of XCode and the command line tools.
Second, solve the "configure: error: C compiler cannot create executables" problem.
As Adrian Rodriguez says here :
"Some packages like mod_jk use /usr/sbin/apxs -q CC in configure to ask for the C compiler. APXS spits it out, but it has the wrong path so that's why you keep getting errors."

Solution, make a symlink:

cd /Applications/Xcode.app/Contents/Developer/Toolchains
sudo ln -s XcodeDefault.xctoolchain OSX10.10.xctoolchain


After that, download the last version of connectors Source Release tar.gz from here, expand it and go to the native folder.


cd /tmp

wget http://ftp.unicamp.br/pub/apache/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.40-src.tar.gz
tar xvf tomcat-connectors-1.2.40-src.tar.gz
cd tomcat-connectors-1.2.40-src/native

./configure --with-apxs=/usr/sbin/apxs
make


The BUILDING.txt file, has details and must be read:

"The resulting module file mod_jk.so of mod_jk will be
located in the directory apache-2.0 (for any version
of Apache 2.x) respectively apache-1.3 (for Apache 1.3).

Simply copy the file to your web server modules or libexec
directory.
"

Result of compiling can be found on native/apache-2.0, to install:


sudo cp apache-2.0/mod_jk.so /usr/libexec/apache2/

# Clean the work area
cd /tmp
rm -r rm -r tomcat-connectors-1.2.40-src
rm tomcat-connectors-1.2.40-src.tar.gz



5 comments:

  1. Thanks for this awesome instruction!

    I had an issue:
    configure: error: cannot run C compiled programs

    In case you guys might have the same problem... this solved mine ;)

    http://blog.42la.bs/configure-error-cannot-run-c-compiled-programs/

    ReplyDelete
  2. For El Capitan, you need to execute 2 'ln -s'. The 2nd is to solve 'make' error, which is [./jk_global.h:78:10: fatal error: 'apr_lib.h' file not found
    #include "apr_lib.h"]. So you need to run the 2nd ln -s before doing 'make':

    1) cd /Applications/Xcode.app/Contents/Developer/Toolchains
    sudo ln -s XcodeDefault.xctoolchain OSX10.10.xctoolchain

    2) cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
    sudo ln -s MacOSX10.11.sdk MacOSX10.11.Internal.sdk

    ReplyDelete