Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build module ngx_http_opentelemetry_module for version nginx 1.20.1 #525

Open
Ilyin-V-V opened this issue Feb 4, 2025 · 2 comments
Labels
Webserver This represents the otel-webserver-module in the instrumentation directory

Comments

@Ilyin-V-V
Copy link

Ilyin-V-V commented Feb 4, 2025

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:

  1. [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

  2. 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?

err.log

@Ilyin-V-V Ilyin-V-V added the Webserver This represents the otel-webserver-module in the instrumentation directory label Feb 4, 2025
@Ilyin-V-V
Copy link
Author

In general I found the answer here #146, but it is not clear how to add the collected libraries to build a specific version of nginx

@Ilyin-V-V
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Webserver This represents the otel-webserver-module in the instrumentation directory
Projects
None yet
Development

No branches or pull requests

1 participant