httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sorin Manolache <>
Subject Re: How to compiling/link/use Apache module that uses shared library?
Date Thu, 21 Jun 2012 20:32:55 GMT
On 2012-06-21 22:04, wrote:
> ---- Ben Noordhuis <> wrote:
>> On Thu, Jun 21, 2012 at 8:43 PM,  <> wrote:
>>> I tried that, which allowed me to start Apache, but am getting a segfault.
>> Run it through gdb and inspect the backtrace. Compiling with debug
>> symbols and optimizations disabled (-g -O0) will help.
> Sorin,
> The apxs already has "-g" and "-O2" looks like.  How do I change that to "-O0"?  Or,
do I just run the gcc compile manually?

Try adding

-Wc,-O0 -Wc,-g -Wc,-fno-inline -Wl,-g

to your apxs command line.

> Also how do I "run it through gdb", since apachectl is a script?

You don't run apachectl, you run the apache binary.


Then in gdb type:
file /path/to/your/httpd_or_apache2
set args -d /path/to/your/server_root_dir -f /path/to/your/conf/file -X

If apachectl sets some environment variables first, which are then used 
in the conf file (as in the standard debian installation) then you'll 
have to set them manually in gdb, e.g.

set environment APACHE_RUN_USER www-data
set environment APACHE_RUN_GROUP www-data

Last, type


For example, on my debian I'd do

file /usr/sbin/apache2
set args -d /etc/apache2 -f /etc/apache2/apache2.conf -X
And a couple of set environments and then run.


> Sorry for the questions, but not too familiar with this stuff :(...
> Jim

View raw message