You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Sindhi Sindhi <si...@gmail.com> on 2013/03/31 11:06:17 UTC
Apache fails to start when Xerces library is used in a C++ module
Hello,
I have written a C++ module to invoke the Xerces C++ XML library to parse a
XML file. I'm unable to start httpd.exe with these changes. Here are the
details -
a) Apache server version: httpd-2.4.4-win64
b) Xerces version: xerces-c-3.1.1-x86_64-windows-vc-10.0
c) Development envt: Visual Studio 2010 with SP1
Following are the settings I have made in Visual Studio so that the C++
module refers to the Xerces library:
1. Additional Include Directories =
E:\xerces-c-3.1.1-x86_64-windows-vc-10.0\xerces-c-3.1.1-x86_64-windows-vc-10.0\include
2. Additional Dependencies = xerces-c_3.lib and xerces-c_static_3.lib
3. Additional library directories =
E:\xerces-c-3.1.1-x86_64-windows-vc-10.0\xerces-c-3.1.1-x86_64-windows-vc-10.0\lib
4. Debugging -> Environment:
PATH=E:\xerces-c-3.1.1-x86_64-windows-vc-10.0\xerces-c-3.1.1-x86_64-windows-vc-10.0\bin
5. In the Operating System environment variables, added the path
E:\xerces-c-3.1.1-x86_64-windows-vc-10.0\xerces-c-3.1.1-x86_64-windows-vc-10.0\bin
to the environment variable PATH
6. The code in my C++ module to invoke the Xerces library routine goes like
this -
try {
XMLPlatformUtils::Initialize(); // Initialize Xerces infrastructure
}
catch( XMLException& e ) {
char* message = XMLString::transcode( e.getMessage() );
XMLString::release( &message );
}
XMLPlatformUtils::Terminate();
7. Added the below in httpd.conf file -
LoadModule filter_module modules/XercesDLL.dll
AddOutputFilterByType TagFilter text/html text/plain text/css
8. If i try to launch httpd.exe from command prompt, I see the below error -
>httpd.exe
httpd.exe: Syntax error on line 172 of
E:/httpd-2.4.4-win64/Apache24/conf/httpd.conf: Cannot load
modules/XercesDLL.dll into server: The specified module could not be found.
Even if I comment out the above C++ code in step 6, Apache still fails to
start. That means Apache is failing to load the Xerces library version I'm
using, irrespective of the way I'm invoking the library.
However, If I write a standalone DLL that invokes the above Xerces library
version, and invoke this DLL from an EXE then I'm successfully able to
parse the XML. This means, the Xerces library fails to get loaded only by
the Apache server for some reason.
I think its got something to do with the C to C++ linkage, not sure tho.
Any help is highly appreciated.
Thanks.
Re: Apache fails to start when Xerces library is used in a C++ module
Posted by Sindhi Sindhi <si...@gmail.com>.
Thankyou very much, after providing the Xerces DLL location in LoadFile I'm
able to parse the XML :-)
Thanks once again!
On Sun, Mar 31, 2013 at 5:25 PM, Rainer Jung <ra...@kippdata.de>wrote:
> On 31.03.2013 13:09, Sindhi Sindhi wrote:
> > Hello Sorin,
> >
> > Thanks for your reply.
> >
> > I tried the below two -
> >
> > 1. I had earlier downloaded Xerces from
> >
> http://xml.apache.org/dist/xerces-c/3/binaries/xerces-c-3.1.1-x86_64-windows-vc-10.0.zip
> > It had xerces-c_3.lib and xerces-c_static_3.lib. The file names indicated
> > that these are 64-bit binaries.
> >
> > I added the below in httpd.conf file -
> > LoadFile
> >
> e:/xerces-c-3.1.1-x86_64-windows-vc-10.0/xerces-c-3.1.1-x86_64-windows-vc-10.0/lib/xerces-c_3.lib
> >
> > Tried to start httpd.exe and got the below error -
> > e:\httpd-2.4.4-win64\Apache24\bin>httpd.exe
> > httpd.exe: Syntax error on line 173 of
> > E:/httpd-2.4.4-win64/Apache24/conf/httpd.conf: Cannot load
> >
> E:/xerces-c-3.1.1-x86_64-windows-vc-10.0/xerces-c-3.1.1-x86_64-windows-vc-10.0/lib/xerces-c_3.lib
> > into server: %1 is not a valid Win32 application.
> >
> > If I try to load xerces-c_static_3.lib also I get the same error.
> >
> > 2. I downloaded the Xerces source code from
> > http://xml.apache.org/dist/xerces-c/3/sources/xerces-c-3.1.1.zip and
> built
> > it using Visual Studio 2010 as a 64-bit target. This generated
> > xerces-c_3D.lib.
> >
> > Changed httpd.conf file,
> > LoadFile
> > E:/xerces-c-3.1.1/xerces-c-3.1.1/Build/Win64/VC10/Debug/xerces-c_3D.lib
> >
> > Tried to start httpd.exe and got the same error.
> > httpd.exe: Syntax error on line 173 of
> > E:/httpd-2.4.4-win64/Apache24/conf/httpd.conf: Cannot load
> > E:/xerces-c-3.1.1/xerces-c-3.1.1/Build/Win64/VC10/Debug/xerces-c_3D.lib
> > into server: %1 is not a valid Win32 application.
> >
> > Kindly advice.
>
> I'd expect you need to LoadFile the Xerces DLLs not the lib files.
>
> Regards,
>
> Rainer
>
>
Re: Apache fails to start when Xerces library is used in a C++ module
Posted by Rainer Jung <ra...@kippdata.de>.
On 31.03.2013 13:09, Sindhi Sindhi wrote:
> Hello Sorin,
>
> Thanks for your reply.
>
> I tried the below two -
>
> 1. I had earlier downloaded Xerces from
> http://xml.apache.org/dist/xerces-c/3/binaries/xerces-c-3.1.1-x86_64-windows-vc-10.0.zip
> It had xerces-c_3.lib and xerces-c_static_3.lib. The file names indicated
> that these are 64-bit binaries.
>
> I added the below in httpd.conf file -
> LoadFile
> e:/xerces-c-3.1.1-x86_64-windows-vc-10.0/xerces-c-3.1.1-x86_64-windows-vc-10.0/lib/xerces-c_3.lib
>
> Tried to start httpd.exe and got the below error -
> e:\httpd-2.4.4-win64\Apache24\bin>httpd.exe
> httpd.exe: Syntax error on line 173 of
> E:/httpd-2.4.4-win64/Apache24/conf/httpd.conf: Cannot load
> E:/xerces-c-3.1.1-x86_64-windows-vc-10.0/xerces-c-3.1.1-x86_64-windows-vc-10.0/lib/xerces-c_3.lib
> into server: %1 is not a valid Win32 application.
>
> If I try to load xerces-c_static_3.lib also I get the same error.
>
> 2. I downloaded the Xerces source code from
> http://xml.apache.org/dist/xerces-c/3/sources/xerces-c-3.1.1.zip and built
> it using Visual Studio 2010 as a 64-bit target. This generated
> xerces-c_3D.lib.
>
> Changed httpd.conf file,
> LoadFile
> E:/xerces-c-3.1.1/xerces-c-3.1.1/Build/Win64/VC10/Debug/xerces-c_3D.lib
>
> Tried to start httpd.exe and got the same error.
> httpd.exe: Syntax error on line 173 of
> E:/httpd-2.4.4-win64/Apache24/conf/httpd.conf: Cannot load
> E:/xerces-c-3.1.1/xerces-c-3.1.1/Build/Win64/VC10/Debug/xerces-c_3D.lib
> into server: %1 is not a valid Win32 application.
>
> Kindly advice.
I'd expect you need to LoadFile the Xerces DLLs not the lib files.
Regards,
Rainer
Re: Apache fails to start when Xerces library is used in a C++ module
Posted by Sindhi Sindhi <si...@gmail.com>.
Hello Sorin,
Thanks for your reply.
I tried the below two -
1. I had earlier downloaded Xerces from
http://xml.apache.org/dist/xerces-c/3/binaries/xerces-c-3.1.1-x86_64-windows-vc-10.0.zip
It had xerces-c_3.lib and xerces-c_static_3.lib. The file names indicated
that these are 64-bit binaries.
I added the below in httpd.conf file -
LoadFile
e:/xerces-c-3.1.1-x86_64-windows-vc-10.0/xerces-c-3.1.1-x86_64-windows-vc-10.0/lib/xerces-c_3.lib
Tried to start httpd.exe and got the below error -
e:\httpd-2.4.4-win64\Apache24\bin>httpd.exe
httpd.exe: Syntax error on line 173 of
E:/httpd-2.4.4-win64/Apache24/conf/httpd.conf: Cannot load
E:/xerces-c-3.1.1-x86_64-windows-vc-10.0/xerces-c-3.1.1-x86_64-windows-vc-10.0/lib/xerces-c_3.lib
into server: %1 is not a valid Win32 application.
If I try to load xerces-c_static_3.lib also I get the same error.
2. I downloaded the Xerces source code from
http://xml.apache.org/dist/xerces-c/3/sources/xerces-c-3.1.1.zip and built
it using Visual Studio 2010 as a 64-bit target. This generated
xerces-c_3D.lib.
Changed httpd.conf file,
LoadFile
E:/xerces-c-3.1.1/xerces-c-3.1.1/Build/Win64/VC10/Debug/xerces-c_3D.lib
Tried to start httpd.exe and got the same error.
httpd.exe: Syntax error on line 173 of
E:/httpd-2.4.4-win64/Apache24/conf/httpd.conf: Cannot load
E:/xerces-c-3.1.1/xerces-c-3.1.1/Build/Win64/VC10/Debug/xerces-c_3D.lib
into server: %1 is not a valid Win32 application.
Kindly advice.
Thanks.
On Sun, Mar 31, 2013 at 3:50 PM, Sorin Manolache <so...@gmail.com> wrote:
> On 2013-03-31 11:06, Sindhi Sindhi wrote:
>
>> Hello,
>>
>> I have written a C++ module to invoke the Xerces C++ XML library to parse
>> a
>> XML file. I'm unable to start httpd.exe with these changes. Here are the
>> details -
>>
>> a) Apache server version: httpd-2.4.4-win64
>> b) Xerces version: xerces-c-3.1.1-x86_64-windows-**vc-10.0
>> c) Development envt: Visual Studio 2010 with SP1
>>
>> Following are the settings I have made in Visual Studio so that the C++
>> module refers to the Xerces library:
>> 1. Additional Include Directories =
>> E:\xerces-c-3.1.1-x86_64-**windows-vc-10.0\xerces-c-3.1.**
>> 1-x86_64-windows-vc-10.0\**include
>>
>> 2. Additional Dependencies = xerces-c_3.lib and xerces-c_static_3.lib
>>
>> 3. Additional library directories =
>> E:\xerces-c-3.1.1-x86_64-**windows-vc-10.0\xerces-c-3.1.**
>> 1-x86_64-windows-vc-10.0\lib
>>
>> 4. Debugging -> Environment:
>> PATH=E:\xerces-c-3.1.1-x86_64-**windows-vc-10.0\xerces-c-3.1.**
>> 1-x86_64-windows-vc-10.0\bin
>>
>> 5. In the Operating System environment variables, added the path
>> E:\xerces-c-3.1.1-x86_64-**windows-vc-10.0\xerces-c-3.1.**
>> 1-x86_64-windows-vc-10.0\bin
>> to the environment variable PATH
>>
>> 6. The code in my C++ module to invoke the Xerces library routine goes
>> like
>> this -
>>
>> try {
>> XMLPlatformUtils::Initialize()**; // Initialize Xerces infrastructure
>> }
>> catch( XMLException& e ) {
>> char* message = XMLString::transcode( e.getMessage() );
>> XMLString::release( &message );
>> }
>> XMLPlatformUtils::Terminate();
>>
>> 7. Added the below in httpd.conf file -
>> LoadModule filter_module modules/XercesDLL.dll
>> AddOutputFilterByType TagFilter text/html text/plain text/css
>>
>> 8. If i try to launch httpd.exe from command prompt, I see the below
>> error -
>>
>>> httpd.exe
>>>
>> httpd.exe: Syntax error on line 172 of
>> E:/httpd-2.4.4-win64/Apache24/**conf/httpd.conf: Cannot load
>> modules/XercesDLL.dll into server: The specified module could not be
>> found.
>>
>> Even if I comment out the above C++ code in step 6, Apache still fails to
>> start. That means Apache is failing to load the Xerces library version I'm
>> using, irrespective of the way I'm invoking the library.
>>
>> However, If I write a standalone DLL that invokes the above Xerces library
>> version, and invoke this DLL from an EXE then I'm successfully able to
>> parse the XML. This means, the Xerces library fails to get loaded only by
>> the Apache server for some reason.
>>
>> I think its got something to do with the C to C++ linkage, not sure tho.
>>
>> Any help is highly appreciated.
>>
>
>
> Hello,
>
> Try
>
> LoadFile /absolute/path/to/the/xerces/**lib1
> LoadFile /absolute/path/to/the/xerces/**lib2
> ...
> LoadModule /absolute/path/to/XercesDLL.**dll
>
> For example
>
> LoadFile E:\xerces-c-3.1.1-x86_64-**windows-vc-10.0\xerces-c-3.1.**
> 1-x86_64-windows-vc-10.0\lib\**xerces-c_3.lib and xerces-c_static_3.lib
> LoadFile E:\xerces-c-3.1.1-x86_64-**windows-vc-10.0\xerces-c-3.1.**
> 1-x86_64-windows-vc-10.0\lib\**xerces-c_3.lib and xerces-c_3.lib
> LoadModule E:\workspace\XercesDLL.dll
>
> Maybe you do not need both LoadFiles. Experiment.
>
> Sorin
>
>
Re: Apache fails to start when Xerces library is used in a C++ module
Posted by Sorin Manolache <so...@gmail.com>.
On 2013-03-31 11:06, Sindhi Sindhi wrote:
> Hello,
>
> I have written a C++ module to invoke the Xerces C++ XML library to parse a
> XML file. I'm unable to start httpd.exe with these changes. Here are the
> details -
>
> a) Apache server version: httpd-2.4.4-win64
> b) Xerces version: xerces-c-3.1.1-x86_64-windows-vc-10.0
> c) Development envt: Visual Studio 2010 with SP1
>
> Following are the settings I have made in Visual Studio so that the C++
> module refers to the Xerces library:
> 1. Additional Include Directories =
> E:\xerces-c-3.1.1-x86_64-windows-vc-10.0\xerces-c-3.1.1-x86_64-windows-vc-10.0\include
>
> 2. Additional Dependencies = xerces-c_3.lib and xerces-c_static_3.lib
>
> 3. Additional library directories =
> E:\xerces-c-3.1.1-x86_64-windows-vc-10.0\xerces-c-3.1.1-x86_64-windows-vc-10.0\lib
>
> 4. Debugging -> Environment:
> PATH=E:\xerces-c-3.1.1-x86_64-windows-vc-10.0\xerces-c-3.1.1-x86_64-windows-vc-10.0\bin
>
> 5. In the Operating System environment variables, added the path
> E:\xerces-c-3.1.1-x86_64-windows-vc-10.0\xerces-c-3.1.1-x86_64-windows-vc-10.0\bin
> to the environment variable PATH
>
> 6. The code in my C++ module to invoke the Xerces library routine goes like
> this -
>
> try {
> XMLPlatformUtils::Initialize(); // Initialize Xerces infrastructure
> }
> catch( XMLException& e ) {
> char* message = XMLString::transcode( e.getMessage() );
> XMLString::release( &message );
> }
> XMLPlatformUtils::Terminate();
>
> 7. Added the below in httpd.conf file -
> LoadModule filter_module modules/XercesDLL.dll
> AddOutputFilterByType TagFilter text/html text/plain text/css
>
> 8. If i try to launch httpd.exe from command prompt, I see the below error -
>> httpd.exe
> httpd.exe: Syntax error on line 172 of
> E:/httpd-2.4.4-win64/Apache24/conf/httpd.conf: Cannot load
> modules/XercesDLL.dll into server: The specified module could not be found.
>
> Even if I comment out the above C++ code in step 6, Apache still fails to
> start. That means Apache is failing to load the Xerces library version I'm
> using, irrespective of the way I'm invoking the library.
>
> However, If I write a standalone DLL that invokes the above Xerces library
> version, and invoke this DLL from an EXE then I'm successfully able to
> parse the XML. This means, the Xerces library fails to get loaded only by
> the Apache server for some reason.
>
> I think its got something to do with the C to C++ linkage, not sure tho.
>
> Any help is highly appreciated.
Hello,
Try
LoadFile /absolute/path/to/the/xerces/lib1
LoadFile /absolute/path/to/the/xerces/lib2
...
LoadModule /absolute/path/to/XercesDLL.dll
For example
LoadFile
E:\xerces-c-3.1.1-x86_64-windows-vc-10.0\xerces-c-3.1.1-x86_64-windows-vc-10.0\lib\xerces-c_3.lib
and xerces-c_static_3.lib
LoadFile
E:\xerces-c-3.1.1-x86_64-windows-vc-10.0\xerces-c-3.1.1-x86_64-windows-vc-10.0\lib\xerces-c_3.lib
and xerces-c_3.lib
LoadModule E:\workspace\XercesDLL.dll
Maybe you do not need both LoadFiles. Experiment.
Sorin