open-telemetry / open-telemetry/opentelemetry-cpp-contrib

Can not build on Alpine 3.18 with Nginx 1.24.0 stable verison

Open
#318 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
153
Forks
184
Avg merge
2d 9h
Merged PRs (30d)
26

Description

Describe your environment

nginx: 1.24.0
Alpine Linux: 3.18
docker: 24.0.5

Steps to reproduce

Run a demo with docker container:

docker container run --rm -it alpine:3.18 /bin/sh

Install depend and build opentelemetry-cpp first.

mkdir /src
cd /src
apk add --no-cache gtest-dev benchmark-dev
apk add --no-cache build-base cmake perl git mercurial linux-headers pkgconfig
git clone --recurse-submodules https://github.com/open-telemetry/opentelemetry-cpp
cd opentelemetry-cpp/
mkdir build
cd build
cmake ..
cmake --build . --target all
ctest
cmake --install .

This part content according to the website Building opentelemetry-cpp.

Then we can get the nginx source code and build the nginx ext.

NGINX_VERSION=1.24.0
set -x \
&& cd /src \
&& apk add --no-cache pcre2-dev openssl-dev \
&& hg clone https://hg.nginx.org/nginx \
&& git clone https://github.com/open-telemetry/opentelemetry-cpp-contrib.git \
&& cd /src/nginx \
&& hg up release-$NGINX_VERSION \
&& auto/configure \
    --prefix=/etc/nginx \
	--sbin-path=/usr/sbin/nginx \
	--modules-path=/usr/lib/nginx/modules \
	--conf-path=/etc/nginx/nginx.conf \
	--error-log-path=/var/log/nginx/error.log \
	--http-log-path=/var/log/nginx/access.log \
	--pid-path=/var/run/nginx.pid \
	--lock-path=/var/run/nginx.lock \
	--http-client-body-temp-path=/var/cache/nginx/client_temp \
	--http-proxy-temp-path=/var/cache/nginx/proxy_temp \
	--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
	--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
	--http-scgi-temp-path=/var/cache/nginx/scgi_temp \
	--with-perl_modules_path=/usr/lib/perl5/vendor_perl \
	--user=nginx \
	--group=nginx \
	--with-compat \
	--with-file-aio \
	--with-threads \
	--with-http_addition_module \
	--with-http_auth_request_module \
	--with-http_dav_module \
	--with-http_flv_module \
	--with-http_gunzip_module \
	--with-http_gzip_static_module \
	--with-http_mp4_module \
	--with-http_random_index_module \
	--with-http_realip_module \
	--with-http_secure_link_module \
	--with-http_slice_module \
	--with-http_ssl_module \
	--with-http_stub_status_module \
	--with-http_sub_module \
	--with-http_v2_module \
	--with-mail \
	--with-mail_ssl_module \
	--with-stream \
	--with-stream_realip_module \
	--with-stream_ssl_module \
	--with-stream_ssl_preread_module \
    --add-dynamic-module=/src/opentelemetry-cpp-contrib/instrumentation/nginx \
&& make modules -j1

Now we can see the first Error:

/src/opentelemetry-cpp-contrib/instrumentation/nginx/src/otel_ngx_module.cpp:5:10: fatal error: opentelemetry/exporters/otlp/otlp_grpc_exporter.h: No such file or directory
    5 | #include <opentelemetry/exporters/otlp/otlp_grpc_exporter.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [objs/Makefile:1880: objs/addon/src/otel_ngx_module.o] Error 1

I find it and soft link it to the system include directory.

find / -name "otlp_grpc_exporter.h"
+ find / -name otlp_grpc_exporter.h
/src/opentelemetry-cpp-contrib/exporters/geneva-trace/third_party/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h
/src/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h

fix it use:

ln -s /src/opentelemetry-cpp/exporters/otlp/include/opentelemetry/exporters/otlp/ /usr/local/include/opentelemetry/exporters/otlp

It look like ok, let's go on. The second Error:

In file included from /src/opentelemetry-cpp-contrib/instrumentation/nginx/src/otel_ngx_module.cpp:5:
/usr/local/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h:11:10: fatal error: opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h: No such file or directory
   11 | #include "opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [objs/Makefile:1880: objs/addon/src/otel_ngx_module.o] Error 1

I can not find it everywhere in container. How to deal with this problem?

Another issues

By the way, there are a lot of warning messages during the compilation of the program.

/src/opentelemetry-cpp/sdk/test/trace/sampler_benchmark.cc: In function 'void {anonymous}::BM_AlwaysOffSamplerConstruction(benchmark::State&)':
/src/opentelemetry-cpp/sdk/test/trace/sampler_benchmark.cc:30:29: warning: 'typename std::enable_if<((! std::is_trivially_copyable<_Tp>::value) || (sizeof (Tp) > sizeof (Tp*)))>::type benchmark::DoNotOptimize(const Tp&) [with Tp = opentelemetry::v1::sdk::trace::AlwaysOffSampler; typename std::enable_if<((! std::is_trivially_copyable<_Tp>::value) || (sizeof (Tp) > sizeof (Tp*)))>::type = void]' is deprecated: The const-ref version of this method can permit undesired compiler optimizations in benchmarks [-Wdeprecated-declarations]
   30 |     benchmark::DoNotOptimize(AlwaysOffSampler());
      |     ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /src/opentelemetry-cpp/sdk/test/trace/sampler_benchmark.cc:17:
/usr/include/benchmark/benchmark.h:496:5: note: declared here
  496 |     DoNotOptimize(Tp const& value) {
      |     ^~~~~~~~~~~~~
/src/opentelemetry-cpp/sdk/test/trace/sampler_benchmark.cc: In function 'void {anonymous}::BM_AlwaysOnSamplerConstruction(benchmark::State&)':
/src/opentelemetry-cpp/sdk/test/trace/sampler_benchmark.cc:40:29: warning: 'typename std::enable_if<((! std::is_trivially_copyable<_Tp>::value) || (sizeof (Tp) > sizeof (Tp*)))>::type benchmark::DoNotOptimize(const Tp&) [with Tp = opentelemetry::v1::sdk::trace::AlwaysOnSampler; typename std::enable_if<((! std::is_trivially_copyable<_Tp>::value) || (sizeof (Tp) > sizeof (Tp*)))>::type = void]' is deprecated: The const-ref version of this method can permit undesired compiler optimizations in benchmarks [-Wdeprecated-declarations]
   40 |     benchmark::DoNotOptimize(AlwaysOnSampler());
      |     ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
/usr/include/benchmark/benchmark.h:496:5: note: declared here
  496 |     DoNotOptimize(Tp const& value) {
      |     ^~~~~~~~~~~~~
/src/opentelemetry-cpp/sdk/test/trace/sampler_benchmark.cc: In function 'void {anonymous}::BM_ParentBasedSamplerConstruction(benchmark::State&)':
/src/opentelemetry-cpp/sdk/test/trace/sampler_benchmark.cc:49:29: warning: 'typename std::enable_if<((! std::is_trivially_copyable<_Tp>::value) || (sizeof (Tp) > sizeof (Tp*)))>::type benchmark::DoNotOptimize(const Tp&) [with Tp = opentelemetry::v1::sdk::trace::ParentBasedSampler; typename std::enable_if<((! std::is_trivially_copyable<_Tp>::value) || (sizeof (Tp) > sizeof (Tp*)))>::type = void]' is deprecated: The const-ref version of this method can permit undesired compiler optimizations in benchmarks [-Wdeprecated-declarations]
   49 |     benchmark::DoNotOptimize(ParentBasedSampler(std::make_shared<AlwaysOnSampler>()));
      |     ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/benchmark/benchmark.h:496:5: note: declared here
  496 |     DoNotOptimize(Tp const& value) {
      |     ^~~~~~~~~~~~~
/src/opentelemetry-cpp/sdk/test/trace/sampler_benchmark.cc: In function 'void {anonymous}::BM_TraceIdRatioBasedSamplerConstruction(benchmark::State&)':
/src/opentelemetry-cpp/sdk/test/trace/sampler_benchmark.cc:58:29: warning: 'typename std::enable_if<((! std::is_trivially_copyable<_Tp>::value) || (sizeof (Tp) > sizeof (Tp*)))>::type benchmark::DoNotOptimize(const Tp&) [with Tp = opentelemetry::v1::sdk::trace::TraceIdRatioBasedSampler; typename std::enable_if<((! std::is_trivially_copyable<_Tp>::value) || (sizeof (Tp) > sizeof (Tp*)))>::type = void]' is deprecated: The const-ref version of this method can permit undesired compiler optimizations in benchmarks [-Wdeprecated-declarations]
   58 |     benchmark::DoNotOptimize(TraceIdRatioBasedSampler(0.01));
      |     ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/benchmark/benchmark.h:496:5: note: declared here
  496 |     DoNotOptimize(Tp const& value) {
      |     ^~~~~~~~~~~~~
/src/opentelemetry-cpp/sdk/test/trace/sampler_benchmark.cc: In function 'void {anonymous}::BenchmarkShouldSampler(opentelemetry::v1::sdk::trace::Sampler&, benchmark::State&)':
/src/opentelemetry-cpp/sdk/test/trace/sampler_benchmark.cc:83:29: warning: 'typename std::enable_if<((! std::is_trivially_copyable<_Tp>::value) || (sizeof (Tp) > sizeof (Tp*)))>::type benchmark::DoNotOptimize(const Tp&) [with Tp = opentelemetry::v1::sdk::trace::SamplingResult; typename std::enable_if<((! std::is_trivially_copyable<_Tp>::value) || (sizeof (Tp) > sizeof (Tp*)))>::type = void]' is deprecated: The const-ref version of this method can permit undesired compiler optimizations in benchmarks [-Wdeprecated-declarations]
   83 |     benchmark::DoNotOptimize(
      |     ~~~~~~~~~~~~~~~~~~~~~~~~^
   84 |         sampler.ShouldSample(invalid_ctx, trace_id, "", span_kind, view, links));
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/benchmark/benchmark.h:496:5: note: declared here
  496 |     DoNotOptimize(Tp const& value) {
      |     ^~~~~~~~~~~~~
/src/opentelemetry-cpp/sdk/test/metrics/attributes_hashmap_benchmark.cc: In lambda function:
/src/opentelemetry-cpp/sdk/test/metrics/attributes_hashmap_benchmark.cc:40:29: warning: 'typename std::enable_if<(std::is_trivially_copyable<_Tp>::value && (sizeof (Tp) <= sizeof (Tp*)))>::type benchmark::DoNotOptimize(const Tp&) [with Tp = bool; typename std::enable_if<(std::is_trivially_copyable<_Tp>::value && (sizeof (Tp) <= sizeof (Tp*)))>::type = void]' is deprecated: The const-ref version of this method can permit undesired compiler optimizations in benchmarks [-Wdeprecated-declarations]
   40 |     benchmark::DoNotOptimize(hash_map.Has(hash));
      |     ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /src/opentelemetry-cpp/sdk/test/metrics/attributes_hashmap_benchmark.cc:4:
/usr/include/benchmark/benchmark.h:485:5: note: declared here
  485 |     DoNotOptimize(Tp const& value) {
      |     ^~~~~~~~~~~~~
/src/opentelemetry-cpp/sdk/test/metrics/base2_exponential_histogram_indexer_benchmark.cc: In function 'void {anonymous}::BM_NewIndexer(benchmark::State&)':
/src/opentelemetry-cpp/sdk/test/metrics/base2_exponential_histogram_indexer_benchmark.cc:31:31: warning: 'typename std::enable_if<((! std::is_trivially_copyable<_Tp>::value) || (sizeof (Tp) > sizeof (Tp*)))>::type benchmark::DoNotOptimize(const Tp&) [with Tp = opentelemetry::v1::sdk::metrics::Base2ExponentialHistogramIndexer; typename std::enable_if<((! std::is_trivially_copyable<_Tp>::value) || (sizeof (Tp) > sizeof (Tp*)))>::type = void]' is deprecated: The const-ref version of this method can permit undesired compiler optimizations in benchmarks [-Wdeprecated-declarations]
   31 |       benchmark::DoNotOptimize(Base2ExponentialHistogramIndexer(value));
      |       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /src/opentelemetry-cpp/sdk/test/metrics/base2_exponential_histogram_indexer_benchmark.cc:6:
/usr/include/benchmark/benchmark.h:496:5: note: declared here
  496 |     DoNotOptimize(Tp const& value) {
      |     ^~~~~~~~~~~~~
/src/opentelemetry-cpp/sdk/test/metrics/base2_exponential_histogram_indexer_benchmark.cc: In function 'void {anonymous}::BM_ComputeIndex(benchmark::State&)':
/src/opentelemetry-cpp/sdk/test/metrics/base2_exponential_histogram_indexer_benchmark.cc:56:31: warning: 'typename std::enable_if<(std::is_trivially_copyable<_Tp>::value && (sizeof (Tp) <= sizeof (Tp*)))>::type benchmark::DoNotOptimize(const Tp&) [with Tp = int; typename std::enable_if<(std::is_trivially_copyable<_Tp>::value && (sizeof (Tp) <= sizeof (Tp*)))>::type = void]' is deprecated: The const-ref version of this method can permit undesired compiler optimizations in benchmarks [-Wdeprecated-declarations]
   56 |       benchmark::DoNotOptimize(indexer.ComputeIndex(value));
      |       ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/benchmark/benchmark.h:485:5: note: declared here
  485 |     DoNotOptimize(Tp const& value) {
      |     ^~~~~~~~~~~~~

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the build in the Alpine 3.18 container using the commands in the issue and the build guidance in INSTALL.md. Inspect instrumentation/nginx and the opentelemetry-cpp exporter headers involved in the reported include failures. Done means the nginx 1.24.0 dynamic module builds without manual symlinks and the existing test/build steps complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp, docker, linux, nginx
Domain
build-system, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.