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

Attempt to use opentelemetry_api headers cause envoy build fails #32591

Closed
shiponcs opened this issue Feb 27, 2024 · 3 comments · Fixed by #32624
Closed

Attempt to use opentelemetry_api headers cause envoy build fails #32591

shiponcs opened this issue Feb 27, 2024 · 3 comments · Fixed by #32624

Comments

@shiponcs
Copy link
Contributor

shiponcs commented Feb 27, 2024

Title: Attempt to use opentelemetry_api headers cause envoy build fails

Description:

I need a help regarding using opentelemetry_api that was added in this commit.
/source/extensions/tracers/opentelemetry has opentelemetry_api as external_deps, in opentelemetry_tracer_impl.h file I have included a otel header file as:

#include "opentelemetry/logs/provider.h"

I used to build envoy with docker-clang option, but this time it fails:

$ bazel build envoy --config=docker-clang
INFO: Analyzed target //:envoy (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
INFO: Docker sandboxing is supported
ERROR: /home/matin/envoy-build/envoy/source/extensions/tracers/opentelemetry/BUILD:14:19: Compiling source/extensions/tracers/opentelemetry/config.cc failed: (Exit 1): clang-14 failed: error executing command (from target //source/extensions/tracers/opentelemetry:config) /opt/llvm/bin/clang-14 -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -Wunused-but-set-parameter -Wno-free-nonheap-object -fcolor-diagnostics -fno-omit-frame-pointer '-std=c++0x' ... (remaining 246 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from source/extensions/tracers/opentelemetry/config.cc:8:
In file included from ./source/extensions/tracers/opentelemetry/opentelemetry_tracer_impl.h:16:
In file included from bazel-out/k8-fastbuild/bin/external/io_opentelemetry_cpp/api/_virtual_includes/api/opentelemetry/trace/provider.h:11:
In file included from bazel-out/k8-fastbuild/bin/external/io_opentelemetry_cpp/api/_virtual_includes/api/opentelemetry/trace/noop.h:16:
In file included from bazel-out/k8-fastbuild/bin/external/io_opentelemetry_cpp/api/_virtual_includes/api/opentelemetry/trace/span.h:13:
bazel-out/k8-fastbuild/bin/external/io_opentelemetry_cpp/api/_virtual_includes/api/opentelemetry/trace/span_context.h:33:40: error: use of old-style cast [-Werror,-Wold-style-cast]
        trace_flags_(trace::TraceFlags((uint8_t)sampled_flag)),
                                       ^        ~~~~~~~~~~~~
1 error generated.
Target //source/exe:envoy-static failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 15.400s, Critical Path: 14.38s
INFO: 4 processes: 4 internal.
FAILED: Build did NOT complete successfully
@shiponcs shiponcs added the triage Issue requires triage label Feb 27, 2024
@mattklein123 mattklein123 added area/build and removed triage Issue requires triage labels Feb 27, 2024
@shiponcs
Copy link
Contributor Author

I've tried to turn off this -old-style-cast by passing the build option in bazel like this:

bazel build --cxxopt="-Wno-old-style-cast" envoy

But got the same error. I also try pass this option from Bazel BUILD file like this:

    copts = [
        "-Wno-old-style-cast"
    ],

That didn't work either.

I asked this question in bazel community slack. The said, it needs to be fixed from Envoy. Here is the thread: https://bazelbuild.slack.com/archives/CGA9QFQ8H/p1709093105289759

@keith
Copy link
Member

keith commented Feb 28, 2024

Upstream issue open-telemetry/opentelemetry-cpp#2556

@keith
Copy link
Member

keith commented Feb 28, 2024

submitted #32624 to patch fix for now

keith added a commit to keith/envoy that referenced this issue Feb 28, 2024
keith added a commit that referenced this issue Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants