On Sun, Jan 25, 2009 at 9:56 AM, Graham Dumpleton
<graham.dumple...@gmail.com> wrote:
>
> BTW, make sure you are not using mod_wsgi 2.3 tar ball. Use subversion
> check out of:
>
>  http://modwsgi.googlecode.com/svn/branches/mod_wsgi-2.X
>
> There are a couple of Windows specific build issues that were fixed since.

Decided to take a stab at it so I tried building with Mingw instead of
VS 2008 (takes hours to install on my PC for some reason). I think
someone mentioned here that you have to compile everything with the
same compiler used to compile Apache and Python. But that's not
entirely true as long as you are using plain C and not C++. GCC and
MSVC compiler uses different name mangling conventions for C++ which
is why you will usually run into trouble if you link to a C++ DLL
module compiled using MSVC. I have successfully built Win32 programs
that linked to MSVC compiled DLL's and .lib files in the past. You
just need to use a couple of tools to create the appropriate format
libraries that Mingw ld can use.

I am able to get it to compile with a couple of warnings about
redefined #define. The problem is when I try to link it with the
Apache libs. The Python 2.6.1 binary from from python.org already has
a libpython26.a and I only needed to create the import libraries for
Apache. So, I went into Apache2.2/bin and did:

pexports libhttpd.dll > libhttpd.dll.def
dlltool -D libhttpd.dll -d libhttpd.dll.def -l libhttpd.dll.a

pexports libapr-1.dll > libapr-1.dll.def
dlltool -D libapr-1.dll -d libapr-1.dll.def -l libapr-1.dll.a

pexports libaprutil-1.dll > libaprutil-1.dll.def
dlltool -D libaprutil-1.dll -d libaprutil-1.dll.def -l libaprutil-1.dll.a

My gcc command line was:

gcc -shared -o mod_wsgi.so mod_wsgi.c -I "C:/Python26/include" -I
"C:/Program Files/Apache Software Foundation/Apache2.2/include" -L
"C:/Python26/libs" -L "C:/Program Files/Apache Software
Foundation/Apache2.2/bin" -lpython26 -lhttpd -lapr-1 -laprutil-1

The errors I got relate to failure to link _imp_ap* and _imp_apr*
functions. Maybe I'm just missing a command line option or a couple of
Windows specific defines. IIRC you need to add __declspec(dllexport)
to such functions. But I'm too drunk to figure it out at the moment.

Anyway, I hope this exercise becomes a useful starting point for
others wanting a mod_wsgi for Windows.
-- 
Best Regards,
Nimrod A. Abing

W http://arsenic.ph/
W http://preownedcar.com/
W http://preownedbike.com/
W http://abing.gotdns.com/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to modwsgi@googlegroups.com
To unsubscribe from this group, send email to 
modwsgi+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to