httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From miim <>
Subject Reference to core request fails during compile
Date Sat, 26 Jan 2019 23:45:52 GMT
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,

  core_request_config *creq_cfg;
  creq_cfg = ap_get_core_module_config(r->request_config);

  return 0;

module AP_MODULE_DECLARE_DATA test_module = {

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.)


$(OBJ): $(SRC)
        $(APXS) $(APXS_OPTS) -c $(SRC)
        @echo write '"make install"' to install module

        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â
   creq_cfg = ap_get_core_module_config(r->request_config);
src/mod_test.c:35:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
   creq_cfg = ap_get_core_module_config(r->request_config);
apxs:Error: Command failed with rc=65536
Makefile:23: recipe for target 'src/.libs/' failed
make: *** [src/.libs/] Error 1

I am not sure how this can occur. http_core.h is present in /usr/local/apache2/include and
it does include the definitions that are claimed missing by the compile.

There is a nearly identical chunk of code used in Apache itself -- q.v.

Six other modules on the same system compile without errors, though none of them use this
specific reference to the core data structures.

I am forced to believe that it is a problem in the APXS compilation, though there is so much
going on behind the scenes that I wouldn't know where to start looking.

View raw message