Unable to build on MacOS Sierra (10.12.1)
Unfortunately, I'm unable to complete a build on MacOS Sierra either directly from source or via pip install mod_wsgi. The issue with build from source is not having apr-1-config available, as documented elsewhere.
What happens with pip install is:
Collecting mod_wsgi
Downloading mod_wsgi-4.5.9.tar.gz (1.8MB)
100% |████████████████████████████████| 1.8MB 739kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-build-LWqBU2/mod-wsgi/setup.py", line 284, in <module>
APR_INCLUDES = get_apr_includes().split()
File "/private/tmp/pip-build-LWqBU2/mod-wsgi/setup.py", line 245, in get_apr_includes
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-LWqBU2/mod-wsgi/
You are using pip version 8.1.2, however version 9.0.1 is available.
I've looked at the source change to Setup.py documented as the workaround for the lack of apr-1-config in Setup.py. From the comments and the code, the change manually sets values on where to find an include dir and apr-1. However, those paths do not exist in my environment for either the machine I upgraded to Sierra or the new MBP that has only had Sierra installed. Do the referenced files in Setup.py come from a different pip package? If so, can you tell me what it is?
Have you installed the Xcode command line developer tools by running:
xcode-select --install
You need to have done that.
Yes, I've done that...
What do you have under the directory:
- /Developer/SDKs
MacBook-Pro:Preferences eric$ ls /Developer
ls: /Developer: No such file or directory
MacBook-Pro:Preferences eric$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
MacBook-Pro:Preferences eric$
My assumption that they are part of that may be wrong then. Do you have the full Xcode installed?
Apparently it wasn't completely installed after the migration. I just opened up the main application, and got a message that not all components were installed. Unfortunately, after the installation completed, I still have no /Developer directory. Xcode version 8.1.
Looks like I have it due to an ongoing series of upgrades rather than fresh OS install. The SDK seems to be quite old so may not even match what latest versions of libraries are, thus may be dangerous to use as APIs may not match, although did seem to run. Looks like Apple has really screwed up things really bad.
Only suggestion right this minute is to use HomeBrew and install httpd using it. Does mean that you can't use the system Apache version.
I suppose I could do that, but I think it will end up creating more work down the road. In my extremely limited understanding of apr-1-util, its intent is to collect environment-specific parameters for other parts of the build process. I'm curious whether I can find a way to work around the missing apr. apxs is available...
It is more than just that being missing. All the header files for Apache httpd and the Apache runtime libraries are missing. This makes it impossible to actually compile Apache modules on the system.
Can you try doing the following and see if you can find these files anywhere on the system:
find / -name httpd.h
find / -name apr.h
Sorry, I know it is going through your whole system. May take some time and tax your box for a bit. Spotlight usually can't find this stuff unless you know how to have it look in system directories.
find is running now, but I get on a plane soon, so I may go dark for 6-8 hours.
Do you have:
- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/MacOSX.sdk
Yes.
Try changing setup.py such that instead of:
/Developer/SDKs/MacOSX10.6.sdk
uses:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/MacOSX.sdk
Have edited the setup file, assume to invoke it I need to do so with pip install -e
Use:
python3 setup.py install
OK, that completed without error, which is certainly progress. The last time I build mod_wsgi I used the build from source instructions, not pip-install. So I'll need to figure out the apache configuration now that this form of the build is complete. Thanks for the help!
Run:
mod_wsgi-express module-config
It will output what to add to main Apache configuration file so module is loaded.
See Connecting into Apache installation in:
- https://pypi.python.org/pypi/mod_wsgi
Can't use install-module on MacOS X as can't write to Apache modules directory due to SIP.
Got changes up now so that:
pip install -U https://github.com/GrahamDumpleton/mod_wsgi/archive/develop.zip
should work so can install from repo until released.
My wifi application is now functional using the MacOS embedded Apache installation, thank you very much for your help!