【问题标题】:error while compile apache module编译apache模块时出错
【发布时间】:2014-02-10 10:49:27
【问题描述】:

编译 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 编译示例代码

【问题讨论】:

    标签: apache apache-modules


    【解决方案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
    };
    

    【讨论】:

      【解决方案2】:

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

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

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

      进行检查
      apache2ctl -m
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2014-10-12
        • 1970-01-01
        • 2020-03-19
        • 2012-05-11
        • 2018-06-14
        • 1970-01-01
        • 2021-08-21
        • 1970-01-01
        相关资源
        最近更新 更多