-
Notifications
You must be signed in to change notification settings - Fork 88
Fixing support for Windows #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
+1 def say(req, what='NOTHING'):
return "I am saying %s" % whatwhich worked fine. |
|
@domruf Nick |
|
You guys shouldn't need this patch for VS 2013 and up. Though I don't know what C99 features are missing form 2013. |
|
I still needed to use these changes, although i keep running into problem after problem |
|
@taylorni Would you be so kind as to report on your final experience with this (I'm especially curious about the comment from @nadams810 and version)? The reason why this hasn't been merged is that I don't have access to Windows and VS and can't test it on my end and so I have to rely on people who do. :) |
|
According to this article they started to add C99 features into VS2013: http://blogs.msdn.com/b/vcblog/archive/2013/07/19/c99-library-support-in-visual-studio-2013.aspx (Which declaring a variable after statements is a C99 feature - and this was one of the paradigms that was used in the code). After looking at my breakdown here: http://modpython.org/pipermail/mod_python/2013-November/026626.html I realized there are other issues as well on Windows - sorry it's been awhile and after looking at tons of code from different languages you start to forget things :). I'm just glad I wrote that up so I know what I did to fix it. I'd be interested to hear what problems @taylorni is running into. I know it was a uphill battle for me. |
|
So first off i just want to make it clear that my lack off knowledge and experience is defiantly making this process harder than it should be, but I'm giving it a try anyway.
Now this is where i am stuck, I am getting several unresolved external symbols. @nadams810, you mentioned a fix to this, and also including the finfooobject.c into the project file, where exactly was this done ? Overall it has been a frustrating experience so far but like I said at the start I put this down to my lack of knowledge and experience, however @nadams810 changes defiantly helped me along the way. Nick |
|
After some more investigation this morning, and fixing a few of the Apache related 'unresolved external symbols', I have two symbols left, mp_version_string and mp_version_component. Not sure how to fix these though.. So I'm guessing what i did in step 12 is now back firing on me EDIT: Created version.c file, included it in mod_python.c, and it fixed the problem. Now, mt.exe is having troubles. mt.exe cannot locate the manifest built by link.exe the step before, link.exe is not showing any errors so im not sure as to why it is not there. |
|
@taylorni - I added it to the project to be compiled - http://i.imgur.com/QRXBIJF.png Would it help if I zipped up all the libraries/headers I used to compile it? I remember I had to scour the internet for some of them. |
|
@nadams810 Yea that would be a great help, greatly appreciated |
|
when I successfully build mod_python.so before I opend the VS Project. But I was also able to build the whole installer now.
The Version String problem needs a proper cross platform solution but at least you can get a working installer with these patches. |
|
Thanks for all your assistance, it is defiantly making this process alot smoother, I followed the instructions by @domruf and changed a few paths in VS2013 and it was succesful. Now when trying to test it, im getting And then when i try to access test.py i get: |
|
@taylorni I uploaded the files here: https://app.box.com/s/orsffo3t4g6h9ftkq6p1 There should be a mod_python.so in the mod_python-master.VS (this is using older code). It was compiled for Python 2.7.5 and Apache 2.4. The include paths may need to be adjusted. If you are really frustrated I could build an innosetup package that installs the libraries/includes straight to your VS directory. This is usually not ideal or recommend but trust me I share your frustration when you don't care what's "right" you just want stuff to work. Can you post your Apache configs somewhere so we can see how you load the module? Some pastebin type site ( such as http://paste.ubuntu.com/ ) would probably be for the best. As well as whatever sample code you are trying? |
|
@nadams810 - Here is my test code and apache config, thanks greatly for you help http://paste.ubuntu.com/6957801/ |
|
Oh ok I think I see what's going on. So first you have to stick lib/python/mod_python somewhere in your python path (dist-packages would work if you have root). Basically if you can launch a Python interpreter and run "from mod_python import apache" without an error then you are probably ok. This may be the problem - if not read on. The only thing I see is kind of strange with your config is this: Options FollowSymLinks AllowOverride None Order deny,allow Deny from all AddHandler mod_python .py PythonHandler myscript PythonDebug OnWhile many would argue against allowing / - I am not the security config police. You may configure your server however you wish - but you have been warned that other individuals may yell at you :). Try this: Options FollowSymLinks AllowOverride None Order deny,allow Deny from all SetHandler mod_python PythonHandler mod_python.testhandler PythonDebug OnAnd see if that gets you anywhere. |
|
Just confirming this is mod_python.so ? Because that is in my path but I still cannot run without getting an error. |
|
No you need these files: https://github.com/grisha/mod_python/tree/master/lib/python apache.py is inside of that folder (mod_python) which has a constant defined of "OK". |
|
I gotcha, ok so now its saying,
from mod_python import apache
Traceback (most recent call last):
File "", line 1, in
File "C:\Python26\lib\mod_python__init__.py", line 25, in
from . import version
ImportError: cannot import name version
Moving past that, It is now showing that there is no module '_apache' |
|
Hmm..this one has me stumped. @grisha will have to tell us how to generate version.py. Let me see if I can build one from Linux. |
|
Well this is defiantly one of my moments. You need to run setup.py to generate version.py. However, setup.py gets generated from configure I believe. You could probably fake one here is what the contents should be: Here are the resulting files on Linux: http://jenkins.datanethost.net/jenkins/job/mod_python_debian/ws/ |
|
Alright so I built a fake version.py based off those details and that seemed to fix it, now it is saying that there is no module '_apache' I read here that "you can't import mod_python into scripts that are run from the command So that means that this is the expected result for importing Apache from the python interpreter ? |
|
I guess so :(. Try running your script again - hopefully now that it's in your path and you have a version.py it should be happy. |
|
Yea i just ran it again and its giving me what looks like the test handler information e.g General Information,Request input headers,Request environment... etc. So it looks like it was succesful.. :/ But how do i get it to run my original script ? |
Preferably outside of your root HD :P ie |
|
Thank-you very much! Its finally working, thank you for being so patient with me haha! |
|
I feel like there should be a celebration with beer and cake. |
|
One final question, if want to get this onto another computer that has the same version of Apache and python, can I move the files across and go from there or do i need to re-compile with VS on the other machine ? |
|
You should be able to copy the compiled mod_python and Python libraries to the other computer without recompiling. Just as long as Apache versions are the same (or close) and Python versions are the same (or close). |
|
What is preventing this from being merged in? I am looking to use mod_python on an apache windows project coming up soon, and it'd be nice to not have to build off a fork... though it'd be even better if there was a released version w/ windows support =) |
|
@matthauck not being able to test this myself, I sense from the comments that there's still a few things that need to be fixed? |
|
Yeah I realized this later when I tried to do it myself and couldn't quite get it to compile. =T
|
|
What is the problem you are having when you try to compile? |
|
I don't remember the exact message and have since abandoned this approach, On Wed, Jul 16, 2014 at 5:12 PM, nadams810 notifications@github.com wrote:
Matt |
|
@matthauck You can download all the libraries you will need + sources here: https://app.box.com/s/orsffo3t4g6h9ftkq6p1 They were not very obvious to acquire. Visual Studio is a really awesome IDE (imo anyways) but they still don't provide a way for developers to note dependencies and where to get them. |
|
All - I have (finally) created a jenkins slave for Windows builds. This is built using Visual Studio 2010 https://srchub.org/jenkins/job/mod_python-Windows/lastSuccessfulBuild/artifact/src/Release/ and using the code from my fork. There are many warnings ( https://srchub.org/jenkins/job/mod_python-Windows/lastSuccessfulBuild/console ) but it does compile and spit out an Apache module. However - automatically testing the module is whole other challenge. @matthauck feel free to download the pre-built module if you still are looking to use mod_python on Windows |
|
thanks so much @nadams810. The ship has sailed for this project as I've actually gone ahead and written the module we needed in C instead. Perhaps for a future project. =) |
I put in the C99 fixes and also added Visual Studio 2010 config files.