Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: mod_fcgi + ( echo.exe, libfcgi.dll compiled by VC++ 2008) |
|
Author |
|
vitalus
Joined: 18 Jun 2009 Posts: 4
|
Posted: Thu 18 Jun '09 12:28 Post subject: mod_fcgi + ( echo.exe, libfcgi.dll compiled by VC++ 2008) |
|
|
I am not sure anybody knows what may be wrong but I try to ask.
I use Apache 2.2.11 with appropriate version of mod_fcgid.so downloaded from there.
I compiled libfcgi.dll and sample script echo.exe printing just environment variables using VC++ 2008 (msvcr90.dll and msvcp90.dll are used as CRT). Corresponding manifests are embedded to echo.exe and libfcgi.dll using mt.exe tool from Microsoft.
I run on Vista the underlying Apache version, mod_fcgi.so module and echo.exe as a fastcgi script. It works like it has to: hangs in memory and processes requests.
ProcessExplorer shows msvc*90.dll are used from WinSxS folder.
Then I have the same configuration of Apache 2.2.11 and mod_fcgid.so on Windows XP SP3 with VC++ redistributable package installed in WinSxS (C and C++ runtime libraries).
I have echo.exe and libfcgi.dll with embedded manifests in one folder together. So I can run echo.exe from command line - works fine. I can call echo.exe as a CGI script form cgi-bin - works fine. But I can not call echo.exe from fcgi-bin as a Fast CGI script and the error is old known:
"Runtime Error! R6034 An application has made an attempt to load C runtime library incorrectly..."
When popup window is shown I can start ProcessExplorer and see those msvc*90.dll files are loaded by echo.exe process, also msvcrt.dll (because it is used by ws2_32.dll - a dependency of libfcgi.dll).
I tries various hacks... echo.exe is working from cmd, as a CGI script and CRT.90 is loaded successfully on XP but problems with initialization as a fastcgi process..
What can be special with mod_fcgid initialization relatively CRT.90 libraries from WinSxS storage and manifests?
On Vista echo.exe works as fast cgi, configuration in httpd.conf of mod_fcgid is identical for Vista and XP machines, all directives are the same (like environment paths and variables..).
I can send zip with echo.exe and libfcgi.dll to test if anybody is interested..
I'm just curious what is special in this case... |
|
Back to top |
|
scott
Joined: 16 Jun 2009 Posts: 6
|
Posted: Fri 19 Jun '09 10:03 Post subject: |
|
|
Use the dependancy walker here http://www.dependencywalker.com/ to find out what libraries the dll/exe files are dependant on and copy them into the relevant directories.
I find normally for modules i write, external dependencies have to go into the apache bin folder.
Also, did you build the dll in debug or release mode? the runtime libraries used are different for each.
hth.
--scott |
|
Back to top |
|
vitalus
Joined: 18 Jun 2009 Posts: 4
|
Posted: Fri 19 Jun '09 17:53 Post subject: |
|
|
I use DependencyWalker. All runtime libraries are in place (installed to WinSxS). I can run echo.exe from command line and call it as CGI application through Apache.
The problem is specific to mod_fcgid module, I think, I can not guess what can it be...
I compiled echo.exe + libfcgi.dll on XP machine using VS2003, VS2005, VS2008.
Only in case VS2003 with a dependency on msvcr71.dll without manifests echo.exe runs fine through FastCGI interface on Apache 2.2.11 on XP.
echo.exe compiled with VS2005 or VS2008 does not work at all (all CRT DLLs are present in WinSxS) through FastCGI. At the same time in all configurations (versions of compiler) echo.exe works form command line and as CGI. It means that there are no problems with absence of CRT libraries on machine.
I tried also debug version, still does not work in case of CRT.80 or CRT.90.
I tries to run on several machines with XP and Apache 2.2.11 - the same problem for ALL XP machines. On Vista and Windows Server 2003 everything works!
I tried echo.exe with embedded and external manifest files..
What can be wrong that the process spawned by mod_fcgid module can not initialize C runtime library of versions >= 80 (starting from MS2005) - those where manifests were introduced. Notice that it is only XP case..
This is not critical issue in general, but it's my curiosity...
I even tried to compile echo.exe with static linking of libfcgi..
Here is a screenshot to show that libraries are just on their place:
http://s3.amazonaws.com/scrnshots.com/screenshots/174474/echopng |
|
Back to top |
|
vitalus
Joined: 18 Jun 2009 Posts: 4
|
|
Back to top |
|
|
|
|
|
|