0

I just use GoogleTest to write a unit test for ngx_hello_world module. Then I'd like to compile this test file and during this process, I compile the nginx source code I need and make them into a static library to link. Then I encounter this problem, can anybody give me some advices on it?

CMakeFiles/test_sult.dir/ngx_http_hello_world_test.cc.o: In function `ngx_http_hello_world_handler(ngx_http_request_s*)':
/googletest/ias-nginx/third-modules/ngx_http_hello_world-master/src/ngx_http_hello_world_module.c:67: undefined reference to `ngx_pcalloc(ngx_pool_s*, unsigned long)'
/googletest/ias-nginx/third-modules/ngx_http_hello_world-master/src/ngx_http_hello_world_module.c:82: undefined reference to `ngx_http_send_header(ngx_http_request_s*)'
/googletest/ias-nginx/third-modules/ngx_http_hello_world-master/src/ngx_http_hello_world_module.c:87: undefined reference to `ngx_http_output_filter(ngx_http_request_s*, ngx_chain_s*)'
CMakeFiles/test_sult.dir/ngx_http_hello_world_test.cc.o: In function `__static_initialization_and_destruction_0(int, int)':
/googletest/ias-nginx/third-modules/ngx_http_hello_world-master/test/ngx_http_hello_world_test.cc:11: undefined reference to `ngx_create_pool(unsigned long, ngx_log_s*)'
../lib/lib_core.a(nginx.o): In function `ngx_load_module':
/root/nginx-1.16.1/src/core/nginx.c:1523: undefined reference to `dlopen'
/root/nginx-1.16.1/src/core/nginx.c:1534: undefined reference to `dlsym'
/root/nginx-1.16.1/src/core/nginx.c:1542: undefined reference to `dlsym'
/root/nginx-1.16.1/src/core/nginx.c:1550: undefined reference to `dlsym'
../lib/lib_core.a(nginx.o): In function `ngx_unload_module':
/root/nginx-1.16.1/src/core/nginx.c:1584: undefined reference to `dlclose'
../lib/lib_core.a(ngx_module.o): In function `ngx_preinit_modules':
/root/nginx-1.16.1/src/core/ngx_module.c:30: undefined reference to `ngx_modules'
/root/nginx-1.16.1/src/core/ngx_module.c:32: undefined reference to `ngx_modules'
/root/nginx-1.16.1/src/core/ngx_module.c:32: undefined reference to `ngx_module_names'
/root/nginx-1.16.1/src/core/ngx_module.c:30: undefined reference to `ngx_modules'
../lib/lib_core.a(ngx_module.o): In function `ngx_cycle_modules':
/root/nginx-1.16.1/src/core/ngx_module.c:56: undefined reference to `ngx_modules'
Tsyvarev
  • 52,146
  • 16
  • 84
  • 120

0 Answers0