Updating mod_wsgi using Xcode.app

1,167 views
Skip to first unread message

Gnarlodious

unread,
Jun 23, 2012, 9:21:38 AM6/23/12
to mod...@googlegroups.com
I see that in the next greatest OSX Server mod_wsgi is built-in! Woohoo, good work! The module is located at:
/Applications/Server.app/Contents/ServerRoot/usr/libexec/apache2/mod_wsgi.so

Unfortunately it comes precompiled for the older Python which works well out of the box except that my webapp uses Py3 with daemon mode so the default webapp setup doesn't work. Trying to build my own I see the Make file doesn't work because they gave up on the gcc compiler formerly found in:
/Developer/.
Rumor has it they have embraced a newfangled Clang compiler located somewhere in 
/Applications/Xcode.app/Contents/Developer/
but exactly what is the compiler file? A little confused by all this. Has a Makefile script been made available for this version of OSX?

-- Gnarlie

Graham Dumpleton

unread,
Jun 23, 2012, 9:00:45 PM6/23/12
to mod...@googlegroups.com
On 23 June 2012 23:21, Gnarlodious <gnarl...@gmail.com> wrote:
> I see that in the next greatest OSX Server mod_wsgi is built-in! Woohoo,
> good work! The module is located at:
> /Applications/Server.app/Contents/ServerRoot/usr/libexec/apache2/mod_wsgi.so

First I knew of this.

> Unfortunately it comes precompiled for the older Python which works well out
> of the box except that my webapp uses Py3 with daemon mode so the default
> webapp setup doesn't work. Trying to build my own I see the Make file
> doesn't work because they gave up on the gcc compiler formerly found in:
> /Developer/.
> Rumor has it they have embraced a newfangled Clang compiler located
> somewhere in
> /Applications/Xcode.app/Contents/Developer/
> but exactly what is the compiler file? A little confused by all this. Has a
> Makefile script been made available for this version of OSX?

If you are building from source code, what compiler is used is
dictated by the apxs configuration of Apache. Further options to be
used at compile time are dictated by apxs and also Python
installation. So long as their Apache installation has developer
header files and apxs setup properly to use the new compiler then all
should be fine. If they haven't done that and Apache is still setup to
try and use gcc when compiling Apache modules then that is a mistake
on their part.

What do you get when you run:

apxs -q CC

on the system?

Graham

Gnarlodious

unread,
Jun 23, 2012, 9:22:47 PM6/23/12
to mod...@googlegroups.com
I don't know what all of that means, and nobody on the tester's website knows anything. But I need to get this thing compiled and running in daemon mode so when it goes public someone knows something.

apxs -q CC 
-bash: /Applications/Server.app/Contents/ServerRoot/usr/libexec/apache2/mod_wsgi.so: cannot execute binary file
 
Oh I also had to set my command path to look in the Server.app location, as the installer fails to set up properly. Unsure how much I should say publicly.


The full output I get is like this:

gnarlodious~/mod_wsgi-3.3/ make
/usr/sbin/apxs -c -I/usr/local/python-3.1.3/frameworks/Python.framework/Versions/3.1/include/python3.1 -DNDEBUG  -Wc,'-arch x86_64' mod_wsgi.c -Wl,-F/usr/local/python-3.1.3/frameworks -framework Python -framework CoreFoundation   -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/usr/local/python-3.1.3/frameworks/Python.framework/Versions/3.1/include/python3.1 -DNDEBUG  -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

-- Gnarlie

Graham Dumpleton

unread,
Jun 23, 2012, 9:33:16 PM6/23/12
to mod...@googlegroups.com
On 24 June 2012 11:22, Gnarlodious <gnarl...@gmail.com> wrote:
> I don't know what all of that means, and nobody on the tester's website
> knows anything. But I need to get this thing compiled and running in daemon
> mode so when it goes public someone knows something.
>
> apxs -q CC
> -bash:
> /Applications/Server.app/Contents/ServerRoot/usr/libexec/apache2/mod_wsgi.so:
> cannot execute binary file

Are you saying that it outputs that error when you run 'apxs -q CC'?

When you run it, make sure you aren't in directory of mod_wsgi source.
It shouldn't matter, but just make sure.

If apxs gives that error, they have truly mucked something up.

Graham

Gnarlodious

unread,
Jun 23, 2012, 9:55:13 PM6/23/12
to mod...@googlegroups.com
Oops, that was erroneous. Here is what really happens: 

apxs -q CC 
/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc

Is that the cc compiler? How do I use it to build mod_wsgi?

Graham Dumpleton

unread,
Jun 23, 2012, 10:49:58 PM6/23/12
to mod...@googlegroups.com
Do you actually have the required Xcode on the system?

If you do, where does it have 'cc' command installed?
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/mEB40O4Q-fwJ.
>
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to
> modwsgi+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.

Gnarlodious

unread,
Jun 23, 2012, 11:54:09 PM6/23/12
to mod...@googlegroups.com
OK, I found it at:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc

Which is symlinked to clang. So I guess that means a bug report.



On Saturday, June 23, 2012 8:49:58 PM UTC-6, Graham Dumpleton wrote:
Do you actually have the required Xcode on the system?

If you do, where does it have 'cc' command installed?

On 24 June 2012 11:55, Gnarlodious <gnarl...@gmail.com> wrote:
> Oops, that was erroneous. Here is what really happens:
>
> apxs -q CC
> /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc
>
> Is that the cc compiler? How do I use it to build mod_wsgi?
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/mEB40O4Q-fwJ.
>
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to

Graham Dumpleton

unread,
Jun 24, 2012, 12:05:21 AM6/24/12
to mod...@googlegroups.com
For now, edit 'apxs' and look for what it says for:

my $installbuilddir = "/usr/share/httpd/build";
get_config_vars("$installbuilddir/config_vars.mk",\%config_vars);

Then got edir the config_vars.mk file based on the definition. For this case:

/usr/share/httpd/build/config_vars.mk

Then in that file look for:

CC = /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc

and change it to:

CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc

Graham

On 24 June 2012 13:54, Gnarlodious <gnarl...@gmail.com> wrote:
> OK, I found it at:
>
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
>
> Which is symlinked to clang. So I guess that means a bug report.
>
>
>
> On Saturday, June 23, 2012 8:49:58 PM UTC-6, Graham Dumpleton wrote:
>>
>> Do you actually have the required Xcode on the system?
>>
>> If you do, where does it have 'cc' command installed?
>>
>> On 24 June 2012 11:55, Gnarlodious <gnarl...@gmail.com> wrote:
>> > Oops, that was erroneous. Here is what really happens:
>> >
>> > apxs -q CC
>> >
>> > /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc
>> >
>> > Is that the cc compiler? How do I use it to build mod_wsgi?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "modwsgi" group.
>> > To view this discussion on the web visit
>> > https://groups.google.com/d/msg/modwsgi/-/mEB40O4Q-fwJ.
>> >
>> > To post to this group, send email to mod...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > modwsgi+u...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/modwsgi?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/snR6TkCMEwwJ.
>
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to
> modwsgi+u...@googlegroups.com.

Gnarlodious

unread,
Jun 24, 2012, 8:17:52 AM6/24/12
to mod...@googlegroups.com
OK, now I get error:

/usr/share/apr-1/build-1/libtool --silent --mode=compile /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.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/usr/local/python-3.1.3/frameworks/Python.framework/Versions/3.1/include/python3.1 -DNDEBUG  -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'

Graham Dumpleton

unread,
Jun 24, 2012, 8:27:08 AM6/24/12
to mod...@googlegroups.com
At which point I have no idea. It is possible that 'libtool' files in:

/usr/share/libtool/config

are not setup to know about this new C compiler.

Graham
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/CgqxrsfIWsQJ.
Message has been deleted

Gnarlodious

unread,
Jun 24, 2012, 8:47:20 AM6/24/12
to mod...@googlegroups.com
I had to go into

And set the path to the compiler. After that I get this error:

/usr/share/apr-1/build-1/libtool --silent --mode=compile /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.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/usr/local/python-3.1.3/frameworks/Python.framework/Versions/3.1/include/python3.1 -DNDEBUG  -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
mod_wsgi.c:34:10: fatal error: 'httpd.h' file not found
#include "httpd.h"
         ^
1 error generated.
apxs:Error: Command failed with rc=65536
.
make: *** [mod_wsgi.la] Error 1
 
apxs line 735 does say #include "httpd.h" I did find a file at

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/apache2/httpd.h

Maybe that is what it wants?

-- Gnarlie

Gnarlodious

unread,
Jun 24, 2012, 9:14:51 AM6/24/12
to mod...@googlegroups.com
I had to change line 34 of ~/mod_wsgi-3.3/mod_wsgi.c to say:

#include "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/apache2/httpd.h"


Then it seemed to work. Except I get another error where it can't find the file I see at
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/apr-1/apr.h

It looks like all the installer stuff had been moved into Xcode.app. I am going to wait a few days and hope they roll out an updated Xcode and/or Server.app.

-- Gnarlie

Gnarlodious

unread,
Jun 24, 2012, 9:29:29 AM6/24/12
to mod...@googlegroups.com
Is it possible that if the Makefile script was updated to point to the Xcode folders at the beginning all this would work as expected? That is what I am seeing all over, a lot of unixy stuff is now in specialized applications, probably part of the move toward the ios minimalist operating system.

If you have Gchat and want access to my Screen Sharing I can let you in maybe you can fix it in the wsgi installer.

-- Gnarlie

Graham Dumpleton

unread,
Jun 24, 2012, 6:38:59 PM6/24/12
to mod...@googlegroups.com
Try going to:

/Applications/Xcode.app/Contents/Developer/Toolchains/

and do:

ln -s XcodeDefault.xctoolchain OSX10.8.xctoolchain

and see if that solves all the problems in one go without you needing
to change anything.

IOW, you are creating a symlink for the directory it is looking for,
to the one that actually exists.

Graham
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/JhxaxP3S90QJ.

Gnarlodious

unread,
Jul 10, 2012, 11:04:27 PM7/10/12
to mod...@googlegroups.com
OK trying this again with the new build. The symlink works, I filed a bug report on it.

Now the makefile fails with error:

mod_wsgi.c:34:10: fatal error: 'httpd.h' file not found
#include "httpd.h"

which a search reveals at path:
/Applications/Xcode.app/Contents/ /Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/apache2/httpd.h

Should I just paste this path in the .c file and it will import? Sorry I'm a Python programmer, unsure what to do.

-- Gnarlie

Graham Dumpleton

unread,
Jul 10, 2012, 11:07:34 PM7/10/12
to mod...@googlegroups.com
Is this with the Mountain Lion gold master just release now?

What are the -I flags to compile. May be solved with another symlink.

Graham
>> > modwsgi+u...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/modwsgi?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/modwsgi/-/XjOzIjAp3YsJ.
>
> To post to this group, send email to mod...@googlegroups.com.
> To unsubscribe from this group, send email to
> modwsgi+u...@googlegroups.com.

Graham Dumpleton

unread,
Mar 20, 2013, 10:00:54 PM3/20/13
to modwsgi
Specifically what includes did you change?

The issue of Apple screwing up the Apache httpd build system configuration as to location of the developer tools is known, but beyond that it isn't clear what you are saying is the problem.

One thing I do note is that:

/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7

is wrong if using the Apple supplied Python 2.7.

This leads me to believe you are trying to use a separately installed Python 2.7 which is under /Library and not /System/Library.

Generally I would recommend staying clear of third party Python installations for MacOSX unless you have a very good need.

That said, even if you do use a separately installed one, you should not need to modify the Makefile manually. If you use the --with-python option when running configure for mod_wsgi it should pick up the include files and the framework library from the correct location. If it doesn't, then your third party Python installation is possibly broken, or you have given --with-python an incorrect argument.

By manually changing the include path, if that is what you did, you have potentially opened yourself up for problems, as it would still link in the Python framework library for the Apple one, but using potentially using header files that do not match. In other words, you would have need to have changed flags in LDFLAGS as well.

On top of that, you possibly also would have needed to use the --disable-framework option to configure for mod_wsgi as otherwise for some people the third party Python framework library still isn't always used properly and that option forces -L/-l style linking which generally resolves the problem.

So how about backing up and explaining the problem rather than suggesting a solution which on face value appears wrong in various ways.

Thanks.

Graham



On 17 March 2013 02:32, Ignace Suy <ignac...@gmail.com> wrote:
I build and deployed the mod_wsgi module successfully on a macbook air osx 10.8.2, xcode 4.6.1 installed.

I first had to symlink (as described also in another post:
cd /Applications/Xcode.app/Contents/Developer/Toolchains/
sudo ln -s XcodeDefault.xctoolchain  OSX10.8.xctoolchain

then modify the generated Makefile with the following includes (should be a single line):
CPPFLAGS =-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/apr-1 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/apache2 -DNDEBUG 

The module builds fine (some warnings), 
The sudo make install runs fine. 
After this the apache config can be done and the 'hello world' example works fine.

Hope this helps other people trying to get it done.

--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.

To post to this group, send email to mod...@googlegroups.com.

Ignace Suy

unread,
Mar 21, 2013, 6:30:33 PM3/21/13
to mod...@googlegroups.com
Hello Graham,

I spend some 10 hours into building the module, got it to work properly and was happy to share the info on that with others. Since you took real serious effort into my message, here is more info on my challenge, maybe this helps you too solve future frustrations on OSX.

in a nutshell:

unpack mod_wsgi 3.4
run ./configure (no issues)
the Makefile created states:
CPPFLAGS = -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DNDEBUG

lets take a look:
ignace_air:bin ignace$ cd /Library/Frameworks/Python.framework/Versions/2.7/bin
ignace_air:bin ignace$ ./python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

there is also another 2.5, 2.6, 2.7 version of python on this system, lets take a look:
ignace_air:mod_wsgi-3.4 ignace$ cd /System/Library/Frameworks/Python.framework/Versions/2.7/bin
ignace_air:bin ignace$ ./python
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D


I did not install any python. I assume they came with the OS and with Xcode. Cant trace that anymore. I cannot judge which one is 'the best'.
Basically: i did not choose consciously what python to use, ./configure took it.
If you have additional questions on this, or want me run a test on this OSX, now or later, pls feel free.


This was NOT my problem.


after unpacking and
./configure;make

i got:
/usr/sbin/apxs -c -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DNDEBUG -Wc,'-arch x86_64' mod_wsgi.c -Wl,-F/Library/Frameworks -framework Python -u _PyMac_Error -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/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DNDEBUG -c -o mod_wsgi.lo mod_wsgi.c && touch mod_wsgi.slo
mod_wsgi.c:34:10: fatal error: 'httpd.h' file not found
#include "httpd.h"
^
1 error generated.
apxs:Error: Command failed with rc=65536


oops. where is apache?
ignace_air:mod_wsgi-3.4 ignace$ sudo find /Library -name httpd.h
ignace_air:mod_wsgi-3.4 ignace$ sudo find /usr -name httpd.h
ignace_air:mod_wsgi-3.4 ignace$ sudo find /Applications/Xcode.app/ -name httpd.h
/Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/include/apache2/httpd.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/apache2/httpd.h

since i cannot find an option in ./configure to change the apache includes, i added them to the makefile (i am merely a web developer). i realize that apple maybe ditched the apache includes together with the hiding of apache in OSX 10.8.2 ...

i ran into the same problems with:
apr.h
Availability.h

they are all somewhere under:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include

this solved the building process for me and i happily started using the module.
As a sidenote: this machine is too new for several python-module-combinations :-( , so eventually i had to install linux on this hardware.


kind regards, Ignace

Graham Dumpleton

unread,
Mar 21, 2013, 7:11:08 PM3/21/13
to modwsgi
On 22 March 2013 09:30, Ignace Suy <ignac...@gmail.com> wrote:
Hello Graham,

I spend some 10 hours into building the module, got it to work properly and was happy to share the info on that with others. Since you took real serious effort into my message, here is more info on my challenge, maybe this helps you too solve future frustrations on OSX.

in a nutshell:

unpack mod_wsgi 3.4
run ./configure (no issues)
the Makefile created states:
CPPFLAGS =  -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DNDEBUG

lets take a look:
ignace_air:bin ignace$ cd /Library/Frameworks/Python.framework/Versions/2.7/bin
ignace_air:bin ignace$ ./python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr  9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

there is also another 2.5, 2.6, 2.7 version of python on this system, lets take a look:
ignace_air:mod_wsgi-3.4 ignace$ cd /System/Library/Frameworks/Python.framework/Versions/2.7/bin
ignace_air:bin ignace$ ./python
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D

On a fresh install of MacOS X and XCode there is only /System/Library/Frameworks/Python.framework and it is version 2.7.2 of Python. I have a brand new box here that hasn't been setup yet, so know this to be. :-)

The version 2.7.3 you have of Python cannot be from Apple and must have been separately installed.

There are a number of possibilities for how it could have got there.

1. The Python software foundation MacOS X installer for Python was explicitly installed.
2. You are using MacPorts, HomeBrew or fink packaging system and have either explicitly installed it or it was installed as a dependency.
 
 
I did not install any python. I assume they came with the OS and with Xcode. Cant trace that anymore. I cannot judge which one is 'the best'.
Basically: i did not choose consciously what python to use, ./configure took it.

As I said, you are better off using the Apple one and using the --with-python option to indicate that if necessary.

The issue though is whether you system has been mucked up by the alternate Python installation.

I want you to run:

which python

what is the result of this? Does it say:

/usr/bin/python

or something else?

When you run:

/usr/bin/python

and enter at the prompt:

import sys
print sys.prefix
print sys.version_info

what do you get?

Then suggest in mod_sgi source code doing:

make distclean
./configure --with-python=/usr/bin/python

Then send what CPPFLAGS, LDFLAGS and LDLIBS are set to.

After we sort out this much, can then look at Apache issues next.
 

Graham Dumpleton

unread,
Mar 21, 2013, 7:24:32 PM3/21/13
to modwsgi
FWIW, for the Apache issue, it was already documented in the group discussion thread you originally replied to. It said:

"""
Try going to:

/Applications/Xcode.app/Contents/Developer/Toolchains/

and do:

ln -s XcodeDefault.xctoolchain OSX10.8.xctoolchain
"""

With this in place, the make runs fine.

If using the Apple supplied Python you would then get:

$ otool -L .libs/mod_wsgi.so
.libs/mod_wsgi.so:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.2)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.18.0)

If you were to run tool -L on your mod_wsgi.so, I suspect you may see the same, which is why what you are doing can cause problems, because it will be using Python 2.7.2 framework at run time but has been compiled against Python 2.7.3 header files.

To summarise, do the following steps:

1. Add symlink for computer tool chain.

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

2. Building using Apple Python by running mod_wsgi source code:

make distclean
./configure --with-python=/usr/bin/python
make

If /usr/bin/python isn't saying it is 2.7.2, then you have big problems as your Apple supplied Python has been overwritten in some way.

Graham


Ignace Suy

unread,
Mar 22, 2013, 4:00:28 AM3/22/13
to mod...@googlegroups.com
on your step 1. i did that already - otherwise i would have gotten nowhere
on your step 2. make returns the same missing https.h, and running:
ignace_air:mod_wsgi-3.4 ignace$ /usr/bin/python
Python 2.7.2 (default, Jun 20 2012, 16:23:33) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

:-)
-ignace



You received this message because you are subscribed to a topic in the Google Groups "modwsgi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/modwsgi/fMCkwZnMMCo/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to modwsgi+u...@googlegroups.com.

Ignace Suy

unread,
Mar 22, 2013, 4:23:39 AM3/22/13
to mod...@googlegroups.com
hello Graham, as per your request:

ignace_air:mod_wsgi-3.4 ignace$ which python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
ignace_air:mod_wsgi-3.4 ignace$ python
Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> ^D

ignace_air:mod_wsgi-3.4 ignace$ /usr/bin/python
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print sys.prefix
/System/Library/Frameworks/Python.framework/Versions/2.7
>>> print sys.version_info
sys.version_info(major=2, minor=7, micro=2, releaselevel='final', serial=0)
>>> ^D

ignace_air:mod_wsgi-3.4 ignace$ make distclean
rm -rf .libs
rm -f mod_wsgi.o mod_wsgi.la mod_wsgi.lo mod_wsgi.slo mod_wsgi.loT
rm -f config.log config.status
rm -rf autom4te.cache
rm -f Makefile Makefile.in

ignace_air:mod_wsgi-3.4 ignace$ ./configure --with-python=/usr/bin/python
checking for apxs2... no
checking for apxs... /usr/sbin/apxs
checking Apache version... 2.2.22
configure: creating ./config.status
config.status: creating Makefile

ignace_air:mod_wsgi-3.4 ignace$ cat Makefile
====snip====
APXS = /usr/sbin/apxs
PYTHON = /usr/bin/python

DESTDIR =
LIBEXECDIR = /usr/libexec/apache2

CPPFLAGS = -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DENABLE_DTRACE -DMACOSX -DNDEBUG -DNDEBUG -DENABLE_DTRACE
CFLAGS = -Wc,'-arch x86_64'
LDFLAGS = -Wl,-F/System/Library/Frameworks -framework Python -u _PyMac_Error /System/Library/Frameworks/ -arch x86_64
LDLIBS = -ldl -framework CoreFoundation
=====end snip====


conclusion: --with-python=/usr/bin/python MAKES a difference.

regards, Ignace


Graham Dumpleton

unread,
Mar 22, 2013, 5:33:03 AM3/22/13
to modwsgi
And what this all shows is that you have at some time either explicitly in indirectly installed an alternate Python installation, including modifying your PATH variable so it is found in preference to the system Python. Being same major/minor version this is bound to cause you issues at some point.

As for missing Apache header files, on my system with the latest XCode, the header files are in /usr/include/apache2, /usr/include/apr-1. There is just no way they could not be found and adding explicit include paths should not have been required. That they were found fine when using --with-python option with Apple Python shows something in that alternate Python version is screwing things up.

I would suggest you modify your .bash_profile or whatever it is, that is setting your PATH so as to have:

/Library/Frameworks/Python.framework/Versions/2.7/bin

With that removed, just use the Apple supplied Python.

Graham





regards, Ignace


Reply all
Reply to author
Forward
0 new messages