c++ dynamic module fails to load
astre
nginx-forum at forum.nginx.org
Tue Sep 24 09:05:59 UTC 2019
Hi All,
I have a C++ module developed for apache HTTP which now Im trying to port to
Nginx. For this I started reading about creating dynamic modules and
specifically c++. I already found ngx_cpp_test_module.cpp in the source and
able to compile it. I extended it a little and wrote a hello world program
which compiles fine but when I restart Nginx I get following error:
[build at 8e269df38d20 nginx-1.16.1]$ sudo /usr/sbin/nginx -t
nginx: [emerg] dlopen() "/etc/nginx/modules/ngx_http_cpp_hello_module.so"
failed (/etc/nginx/modules/ngx_http_cpp_hello_module.so: undefined symbol:
ngx_http_cpp_hello_module) in /etc/nginx/nginx.conf:2
I have configured it as follows:
./configure --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
-grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-lstdc++
-lrt -Wl,-z,relro -Wl,-z,now -fPIC' --prefix=/home/build
--add-dynamic-module=/mnt/src/hello-world-cpp --with-threads
The config:
ngx_addon_name=ngx_http_cpp_hello_module
if test -n "$ngx_module_link"; then
ngx_module_type=HTTP
ngx_module_name=$ngx_addon_name
ngx_module_srcs="$ngx_addon_dir/ngx_http_cpp_hello_world_module.cpp"
. auto/module
else
HTTP_MODULES="$HTTP_MODULES ngx_http_hello_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS
$ngx_addon_dir/ngx_http_cpp_hello_world_module.cpp"
fi
As per the error "undefined symbol: ngx_http_cpp_hello_module" Im trying to
understand why it is trying to find that function in the code.
Is there something that I'm missing during configuring or compilation
process?
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,285679,285679#msg-285679
More information about the nginx
mailing list