0

编译 apache 模块时出现未知类型名称模块错误。我应该怎么办?

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

我正在尝试从 apache 编译示例代码

4

2 回答 2

1

您可能缺少一些标题。这是一个最小的模块,尝试编译它:

#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
};
于 2014-04-19T12:21:53.563 回答
0

如果您已编译 apache,您的 APXS 的位置可能会有所不同。尝试

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

PS:请记住,DSO 模块已经启用。你可以通过

apache2ctl -m
于 2016-12-08T22:39:40.137 回答