Author |
|
aras
Joined: 07 Dec 2012 Posts: 18 Location: USA
|
Posted: Fri 07 Dec '12 22:34 Post subject: Compiling with APXS: Impossible! |
|
|
Hi everyone!
I have been trying to compile a 3rd party modules with apxs for a while, but no success. All they appear to give bunch of errors/warnings with the same NO RESULT at the end. I tried to find the solution for the problem, but I am not at the level of understanding of those errors. I would appreciate if you guys look to those errors an try to find what is actually going on. Thanks a lot!
Admin note:
Compiler output removed, use paste bin. See forum rules. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Sat 08 Dec '12 0:29 Post subject: |
|
|
The module was written for Apache 2.0.x yet compiles fine in 2.2.x as well. The problems are due to the changes in Apache 2.4. I think it's pretty easy to fix however and make it compatible with both Apache 2.2 & 2.4.
Instructions on how to build from command line without apxs in the file comments.
edit: removed old link, see below for new one
Last edited by glsmith on Sun 09 Dec '12 1:33; edited 2 times in total |
|
Back to top |
|
aras
Joined: 07 Dec 2012 Posts: 18 Location: USA
|
Posted: Sat 08 Dec '12 18:43 Post subject: |
|
|
Thank you glsmith for your response. What for one would be “simple” solution, for others might be just real headache. I tried to follow your instructions for command line. Again, I am getting bunch of errors. Probably I am doing something wrong. Excuse my ignorance, but I am just trying to learn some new subject.
Quote: | c:\Program Files\Microsoft Visual Studio 9.0\VC>set APACHE=C:\Apache24
c:\Program Files\Microsoft Visual Studio 9.0\VC>cl /nologo /MD /o2 /LD /W3 -DWIN
32 -D_WIN32 -I%APACHE%\include /c /Fomod_scgi.obj c:\apache24\build\1\mod_scgi.c
link "kernel32.lib" "%APACHE%\lib\libhttpd.lib" "%APACHE%\lib\libapr-1.lib" "%A
PACHE%\lib\libaprutil-1.lib" /nologo /subsystem:windows /dll /out:mod_scgi.obj M
T -manifest mod_scgi.so.manifest -outputresource:mod_scgi.so;2
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9035 : option 'o' has been deprecated and will be removed in a future release
cl : Command line warning D9002 : ignoring unknown option '/subsystem:windows'
cl : Command line warning D9002 : ignoring unknown option '/dll'
cl : Command line warning D9002 : ignoring unknown option '-manifest'
cl : Command line warning D9024 : unrecognized source file type 'link', object file assumed
cl : Command line warning D9027 : source file 'link' ignored
cl : Command line warning D9027 : source file 'kernel32.lib' ignored
cl : Command line warning D9027 : source file 'C:\Apache24\lib\libhttpd.lib' ignored
cl : Command line warning D9027 : source file 'C:\Apache24\lib\libapr-1.lib' ignored
cl : Command line warning D9027 : source file 'C:\Apache24\lib\libaprutil-1.lib' ignored
cl : Command line warning D9024 : unrecognized source file type 'MT', object file assumed
cl : Command line warning D9027 : source file 'MT' ignored
cl : Command line warning D9024 : unrecognized source file type 'mod_scgi.so.manifest', object file assumed
cl : Command line warning D9027 : source file 'mod_scgi.so.manifest' ignored
mod_scgi.c
c:\apache24\build\1\mod_scgi.c(284) : warning C4018: '>=' : signed/unsigned mismatch
c:\apache24\build\1\mod_scgi.c(293) : warning C4018: '<' : signed/unsigned mismatch
c:\apache24\build\1\mod_scgi.c(421) : warning C4244: 'function' : conversion from 'apr_off_t' to 'apr_size_t', possible loss of data
c:\apache24\build\1\mod_scgi.c : fatal error C1083: Cannot open compiler generated file: 'mod_scgi.obj': Permission denied
c:\Program Files\Microsoft Visual Studio 9.0\VC> |
|
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Sat 08 Dec '12 22:50 Post subject: |
|
|
No problem. I see the admin removed your original errors but if I remember correctly you were trying to build this module in c:\Apache24\build
So after opening the VC++ command window CD to c:\Apache24\build
Code: | c:\Program Files\Microsoft Visual Studio 9.0\VC>cd\apache24\build
c:\apache24\build>
|
Now then, each one of those lines is a separate command.
SET is just a DOS command that sets an environment variable named APACHE to Apache's location, DOS expands the %APACHE% to that location wherever it's used.
CL is the compiler that compiles the code into an object(.obj) file.
LINK links the object to Windows and Apache libraries(.lib) and produces the dll (.so).
MT embeds the manifest into the dll.
So; Code: |
c:\apache24\build>set APACHE=c:\Apache24
c:\apache24\build>cl /nologo /MD /O2 /LD /W3 -DWIN32 -D_WIN32 -I%APACHE%\include /c /Fomod_scgi.ob
j mod_scgi.c
mod_scgi.c
mod_scgi.c(284) : warning C4018: '>=' : signed/unsigned mismatch
mod_scgi.c(293) : warning C4018: '<' : signed/unsigned mismatch
mod_scgi.c(421) : warning C4244: 'function' : conversion from 'apr_off_t' to 'apr_size_t', possible
loss of data
c:\apache24\build>link "kernel32.lib" "%APACHE%\lib\libhttpd.lib" "%APACHE%\lib\libapr-1.lib" "%APA
CHE%\lib\libaprutil-1.lib" /nologo /subsystem:windows /dll /out:mod_scgi.so mod_scgi.obj
Creating library mod_scgi.lib and object mod_scgi.exp
c:\apache24\build>MT -manifest mod_scgi.so.manifest -outputresource:mod_scgi.so;2
Microsoft (R) Manifest Tool version 5.2.3790.2076
Copyright (c) Microsoft Corporation 2005.
All rights reserved.
c:\apache24\build>
|
|
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
|
Back to top |
|
aras
Joined: 07 Dec 2012 Posts: 18 Location: USA
|
Posted: Sun 09 Dec '12 1:58 Post subject: |
|
|
I am impressed. Great explanation! Thank you very much. I followed all your instructions precisely: the steps worked like a charm. Now it is a time for evaluation of the module.
Since I have compiled the module on x86 machine this time, I am wondering if new module should be recompiled on x64 machine in order to run with Apache x64?
I would also like to point out to one important moment, which appeared to be quite an obstacle in my journey. The Command line has to be run with Administrator’s rights. Sounds obvious now, but for start-ups like me this should be stressed out.
And also I was wandering, would you be so kind to update the mod_fastcgi to fit Apache 2.4 as well (on-http://www.fastcgi.com/dist/)? |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Sun 09 Dec '12 5:35 Post subject: |
|
|
Yes, a module must be compiled for x64 against Apache x64 to run on Apache x64. You need a VC version other than Express (or an SDK with x64 compiler installed) to build x64 however. There's no way for me to tell which version of VC9 you are using.
mod_fastcgi ... looks like someone already has
https://github.com/klutometis/mod_fastcgi
I've never had to be running the command line as Administrator to compile on Win7 ... odd .. but systems are configured differently so there's always some possibility of difference. |
|
Back to top |
|
aras
Joined: 07 Dec 2012 Posts: 18 Location: USA
|
Posted: Sun 09 Dec '12 23:28 Post subject: |
|
|
Thanks for the reply glsmith.
Concerning the link you are referring to the mod_fastcgi. I have checked that link, but the sources seem to be impossible to compile similarly to original sources on fastcgi.com. I was just curious to compare mod_fastcgi with the mod_fcgid, but unfortunately there is no source to compile for Apache 2.4.* (x86 or x64). My assumption is that the project is simply abandoned. I am not an expert though. so it would be great If you have chance to take a look if it is possible to compile the module for the modern systems. Your expertize would matter. Thank you. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Mon 10 Dec '12 3:43 Post subject: |
|
|
aras wrote: | Concerning the link you are referring to the mod_fastcgi. I have checked that link, but the sources seem to be impossible to compile similarly to original sources on fastcgi.com. |
Looks like the person has not started making the needed changes yet, it's not a really hard fix though.
Ready to get your hand dirty?
https://www.apachehaus.net/misc/mod_fastcgi.html |
|
Back to top |
|
aras
Joined: 07 Dec 2012 Posts: 18 Location: USA
|
Posted: Mon 10 Dec '12 19:22 Post subject: |
|
|
Applauds for glsmith!
Build on x86 was successful. Everything as it has been said. The topic should remain on apachelounge for others to come… |
|
Back to top |
|