On Sat, Jan 26, 2019 at 6:46 PM miim <xxdpp...@yahoo.com.invalid> wrote: > > I have undefined reference errors in an Apache module. I've cut the source > code down to a minimum that reproduces the error. Below is the source for > "mod_test.c" ... > > ---------------------------------------------------------------------------- > #include "httpd.h" > #include "http_config.h" > #include "http_request.h" > #include "http_protocol.h" > #include "http_core.h" > #include "http_main.h" > #include "http_log.h" > #include "ap_mpm.h" > #include "apr_strings.h" > #include <stdio.h> > #include <stdlib.h> > #include <errno.h> > #include <string.h> > #include <sys/types.h> > #include <arpa/inet.h> > #include <netdb.h> > > module AP_MODULE_DECLARE_DATA test_module; > > static int test_handler(request_rec *r); > static int test_init(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, > server_rec *s); > > /* Structure containing state information for the module */ > > typedef struct { > } ns_mod_config; > > > static int ns_typematch(request_rec *r) { > > ns_mod_config *ns_scfg = ap_get_module_config(r->server->module_config, > &test_module); > > core_request_config *creq_cfg; > creq_cfg = ap_get_core_module_config(r->request_config); > > return 0; > } > > module AP_MODULE_DECLARE_DATA test_module = { > STANDARD20_MODULE_STUFF,NULL,NULL,NULL,NULL,NULL,NULL}; > ---------------------------------------------------------------------------- > > I am using a more-or-less standard Makefile for compiling the module (note > that the install option has been removed as this is a test to demonstrate the > problem.) > > ---------------------------------------------------------------------------- > APXS=/usr/local/apache2/bin/apxs > APXS_OPTS=-Wc, -Wc,-DDST_CLASS=3 > SRC=src/mod_test.c > OBJ=src/.libs/mod_test.so > > $(OBJ): $(SRC) > @echo > $(APXS) $(APXS_OPTS) -c $(SRC) > @echo > @echo write '"make install"' to install module > @echo > > clean: > rm -f src/.libs/* > rm -f src/*.o > rm -f src/*.lo > rm -f src/*.la > rm -f src/*.slo > rmdir src/.libs > ---------------------------------------------------------------------------- > > The compile fails as follows: > > ---------------------------------------------------------------------------- > /usr/local/apache2/bin/apxs -Wc, -Wc,-DDST_CLASS=3 -c src/mod_test.c > /usr/local/apache2/build/libtool --silent --mode=compile gcc -prefer-pic > -DLINUX -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -g -O2 -pthread > -I/usr/local/apache2/include -I/usr/local/apache2/include > -I/usr/local/apache2/include -DDST_CLASS=3 -c -o src/mod_test.lo > src/mod_test.c && touch src/mod_test.slo > src/mod_test.c: In function âns_typematchâ: > src/mod_test.c:34:3: error: unknown type name âcore_request_configâ > core_request_config *creq_cfg; > ^~~~~~~~~~~~~~~~~~~ > src/mod_test.c:35:14: warning: implicit declaration of function > âap_get_core_module_configâ [-Wimplicit-function-declaration] > creq_cfg = ap_get_core_module_config(r->request_config);
is /usr/local/apache2 Apache 2.2.x instead of 2.4.x? 2.2 is far past end of support, but: - 2.2 required modules to define CORE_PRIVATE before seeing this structure. - 2.2 also has no ap_get_core_module_config so you can't use that 2.4-ism (this is actually the 2nd error quoted above)