opentelemetry-cpp-contrib
opentelemetry-cpp-contrib copied to clipboard
How to build module ngx_http_opentelemetry_module for version nginx 1.20.1
I'm trying to figure out how to build ngx_http_opentelemetry_module for version nginx 1.20.1 in Centos 7 and is it possible?
From a container with Centos 7 in the downloaded archive nginx-1.20.1, I execute:
-
[root@200e088735f3 nginx-1.20.1]# ./configure --add-module=/opt/src/1.0.1/opentelemetry-cpp-contrib-webserver-v1.0.1/instrumentation/otel-webserver-module/src/nginx/ where /opt/src/1.0.1/opentelemetry-cpp-contrib-webserver-v1.0.1/instrumentation/otel-webserver-module/src/nginx/ webserver/v1.0.1 and contains files, Makefile config ngx_http_opentelemetry_log.c ngx_http_opentelemetry_log.h ngx_http_opentelemetry_module.c ngx_http_opentelemetry_module.h
-
Configure works fine, but at the make stage I get errors: /opt/src/1.0.2/opentelemetry-cpp-contrib-webserver-v1.0.2/instrumentation/otel-webserver-module/src/nginx//ngx_http_opentelemetry_module.c:1511:12: note: expected 'const char *' but argument is of type 'u_char *' /opt/src/1.0.2/opentelemetry-cpp-contrib-webserver-v1.0.2/instrumentation/otel-webserver-module/src/nginx//ngx_http_opentelemetry_module.c:1512:51: error: assignment discards 'const' qualifier from pointer target type [-Werror] req_payload->headers[count].value = (const char)(h->value).data; ^ cc1: all warnings being treated as errors make[1]: *** [objs/addon/nginx/ngx_http_opentelemetry_module.o] Error 1 make[1]: Leaving directory `/nginx-1.20.1' make: *** [build] Error 2 [root@200e088735f3 nginx-1.20.1]#
How can I build ngx_http_opentelemetry_module for the required version of nginx server?
In general I found the answer here https://github.com/open-telemetry/opentelemetry-cpp-contrib/issues/146, but it is not clear how to add the collected libraries to build a specific version of nginx
So I think I got it cmake /sdk/src/1.0.2/opentelemetry-cpp-contrib-webserver-v1.0.2/instrumentation/nginx -Dopentelemetry-cpp_ROOT=/opt/lib/ -DNGINX_VERSION=1.20.1 But the build doesn't work: cmake --build . -j [ 47%] Built target project_nginx CMakeFiles/otel_ngx_module.dir/build.make:207: *** target pattern contains no '%'. Stop. gmake[1]: *** [CMakeFiles/Makefile2:110: CMakeFiles/otel_ngx_module.dir/all] Error 2 gmake: *** [Makefile:136: all] Error 2