Sujit Maharjan
Sujit Maharjan

Reputation: 179

error while compile apache module

I am getting unknown type name module error when compiling apache module. What should I do?

sujit@sujit-pc:~/apachemodule$ apxs2 -c -i -a example_module.c
/usr/share/apr-1.0/build/libtool --silent --mode=compile --tag=disable-static x86_64-linux- gnu-gcc -prefer-pic -DLINUX=2 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D_REENTRANT -I/usr/include/apr-1.0 -I/usr/include/openssl -I/usr/include/xmltok -pthread     -I/usr/include/apache2  -I/usr/include/apr-1.0   -I/usr/include/apr-1.0   -c -o example_module.lo example_module.c && touch example_module.slo
example_module.c:13:1: error: unknown type name 'module'
example_module.c:15:5: error: 'STANDARD20_MODULE_STUFF' undeclared here (not in a function)
example_module.c:16:5: warning: excess elements in scalar initializer [enabled by    default]
example_module.c:16:5: warning: (near initialization for 'example_module') [enabled by default]
example_module.c:17:5: warning: excess elements in scalar initializer [enabled by default]
example_module.c:17:5: warning: (near initialization for 'example_module') [enabled by default]
example_module.c:18:5: warning: excess elements in scalar initializer [enabled by default]
example_module.c:18:5: warning: (near initialization for 'example_module') [enabled by default]
example_module.c:19:5: warning: excess elements in scalar initializer [enabled by default]
example_module.c:19:5: warning: (near initialization for 'example_module') [enabled by default]
example_module.c:20:5: warning: excess elements in scalar initializer [enabled by default]
example_module.c:20:5: warning: (near initialization for 'example_module') [enabled by default]
example_module.c:22:1: warning: excess elements in scalar initializer [enabled by default]
example_module.c:22:1: warning: (near initialization for 'example_module') [enabled by default]
apxs:Error: Command failed with rc=65536

I am trying to compile example code from apache

Upvotes: 0

Views: 1791

Answers (2)

Nitigya Sharma
Nitigya Sharma

Reputation: 63

If you have compiled apache, location of your APXS may differ. try

APXS=/usr/local/apache2/bin/apxs ./configure
make
make install

PS : Remember that DSO module is enable already. you can check that via

apache2ctl -m

Upvotes: 0

ArtemGr
ArtemGr

Reputation: 12547

You're probably missing some headers. Here's a minimal module, try to compile it:

#include <httpd.h>
#include <http_config.h>

module example_module;

static void example_hooks (apr_pool_t *pool) {
}

module example_module = {
  STANDARD20_MODULE_STUFF,
  NULL,
  NULL,
  NULL,
  NULL,
  NULL,
  example_hooks
};

Upvotes: 1

Related Questions