httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Farber <>
Subject How to link my C module against libapreq.a?
Date Mon, 30 Jan 2006 23:06:30 GMT

could someone please give me a hint,
how to use libapreq from my Apache module?

I'm using Apache 1.3.29 on OpenBSD 3.9-beta,
with the p5-libapreq-1.3 package which includes these files:


My module contains 3 files (mod_pref.c, mod_pref.h and pgsql.c
in the subdir module/) and builds and works fine using these commands:

gcc -Wall -ggdb -O0 -O2 -pipe -DDEV_RANDOM=/dev/arandom
/usr/lib/apache/include  -I /usr/local/include/postgresql -c
module/mod_pref.c -o build/mod_pref.o

gcc -Wall -ggdb -O0 -O2 -pipe -DDEV_RANDOM=/dev/arandom
/usr/lib/apache/include  -I /usr/local/include/postgresql -c
module/pgsql.c -o build/pgsql.o

gcc -shared -fPIC -DSHARED_MODULE -L /usr/local/lib -lpq
build/mod_pref.o build/pgsql.o -o

apxs -n pref -a -i

When I add however these 3 lines to my mod_pref.c:

        #include <apache_request.h>
        ApacheRequest *req = ApacheRequest_new(r);
        req->disable_uploads = 1;

And to the compile and linking commands above - corresponding:

        -I /usr/local/libdata/perl5/site_perl/i386-openbsd/auto/libapreq/include
         -L /usr/local/libdata/perl5/site_perl/i386-openbsd/auto/libapreq
-lapreq  \

then the does build, but I can't run the httpd anymore:

    laptop:afarber {862} sudo /usr/sbin/httpd -X
    /usr/sbin/httpd:/usr/lib/apache/modules/ undefined
symbol 'ApacheRequest_new'

I'm thankful for any hints as I couldn't find the solution on the web yet
nor in the WRAPMOD book I own

Is maybe the OpenBSD package wrong and a shared library is missing?

Or do I maybe need to rebuild the httpd itself and link it against libapreq.a?


PS: Here some more info from my PC:

    laptop:afarber {532} perl -MApache::libapreq -e ccopts

    laptop:afarber {533} perl -MApache::libapreq -e ldopts
    -L/usr/local/libdata/perl5/site_perl/i386-openbsd/auto/libapreq -lapreq

PPS: And here is my Makefile (I don't use "apxs -c", because I want .o files
        go into "build/" subdir and the target into the top dir)

# PostgreSQL flags
PG_CFLAGS  := -I $(shell pg_config --includedir)
PG_LDFLAGS := -L $(shell pg_config --libdir) -lpq

# Apache module flags
LIBAPREQ    = /usr/local/libdata/perl5/site_perl/i386-openbsd/auto/libapreq
AP_CFLAGS  := $(shell apxs -q CFLAGS) $(shell apxs -q CFLAGS_SHLIB) \
                -I $(shell apxs -q INCLUDEDIR) -I $(LIBAPREQ)/include
AP_LDFLAGS := $(shell apxs -q LDFLAGS_SHLIB) \
                -L $(LIBAPREQ) -lapreq $(LIBAPREQ)/libapreq.a

VPATH   = media server module java-client
MODULE  = mod_pref.c pgsql.c
        $(CC) $(AP_LDFLAGS) $(PG_LDFLAGS) $^ -o $@

$(MODOBJS): $(BUILD)/%.o: %.c mod_pref.h
        $(CC) $(CFLAGS) $(AP_CFLAGS) $(PG_CFLAGS) -c $< -o $@

View raw message