mod_wsgi icon indicating copy to clipboard operation
mod_wsgi copied to clipboard

Unable to build on MacOS Sierra (10.12.1)

Open ewittle opened this issue 9 years ago • 19 comments

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?

ewittle avatar Dec 09 '16 16:12 ewittle

Have you installed the Xcode command line developer tools by running:

xcode-select --install

You need to have done that.

GrahamDumpleton avatar Dec 09 '16 19:12 GrahamDumpleton

Yes, I've done that...

ewittle avatar Dec 09 '16 20:12 ewittle

What do you have under the directory:

  • /Developer/SDKs

GrahamDumpleton avatar Dec 09 '16 20:12 GrahamDumpleton

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$ 

ewittle avatar Dec 09 '16 20:12 ewittle

My assumption that they are part of that may be wrong then. Do you have the full Xcode installed?

GrahamDumpleton avatar Dec 09 '16 20:12 GrahamDumpleton

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.

ewittle avatar Dec 09 '16 20:12 ewittle

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.

GrahamDumpleton avatar Dec 09 '16 20:12 GrahamDumpleton

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

ewittle avatar Dec 09 '16 20:12 ewittle

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.

GrahamDumpleton avatar Dec 09 '16 20:12 GrahamDumpleton

find is running now, but I get on a plane soon, so I may go dark for 6-8 hours.

ewittle avatar Dec 09 '16 20:12 ewittle

Do you have:

  • /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift-migrator/sdks/MacOSX.sdk

GrahamDumpleton avatar Dec 09 '16 20:12 GrahamDumpleton

Yes.

ewittle avatar Dec 09 '16 20:12 ewittle

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

GrahamDumpleton avatar Dec 09 '16 20:12 GrahamDumpleton

Have edited the setup file, assume to invoke it I need to do so with pip install -e . Not sure how to specify the python version if I build it that way, have been doing some googling in the last 5 minutes for an answer, but haven't found one. If you can give me the quick build instructions after I've edited the file; the python version I want to build for is /usr/local/bin/python3

ewittle avatar Dec 09 '16 21:12 ewittle

Use:

python3 setup.py install

GrahamDumpleton avatar Dec 09 '16 21:12 GrahamDumpleton

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!

ewittle avatar Dec 09 '16 21:12 ewittle

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.

GrahamDumpleton avatar Dec 09 '16 21:12 GrahamDumpleton

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.

GrahamDumpleton avatar Dec 10 '16 00:12 GrahamDumpleton

My wifi application is now functional using the MacOS embedded Apache installation, thank you very much for your help!

ewittle avatar Dec 10 '16 12:12 ewittle