You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Hugo Kotsubo <hu...@tendencies.com.br> on 2003/12/03 19:19:23 UTC
segmentation fault while writing apache modules using xerces
Hi
I'm writting an apache module that uses xerces for process form data and
build xml files with this data.
I wrote the module in C++, compiled, installed with apxs, restarted the
httpd server and everything is fine.
But when the module runs, I've got a segmentation fault. After debbuging
I discovered that the segfault occurs
when I try to create a XercesDOMParser object with operator new!!!
If I don't include the line:
XercesDOMParser *parser = new XercesDOMParser();
everything works fine, unless there's another line with the new operator.
Maybe apache can't create the c++ object, but I don't know the reason..
Some help would be apreciated..
thanks
----------------------------------------------
Hugo Kotsubo - hugo@tendencies.com.br
----------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: segmentation fault while writing apache modules using xerces
Posted by Hugo Kotsubo <hu...@tendencies.com.br>.
Hi
I tried it and it worked well..
tks!
Hugo
david_n_bertoni@us.ibm.com wrote:
>
>
>Have you called the static initialization routine?
>
>See XMLPlatformUtils::Initialize() and XMLPlatformUtils::Terminate() for
>more information. This is well documented.
>
>Dave
>
>
>
>
> Hugo Kotsubo
> <hugo@tendencies To: xerces-c-dev@xml.apache.org
> .com.br> cc: (bcc: David N Bertoni/Cambridge/IBM)
> Subject: Re: segmentation fault while writing apache modules using xerces
> 12/04/2003 10:48
> AM
> Please respond
> to xerces-c-dev
>
>
>
>
>Hi!
>
>I guess the problem is not on the apache module.
>I've just made a program with parts of module code that uses xerces tools
>and
>the program also crashes..
>
>I've got a segfault when I try to create a parser with new operator:
>
> XercesDOMParser *parser = new XercesDOMParser;
>
>Why my program is crashing in that line??
>
>The strange is, DOMPrint example uses XercesDOMParser, and creates an
>instance the same way I'm trying, but the example doesn't crashes..
>What am I doing wrong?
>
>tks
>Hugo
>
>Hugo Kotsubo wrote:
> Hi!
>
> Scott, thanks for your help.
>
> Well, all modules in my httpd server are using the same version of
> libstdc++
> So, I still don't know what is happening..
>
> Any clues?
>
> tks
> Hugo
>
>
> Scott Cantor wrote:
> I'm compiling the module with g++ and installing with
> 'apxs -i'
>
>
> I would skip the apxs stuff until you have it working. But as
> long as you're
> linking with g++, my guess is the crash is from two versions of
> libstdc++
> getting loaded into Apache by different modules.
>
> -- Scott
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail:
> xerces-c-dev-help@xml.apache.org
>
>
>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: segmentation fault while writing apache modules using xerces
Posted by da...@us.ibm.com.
Have you called the static initialization routine?
See XMLPlatformUtils::Initialize() and XMLPlatformUtils::Terminate() for
more information. This is well documented.
Dave
Hugo Kotsubo
<hugo@tendencies To: xerces-c-dev@xml.apache.org
.com.br> cc: (bcc: David N Bertoni/Cambridge/IBM)
Subject: Re: segmentation fault while writing apache modules using xerces
12/04/2003 10:48
AM
Please respond
to xerces-c-dev
Hi!
I guess the problem is not on the apache module.
I've just made a program with parts of module code that uses xerces tools
and
the program also crashes..
I've got a segfault when I try to create a parser with new operator:
XercesDOMParser *parser = new XercesDOMParser;
Why my program is crashing in that line??
The strange is, DOMPrint example uses XercesDOMParser, and creates an
instance the same way I'm trying, but the example doesn't crashes..
What am I doing wrong?
tks
Hugo
Hugo Kotsubo wrote:
Hi!
Scott, thanks for your help.
Well, all modules in my httpd server are using the same version of
libstdc++
So, I still don't know what is happening..
Any clues?
tks
Hugo
Scott Cantor wrote:
I'm compiling the module with g++ and installing with
'apxs -i'
I would skip the apxs stuff until you have it working. But as
long as you're
linking with g++, my guess is the crash is from two versions of
libstdc++
getting loaded into Apache by different modules.
-- Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail:
xerces-c-dev-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: segmentation fault while writing apache modules using xerces
Posted by Hugo Kotsubo <hu...@tendencies.com.br>.
Hi
Oh, I forgot to call it..
tks
Hugo
Peter Guyatt wrote:
> Hi There,
>
> Just a really stupid question are you using the
> XMLPlatformUtils::Initialize(); method
>
> Thanks
>
> Pete
>
> -----Original Message-----
> From: Hugo Kotsubo [mailto:hugo@tendencies.com.br]
> Sent: 04 December 2003 18:48
> To: xerces-c-dev@xml.apache.org
> Subject: Re: segmentation fault while writing apache modules using xerces
>
> Hi!
>
> I guess the problem is not on the apache module.
> I've just made a program with parts of module code that uses
> xerces tools and
> the program also crashes..
>
> I've got a segfault when I try to create a parser with new operator:
>
> XercesDOMParser *parser = new XercesDOMParser;
>
> Why my program is crashing in that line??
>
> The strange is, DOMPrint example uses XercesDOMParser, and creates
> an instance the same way I'm trying, but the example doesn't crashes..
> What am I doing wrong?
>
> tks
> Hugo
>
> Hugo Kotsubo wrote:
>
>> Hi!
>>
>> Scott, thanks for your help.
>>
>> Well, all modules in my httpd server are using the same version
>> of libstdc++
>> So, I still don't know what is happening..
>>
>> Any clues?
>>
>> tks
>> Hugo
>>
>>
>> Scott Cantor wrote:
>>
>>>>I'm compiling the module with g++ and installing with 'apxs -i'
>>>>
>>>>
>>>
>>>I would skip the apxs stuff until you have it working. But as long as you're
>>>linking with g++, my guess is the crash is from two versions of libstdc++
>>>getting loaded into Apache by different modules.
>>>
>>>-- Scott
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>>>For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>>>
>>>
>>>
>>>
RE: segmentation fault while writing apache modules using xerces
Posted by Peter Guyatt <pg...@telesoft-technologies.com>.
Hi There,
Just a really stupid question are you using the
XMLPlatformUtils::Initialize(); method
Thanks
Pete
-----Original Message-----
From: Hugo Kotsubo [mailto:hugo@tendencies.com.br]
Sent: 04 December 2003 18:48
To: xerces-c-dev@xml.apache.org
Subject: Re: segmentation fault while writing apache modules using xerces
Hi!
I guess the problem is not on the apache module.
I've just made a program with parts of module code that uses xerces tools
and
the program also crashes..
I've got a segfault when I try to create a parser with new operator:
XercesDOMParser *parser = new XercesDOMParser;
Why my program is crashing in that line??
The strange is, DOMPrint example uses XercesDOMParser, and creates an
instance the same way I'm trying, but the example doesn't crashes..
What am I doing wrong?
tks
Hugo
Hugo Kotsubo wrote:
Hi!
Scott, thanks for your help.
Well, all modules in my httpd server are using the same version of
libstdc++
So, I still don't know what is happening..
Any clues?
tks
Hugo
Scott Cantor wrote:
I'm compiling the module with g++ and installing with 'apxs -i'
I would skip the apxs stuff until you have it working. But as long as you're
linking with g++, my guess is the crash is from two versions of libstdc++
getting loaded into Apache by different modules.
-- Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: segmentation fault while writing apache modules using xerces
Posted by Hugo Kotsubo <hu...@tendencies.com.br>.
Hi!
I guess the problem is not on the apache module.
I've just made a program with parts of module code that uses xerces
tools and
the program also crashes..
I've got a segfault when I try to create a parser with new operator:
XercesDOMParser *parser = new XercesDOMParser;
Why my program is crashing in that line??
The strange is, DOMPrint example uses XercesDOMParser, and creates an
instance the same way I'm trying, but the example doesn't crashes..
What am I doing wrong?
tks
Hugo
Hugo Kotsubo wrote:
> Hi!
>
> Scott, thanks for your help.
>
> Well, all modules in my httpd server are using the same version of
> libstdc++
> So, I still don't know what is happening..
>
> Any clues?
>
> tks
> Hugo
>
>
> Scott Cantor wrote:
>
>>>I'm compiling the module with g++ and installing with 'apxs -i'
>>>
>>>
>>
>>I would skip the apxs stuff until you have it working. But as long as you're
>>linking with g++, my guess is the crash is from two versions of libstdc++
>>getting loaded into Apache by different modules.
>>
>>-- Scott
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>>For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>>
>>
>>
>>
>>
>
Re: segmentation fault while writing apache modules using xerces
Posted by Hugo Kotsubo <hu...@tendencies.com.br>.
Hi!
Scott, thanks for your help.
Well, all modules in my httpd server are using the same version of libstdc++
So, I still don't know what is happening..
Any clues?
tks
Hugo
Scott Cantor wrote:
>>I'm compiling the module with g++ and installing with 'apxs -i'
>>
>>
>
>I would skip the apxs stuff until you have it working. But as long as you're
>linking with g++, my guess is the crash is from two versions of libstdc++
>getting loaded into Apache by different modules.
>
>-- Scott
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
>
>
>
RE: segmentation fault while writing apache modules using xerces
Posted by Scott Cantor <ca...@osu.edu>.
> I'm compiling the module with g++ and installing with 'apxs -i'
I would skip the apxs stuff until you have it working. But as long as you're
linking with g++, my guess is the crash is from two versions of libstdc++
getting loaded into Apache by different modules.
-- Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
Re: segmentation fault while writing apache modules using xerces
Posted by Hugo Kotsubo <hu...@tendencies.com.br>.
I'm compiling the module with g++ and installing with 'apxs -i'
Here's the Makefile:
######################################################################
# the used tools
APXS=apxs
APACHECTL=apachectl
# Get all of apxs's internal values.
APXS_CC=`$(APXS) -q CC`
APXS_TARGET=`$(APXS) -q TARGET`
APXS_CFLAGS=`$(APXS) -q CFLAGS`
APXS_SBINDIR=`$(APXS) -q SBINDIR`
APXS_CFLAGS_SHLIB=`$(APXS) -q CFLAGS_SHLIB`
APXS_INCLUDEDIR=`$(APXS) -q INCLUDEDIR`
APXS_LD_SHLIB=`$(APXS) -q LD_SHLIB`
APXS_LIBEXECDIR=`$(APXS) -q LIBEXECDIR`
APXS_LDFLAGS_SHLIB=`$(APXS) -q LDFLAGS_SHLIB`
APXS_SYSCONFDIR=`$(APXS) -q SYSCONFDIR`
APXS_LIBS_SHLIB=`$(APXS) -q LIBS_SHLIB`
CFLAGS=-g -O2 -pthread -Wno-deprecated
DEFINES=-DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE
-D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER
INCLUDES=-I/root/httpd-2.0.47/srclib/apr/include
-I/root/httpd-2.0.47/srclib/apr-util/include -I. -I/usr/local/apache/include
LIBS=-L/usr/local/lib -lxerces-c
# the default target
all: mod_hello.so
# compile the shared object file. use g++ instead of letting apxs call
# ld so we end up with the right c++ stuff. We do this in two steps,
# compile and link.
# compile
mod_hello.o: mod_hello.cc mod_hello.h
g++ -c -fPIC $(CFLAGS) $(DEFINES) $(INCLUDES) -Wall -o $@ $<
# link
mod_hello.so: mod_hello.o
g++ -fPIC -shared -o $@ $< $(APXS_LIBS_SHLIB) $(CFLAGS) $(DEFINES)
$(INCLUDES) $(LIBS)
# install the shared object file into Apache
install: all
$(APXS) -i -n 'hello' mod_hello.so
# display the apxs variables
check_apxs_vars:
@echo APXS_CC $(APXS_CC);\
echo APXS_TARGET $(APXS_TARGET);\
echo APXS_CFLAGS $(APXS_CFLAGS);\
echo APXS_SBINDIR $(APXS_SBINDIR);\
echo APXS_CFLAGS_SHLIB $(APXS_CFLAGS_SHLIB);\
echo APXS_INCLUDEDIR $(APXS_INCLUDEDIR);\
echo APXS_LD_SHLIB $(APXS_LD_SHLIB);\
echo APXS_LIBEXECDIR $(APXS_LIBEXECDIR);\
echo APXS_LDFLAGS_SHLIB $(APXS_LDFLAGS_SHLIB);\
echo APXS_SYSCONFDIR $(APXS_SYSCONFDIR);\
echo APXS_LIBS_SHLIB $(APXS_LIBS_SHLIB)
# cleanup
clean:
-rm -f *.so *.o *~
# install and activate shared object by reloading Apache to
# force a reload of the shared object file
reload: install restart
# the general Apache start/restart/stop
# procedures
start:
$(APACHECTL) start
restart: stop start
stop:
$(APACHECTL) stop
tks
Hugo
Scott Cantor wrote:
>How are you linking your module, and are there any other modules being
>loaded that use C++ that are built with an older libstdc++? The latter will
>cause the behavior you're seeing.
>
>mod_php is a common culprit, since it uses C++.
>
>-- Scott
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
RE: segmentation fault while writing apache modules using xerces
Posted by Scott Cantor <ca...@osu.edu>.
How are you linking your module, and are there any other modules being
loaded that use C++ that are built with an older libstdc++? The latter will
cause the behavior you're seeing.
mod_php is a common culprit, since it uses C++.
-- Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org