The problem is solved with the fix /usr/local/apache2/bin/apxs -c -L /usr/local/lib -l apreq2 mod_maquette.c The symbol apreq_params_as_string is now resolved.
But there is another unresolved symbol now : apreq_handle_apache2. I figured out that this function is declared in the file apreq_module_apache2.h but including it doesn't resolve the linking problem. It seems weird, I thought that this symbol would be in the same lib than apreq_params_as_string... 2010/2/16 Sorin Manolache <sor...@gmail.com> > 2010/2/16 Frédéric Laurendeau <frederic.laurend...@gmail.com>: > > Thanks for your help ! > > I tried it but it doesn't work, I get the following errors. > > > > /usr/local/apache2//build/libtool --silent --mode=compile gcc -prefer-pic > > -DAP_HAVE_DESIGNATED_INITIALIZER -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -g > > -O2 -pthread > > -I/usr/local/apache2//include -I/usr/local/apache2//include > > -I/usr/local/apache2//include -c -o mod_maquette.lo mod_maquette.c && > > touch mod_maquette.slo > > > > mod_maquette.c: In function `maquette_handler': > > mod_maquette.c:21: warning: initialization makes pointer from integer > > without a cast > > > > /usr/local/apache2//build/libtool --silent --mode=link gcc -o > > mod_maquette.la -lapreq2 -rpath /usr/local/apache2//modules -module > > -avoid-version mod_maquette.lo > > /usr/bin/ld: cannot find -lapreq2 > > Search libapreq2.so on your disk. Assuming it is located in > /usr/local/lib/libapreq2.so you write > > /usr/local/apache2/bin/apxs -c -L /usr/local/lib -l apreq2 mod_maquette.c > > Check also that the lib is called libapreq2.so on your system. Maybe > it is libapreq.so (without the '2'). Adapt your command line > accordingly. > > S > > > collect2: ld returned 1 exit status > > apxs:Error: Command failed with rc=65536 > > . > > /usr/local/apache2//build/instdso.sh > > SH_LIBTOOL='/usr/local/apache2//build/libtool' > > mod_maquette.la/usr/local/apache2//modules > > /usr/local/apache2//build/libtool --mode=install cp > > mod_maquette.la/usr/local/apache2//modules/ > > cp .libs/mod_maquette.so /usr/local/apache2//modules/mod_maquette.so > > cp: cannot stat `.libs/mod_maquette.so': No such file or directory > > apxs:Error: Command failed with rc=65536 > > > > 2010/2/16 Sorin Manolache <sor...@gmail.com> > > > >> 2010/2/16 Frédéric Laurendeau <frederic.laurend...@gmail.com>: > >> > Hi, > >> > > >> > I am trying to write a module which will get the request body, process > it > >> > and write generated content in the response. > >> > I have seen that some of you used aprec to get the request body but I > >> just > >> > cannot manage to build my module with it. I'm using apxs to build my > >> module > >> > and after the build, there is an error when trying to start apache2 > with > >> my > >> > module: "Cannot load mod_maquette.so into server: undefined symbol: > >> > apreq_params_as_string" > >> > > >> > I put at the bottom of the mail my source code and my build script, > maybe > >> I > >> > forgot to include some headers in the source or some libraries in the > >> build > >> > command line ? > >> > > >> > I don't really understand how all of this works but aprec seems very > >> > powerfull and I'd like to find some tutorials or examples on how to > build > >> > modules with it. > >> > > >> > Thanks for your help. > >> > > >> > Frederic > >> > > >> > Build script : > >> > /usr/local/apache2/bin/apxs -c mod_maquette.c > >> > >> Try > >> > >> /usr/local/apache2/bin/apxs -c -l apreq2 mod_maquette.c > >> > >> > /usr/local/apache2/bin/apxs -i -a -n maquette mod_maquette.la > >> > > >> > > >> > Source code mod_maquette.c: > >> > #include <stdlib.h> > >> > #include <math.h> > >> > #include <string.h> > >> > #include "httpd.h" > >> > #include "http_connection.h" > >> > #include "http_config.h" > >> > #include "http_core.h" > >> > #include "http_log.h" > >> > #include "http_protocol.h" > >> > #include "ap_config.h" > >> > #include "http_request.h" > >> > #include "apr.h" > >> > #include "apr_strings.h" > >> > #include "apr_lib.h" > >> > #include "apreq2/apreq_module.h" > >> > #include "apreq2/apreq_param.h" > >> > > >> > static int maquette_handler(request_rec *r) > >> > { > >> > const apr_table_t* args; > >> > apreq_handle_t* h = apreq_handle_apache2(r); > >> > apreq_body(h, &args); > >> > const char *params = apreq_params_as_string(r->pool, args, NULL, > >> > APREQ_JOIN_QUOTE); > >> > > >> > fprintf(stderr, "=====TEST=====\n%s\n======TEST=====\n", params ); > >> > ap_rprintf(r, "Request data read : %s\n", params); > >> > fflush(stderr); > >> > return DONE; > >> > } > >> > > >> > static void register_hooks(apr_pool_t *p) > >> > { > >> > ap_hook_handler(maquette_handler, NULL, NULL, APR_HOOK_MIDDLE); > >> > } > >> > > >> > module AP_MODULE_DECLARE_DATA maquette_module = > >> > { > >> > STANDARD20_MODULE_STUFF, > >> > NULL, /* dir config creater */ > >> > NULL, /* dir merger --- default is to override */ > >> > NULL, /* server config */ > >> > NULL, /* merge server configs */ > >> > NULL, /* command apr_table_t */ > >> > register_hooks, /* register hooks */ > >> > }; > >> > > >> > >> > >> > >> -- > >> A: Because it reverses the logical flow of conversation. > >> Q: Why is top-posting frowned upon? > >> A: Top-posting. > >> Q: What is the most annoying thing in e-mail? > >> > > > > > > -- > A: Because it reverses the logical flow of conversation. > Q: Why is top-posting frowned upon? > A: Top-posting. > Q: What is the most annoying thing in e-mail? >