[GH-ISSUE #56] openresty support(编译失败) #171

Closed
opened 2026-03-13 16:44:21 +03:00 by kerem · 12 comments
Owner

Originally created by @gclm on GitHub (Jul 24, 2021).
Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/56

环境

  • centos8
  • openresty(nginx version: openresty/1.19.3.2)

错误信息

image

./configure: error: the ngx_http_waf_module module requires the following command to be run to generate the necessary files.

    cd /app/plugins/ngx_waf && flex flex/lexer.lex && cd /app/plugins/openresty-1.19.3.2/build/nginx-1.19.3

ERROR: failed to run command: sh ./configure --prefix=/usr/local/openresty/nginx \...

编译指令

./configure --prefix=/usr/local/openresty
--with-cc-opt='-O2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl111/include'
--with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl111/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib'
--with-cc='ccache gcc -fdiagnostics-color=always'
--with-pcre-jit
--with-stream
--with-stream_ssl_module
--with-stream_ssl_preread_module
--with-http_v2_module
--without-mail_pop3_module
--without-mail_imap_module
--without-mail_smtp_module
--with-http_stub_status_module
--with-http_realip_module
--with-http_addition_module
--with-http_auth_request_module
--with-http_secure_link_module
--with-http_random_index_module
--with-http_gzip_static_module
--with-http_sub_module
--with-http_dav_module
--with-http_flv_module
--with-http_mp4_module
--with-http_gunzip_module
--with-threads
--with-compat
--with-stream
--with-http_ssl_module
--add-dynamic-module=path/ngx_waf

Originally created by @gclm on GitHub (Jul 24, 2021). Original GitHub issue: https://github.com/ADD-SP/ngx_waf/issues/56 ## 环境 - centos8 - openresty(nginx version: openresty/1.19.3.2) ## 错误信息 ![image](https://user-images.githubusercontent.com/27618687/126863129-162e8845-f8fc-49aa-836a-6ece91fc7303.png) ```shell ./configure: error: the ngx_http_waf_module module requires the following command to be run to generate the necessary files. cd /app/plugins/ngx_waf && flex flex/lexer.lex && cd /app/plugins/openresty-1.19.3.2/build/nginx-1.19.3 ERROR: failed to run command: sh ./configure --prefix=/usr/local/openresty/nginx \... ``` ## 编译指令 ./configure --prefix=/usr/local/openresty \ --with-cc-opt='-O2 -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl111/include' \ --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl111/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib' \ --with-cc='ccache gcc -fdiagnostics-color=always' \ --with-pcre-jit \ --with-stream \ --with-stream_ssl_module \ --with-stream_ssl_preread_module \ --with-http_v2_module \ --without-mail_pop3_module \ --without-mail_imap_module \ --without-mail_smtp_module \ --with-http_stub_status_module \ --with-http_realip_module \ --with-http_addition_module \ --with-http_auth_request_module \ --with-http_secure_link_module \ --with-http_random_index_module \ --with-http_gzip_static_module \ --with-http_sub_module \ --with-http_dav_module \ --with-http_flv_module \ --with-http_mp4_module \ --with-http_gunzip_module \ --with-threads \ --with-compat \ --with-stream \ --with-http_ssl_module \ --add-dynamic-module=path/ngx_waf
kerem 2026-03-13 16:44:21 +03:00
  • closed this issue
  • added the
    timeout
    label
Author
Owner

@ADD-SP commented on GitHub (Jul 24, 2021):

关注一下报错信息,按照里面的提示做。

./configure: error: the ngx_http_waf_module module requires the following command to be run to generate the necessary files.

    cd /app/plugins/ngx_waf && flex flex/lexer.lex && cd /app/plugins/openresty-1.19.3.2/build/nginx-1.19.3
<!-- gh-comment-id:886023431 --> @ADD-SP commented on GitHub (Jul 24, 2021): 关注一下报错信息,按照里面的提示做。 ``` ./configure: error: the ngx_http_waf_module module requires the following command to be run to generate the necessary files. cd /app/plugins/ngx_waf && flex flex/lexer.lex && cd /app/plugins/openresty-1.19.3.2/build/nginx-1.19.3 ```
Author
Owner

@gclm commented on GitHub (Jul 24, 2021):

已经按照提示在做了。但是发现根本不行。我怀疑原因出现在指令上

<!-- gh-comment-id:886023545 --> @gclm commented on GitHub (Jul 24, 2021): 已经按照提示在做了。但是发现根本不行。我怀疑原因出现在指令上
Author
Owner

@gclm commented on GitHub (Jul 24, 2021):

但是目前使用这个指令可以正确编译ngx_brotli模块

<!-- gh-comment-id:886023615 --> @gclm commented on GitHub (Jul 24, 2021): 但是目前使用这个指令可以正确编译ngx_brotli模块
Author
Owner

@ADD-SP commented on GitHub (Jul 24, 2021):

cd /app/plugins/ngx_waf && flex flex/lexer.lex && cd /app/plugins/openresty-1.19.3.2/build/nginx-1.19.3

这行指令执行没有报错么?

<!-- gh-comment-id:886024408 --> @ADD-SP commented on GitHub (Jul 24, 2021): ``` cd /app/plugins/ngx_waf && flex flex/lexer.lex && cd /app/plugins/openresty-1.19.3.2/build/nginx-1.19.3 ``` 这行指令执行没有报错么?
Author
Owner

@gclm commented on GitHub (Jul 24, 2021):

没,他是只是个目录切换吧了。核心问题在编译的目录不是这个,正常指令的编译目录:/app/plugins/openresty-1.19.3.2,切换到这个目录重新输入编译指令爆同样的错误。

我个人感觉会不会这个组件不太支持openresty

<!-- gh-comment-id:886024857 --> @gclm commented on GitHub (Jul 24, 2021): 没,他是只是个目录切换吧了。核心问题在编译的目录不是这个,正常指令的编译目录:/app/plugins/openresty-1.19.3.2,切换到这个目录重新输入编译指令爆同样的错误。 我个人感觉会不会这个组件不太支持openresty
Author
Owner

@ADD-SP commented on GitHub (Jul 24, 2021):

这行指令生成了高级规则的词法分析器。检查下列的文件是否存在于模块的源码目录中。

  • inc/ngx_http_waf_module_lexer.h
  • src/ngx_http_waf_module_lexer.c

如果不存在请手动到模块的源代码目录下执行 make,然后再尝试编译。

<!-- gh-comment-id:886025220 --> @ADD-SP commented on GitHub (Jul 24, 2021): 这行指令生成了高级规则的词法分析器。检查下列的文件是否存在于模块的源码目录中。 * inc/ngx_http_waf_module_lexer.h * src/ngx_http_waf_module_lexer.c 如果不存在请手动到模块的源代码目录下执行 `make`,然后再尝试编译。
Author
Owner

@gclm commented on GitHub (Jul 24, 2021):

好的。我在研究一下

<!-- gh-comment-id:886025473 --> @gclm commented on GitHub (Jul 24, 2021): 好的。我在研究一下
Author
Owner

@ADD-SP commented on GitHub (Jul 24, 2021):

@gclm 问题解决了么?如果解决了请关闭本 issue,反之麻烦给出一些错误信息,如命令行的报错信息等。

<!-- gh-comment-id:886036453 --> @ADD-SP commented on GitHub (Jul 24, 2021): @gclm 问题解决了么?如果解决了请关闭本 issue,反之麻烦给出一些错误信息,如命令行的报错信息等。
Author
Owner

@gclm commented on GitHub (Jul 24, 2021):

没,同样的错误。

<!-- gh-comment-id:886038902 --> @gclm commented on GitHub (Jul 24, 2021): 没,同样的错误。
Author
Owner

@gclm commented on GitHub (Jul 24, 2021):

现在有点事打算明天再仔细研究一下。看怎么搞

<!-- gh-comment-id:886038947 --> @gclm commented on GitHub (Jul 24, 2021): 现在有点事打算明天再仔细研究一下。看怎么搞
Author
Owner

@gclm commented on GitHub (Jul 25, 2021):

截止20210725问题还没有解决。@ADD-SP 你看是直接关闭还是。

<!-- gh-comment-id:886169422 --> @gclm commented on GitHub (Jul 25, 2021): 截止20210725问题还没有解决。@ADD-SP 你看是直接关闭还是。
Author
Owner

@ADD-SP commented on GitHub (Jul 25, 2021):

@gclm 我本地使用相同版本的 openresty 并使用相同的参数可以编译完成,怀疑是 config 文件有问题。尝试删除模块源码目录下的 config 文件中的下列内容,并在模块源码目录下执行 make,然后重新尝试编译。

github.com/ADD-SP/ngx_waf@4e960b37c9/config (L92-L115)

<!-- gh-comment-id:886182469 --> @ADD-SP commented on GitHub (Jul 25, 2021): @gclm 我本地使用相同版本的 openresty 并使用相同的参数可以编译完成,怀疑是 `config` 文件有问题。尝试删除模块源码目录下的 `config` 文件中的下列内容,并在模块源码目录下执行 `make`,然后重新尝试编译。 https://github.com/ADD-SP/ngx_waf/blob/4e960b37c9c8f40a5dd11267761758019b3812fb/config#L92-L115
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ngx_waf#171
No description provided.