F-Stack / f-stack

F-Stack is an user space network development kit with high performance based on DPDK, FreeBSD TCP/IP stack and coroutine API.
http://www.f-stack.org
Other
3.81k stars 887 forks source link

Issue to compile nginx-nx with lua-nginx-module #503

Open amdei opened 4 years ago

amdei commented 4 years ago

Similar to #278, but I can't read Chinese... :-(

Debian 10.3 x64
# uname -a
Linux fire2-deb 4.19.16 #2 SMP Thu Oct 31 16:26:17 MSK 2019 x86_64 GNU/Linux
nginx-nx 1.16.1 (nginx with f-stack)
ngx_devel_kit v0.3.1
lua-nginx-module v0.10.15 tag
OpenResty not used.

NGINX configuration script:

export LUAJIT_INC=/usr/local/lib/luajit/include/luajit-2.1/
export LUAJIT_LIB=/usr/local/lib/luajit/lib/

./configure \
  --with-cc-opt="-fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2" \
  --with-ld-opt='-Wl,-z,relro -Wl,--as-needed' \
  --prefix=/opt/nginx \
  --conf-path=/etc/opt/nginx/nginx.conf \
  --error-log-path=/var/log/nginx/error.log \
  --http-log-path=/var/log/nginx/access.log \
  --lock-path=/var/run/lock/nginx.lock \
  --pid-path=/var/run/nginx.pid \
  --with-pcre=../ngx-libs/pcre-8.44 --with-pcre-jit \
  --with-zlib=../ngx-libs/zlib-1.2.11 \
  --with-debug \
  --with-stream \
  --with-stream_ssl_module \
  --with-http_ssl_module \
  --with-http_v2_module \
  --with-ff_module \
  --with-openssl=../ngx-libs/openssl-1.1.1f/ \
  --with-openssl-opt="no-gost no-comp no-dtls" \
  --with-ld-opt="-Wl,-rpath,/usr/local/luajit/lib/" \
  --add-module=../3rd-party-ngx-modules/ngx_devel_kit \
  --add-module=../3rd-party-ngx-modules/lua-nginx-module

When compiling after configuration above I got:

        ../3rd-party-ngx-modules/lua-nginx-module/src/ngx_http_lua_socket_udp.c
../3rd-party-ngx-modules/lua-nginx-module/src/ngx_http_lua_socket_udp.c: In function ‘ngx_http_lua_udp_connect’:
../3rd-party-ngx-modules/lua-nginx-module/src/ngx_http_lua_socket_udp.c:1487:9: error: the address of ‘ngx_add_event’ will always evaluate as ‘true’ [-Werror=address]
     if (ngx_add_event) {
         ^~~~~~~~~~~~~

Expected result: code being compiled.

Reason: With NGX_HAVE_FSTACK defined, ngx_add_event being declared as function instead of macro: #define ngx_add_event ngx_event_actions.add

Solution: ??

jfb8856606 commented 4 years ago

You should modify the lua module code, refer ngx_ff_host_event_module.c and ngx_ff_module.c