opentelemetry-cpp-contrib icon indicating copy to clipboard operation
opentelemetry-cpp-contrib copied to clipboard

otel_ngx_module.cpp:1:10: fatal error: opentelemetry/sdk/trace/processor.h: No such file or directory

Open zx8086 opened this issue 3 years ago • 6 comments

Describe your environment

nginx 1.20.2 Raspberry Pi 4 Bullseye Linux 5.15.33-v8+ #1540 SMP PREEMPT Mon Apr 11 13:18:30 BST 2022 aarch64 GNU/Linux

Steps to reproduce Ran ./configure --with-compat --add-dynamic-module=/home/pi/opentelemetry-cpp-contrib/instrumentation/nginx

Tail end of the log as below :

`configuring additional dynamic modules adding module in /home/pi/opentelemetry-cpp-contrib/instrumentation/nginx

  • otel_ngx_module was configured checking for PCRE library ... found checking for PCRE JIT support ... found checking for zlib library ... found creating objs/Makefile

Configuration summary

  • using system PCRE library
  • OpenSSL library is not used
  • using system zlib library

nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx modules path: "/usr/local/nginx/modules" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp"`

After ran the following:

make modules

What is the expected behavior?

Expected to see the module created

What is the actual behavior?

make -f objs/Makefile modules make[1]: Entering directory '/home/pi/nginx-1.20.2' cc -c -fPIC -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \ -o objs/addon/src/agent_config.o \ /home/pi/opentelemetry-cpp-contrib/instrumentation/nginx/src/agent_config.cpp cc -c -fPIC -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \ -o objs/addon/src/nginx_config.o \ /home/pi/opentelemetry-cpp-contrib/instrumentation/nginx/src/nginx_config.cpp cc -c -fPIC -pipe -O -W -Wall -Wpointer-arith -Wno-unused-parameter -Werror -g -I src/core -I src/event -I src/event/modules -I src/os/unix -I objs -I src/http -I src/http/modules \ -o objs/addon/src/otel_ngx_module.o \ /home/pi/opentelemetry-cpp-contrib/instrumentation/nginx/src/otel_ngx_module.cpp /home/pi/opentelemetry-cpp-contrib/instrumentation/nginx/src/otel_ngx_module.cpp:1:10: fatal error: opentelemetry/sdk/trace/processor.h: No such file or directory 1 | #include <opentelemetry/sdk/trace/processor.h> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[1]: *** [objs/Makefile:1246: objs/addon/src/otel_ngx_module.o] Error 1 make[1]: Leaving directory '/home/pi/nginx-1.20.2' make: *** [Makefile:16: modules] Error 2

Additional context Add any other context about the problem here.

zx8086 avatar Apr 15 '22 09:04 zx8086

I think you should build opentelemetry-cpp first and add the include directories and libraries by CFLAGS and LDFLAGS if you use configure but not the cmake build system in our repository.

owent avatar May 09 '22 03:05 owent

opentelemetry-cpp

Any steps / instructions on this ?

zx8086 avatar May 10 '22 11:05 zx8086

opentelemetry-cpp

Any steps / instructions on this ?

Perhaps this document may be of use to you.

rcjsuen avatar May 10 '22 12:05 rcjsuen

@rcjsuen @owent Step 5 & Incorporating into an existing CMake Project, is where i am getting stuck... where and what parameters needed to ensure the headers are installed in the right place to otel_ngx_module.cpp to pick up all the headers created via the opentelemetry-cpp instructions, which i completed without issues.

zx8086 avatar May 22 '22 09:05 zx8086

@rcjsuen @owent Step 5 & Incorporating into an existing CMake Project, is where i am getting stuck... where and what parameters needed to ensure the headers are installed in the right place to otel_ngx_module.cpp to pick up all the headers created via the opentelemetry-cpp instructions, which i completed without issues.

You should add <install_root> of opentelemetry-cpp to cmake search path when building otel_ngx_module. For example:

cd <where to build opentelemetry>
cmake --install . --prefix /opt/opentelemetry-cpp

cd <where to build otel_ngx_module>
cmake <the directory contains CMakeLists.txt of otel_ngx_module> -Dopentelemetry-cpp_ROOT=/opt/opentelemetry-cpp
# or using -DCMAKE_PREFIX_PATH=/opt/opentelemetry-cpp to replace -Dopentelemetry-cpp_ROOT=/opt/opentelemetry-cpp when using cmake 3.11 or lower
cmake --build . -j

See https://cmake.org/cmake/help/latest/command/find_package.html for details.

owent avatar May 22 '22 18:05 owent