I've updated to OS X Mountain Lion. Update has removed all of my python and apache modules including mod_wsgi.

Now I'm trying to recompile mod_wsgi (it compiled without problems on Lion).

I use source code from here: http://code.google.com/p/modwsgi/wiki/DownloadTheSoftware?tm=2

./configure creates Makefile without problems:

$ ./configure
checking for apxs2... no
checking for apxs... /usr/sbin/apxs
checking Apache version... 2.2.22
checking for python... /usr/bin/python
configure: creating ./config.status
config.status: creating Makefile

But make returns error:

$ make
/usr/sbin/apxs -c -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DENABLE_DTRACE -DMACOSX -DNDEBUG -DNDEBUG -DENABLE_DTRACE  -Wc,'-arch x86_64' mod_wsgi.c -Wl,-F/System/Library/Frameworks -framework Python -u _PyMac_Error /System/Library/Frameworks/  -arch x86_64 -ldl  -framework CoreFoundation  
/usr/share/apr-1/build-1/libtool --silent --mode=compile /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc    -DDARWIN -DSIGPROCMASK_SETS_THREAD_MASK -I/usr/local/include -I/usr/include/apache2  -I/usr/include/apr-1   -I/usr/include/apr-1  -arch x86_64 -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DENABLE_DTRACE -DMACOSX -DNDEBUG -DNDEBUG -DENABLE_DTRACE  -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
env: /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc: No such file or directory
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1
up vote 32 down vote accepted

I solved this problem while writting question:

For some reason /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/ folder (containing Xcode Command Line Tools) is here: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain

To fix the problem:

$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain

Greg Bair suggestion for Mavericks:

$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain

This creates symlink to the right folder.

  • 4
    Should be highlighted that this is an issue with apxs build configuration that Apple supplied as far as I know and nothing to do with mod_wsgi. It came up prior to Mountain Lion being released and someone provided feedback to Apple somehow, but Apple didn't fix it. It is likely that this issue would affect any attempt to build Apache modules using apxs and not just mod_wsgi. – Graham Dumpleton Jul 29 '12 at 23:50
  • Problem I submited seems to be make utilit related. For some reason it thinks that compiler (gcc) is situated in other folder. It is simply fixable by creating symlink (see my answer for details). sudo make install after that also works. – Daniil Ryzhkov Jul 30 '12 at 3:07
  • Presuming same file location as older MacOS X, the issue is going to be in definitions in /usr/share/httpd/build/config_vars.mk which apxs uses. – Graham Dumpleton Jul 30 '12 at 3:22
  • As @GrahamDumpleton suggests, this solution also fixes make problems with mod_fastcgi v2.4.6. – Graham Miln Oct 9 '12 at 13:05
  • 3
    Note that this also works for Mavericks, but it would be $ sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.9.xctoolchain – Greg Bair Oct 26 '13 at 14:29

Ran into the same problem, however creating the symlink did not solve it for me. What did work was adding the flag --disable-framework to the ./configure command. See the gist for more details.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.