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

Bazel build of example failed

Open shiponcs opened this issue 1 year ago • 7 comments

My system:

> lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.3 LTS
Release:	22.04
Codename:	jammy

> gcc --version
gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0

Steps to reproduce Build an example (logs_simple) by running the command from the root directory of the repo

> bazel build examples/logs_simple:example_logs_simple

What is the expected behavior? It should build the example and generate the binary (example_logs_simple).

What is the actual behavior? The build fails as follows:

> bazel build examples/logs_simple:example_logs_simple
INFO: Analyzed target //examples/logs_simple:example_logs_simple (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
ERROR: /home/user/office/opentelemetry/opentelemetry-cpp/sdk/src/logs/BUILD:6:11: Compiling sdk/src/logs/readable_log_record.cc failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF ... (remaining 22 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
In file included from sdk/src/logs/readable_log_record.cc:5:
bazel-out/k8-fastbuild/bin/sdk/_virtual_includes/headers/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h:76:12: error: 'std::enable_if_t' has not been declared
   76 |       std::enable_if_t<opentelemetry::common::detail::is_key_value_iterable<ArgumentType>::value>
      |            ^~~~~~~~~~~
bazel-out/k8-fastbuild/bin/sdk/_virtual_includes/headers/opentelemetry/sdk/instrumentationscope/instrumentation_scope.h:76:23: error: expected '>' before '<' token
   76 |       std::enable_if_t<opentelemetry::common::detail::is_key_value_iterable<ArgumentType>::value>
      |                       ^
Target //examples/logs_simple:example_logs_simple failed to build
Use --verbose_failures to see the command lines of failed build steps.

shiponcs avatar Feb 08 '24 07:02 shiponcs

Could you please try bazel build --host_cxxopt=-std=c++14 --cxxopt=-std=c++14 examples/logs_simple:example_logs_simple ?

owent avatar Feb 08 '24 08:02 owent

@owent thanks. This hack worked.

shiponcs avatar Feb 09 '24 04:02 shiponcs

Opentelemetry-cpp no longer supports C++11:

  • #1830
  • #2147

marcalff avatar Feb 09 '24 08:02 marcalff

Opentelemetry-cpp no longer supports C++11:

@marcalff Thanks. Seems like it doesn't support C++12 either.

shiponcs avatar Feb 11 '24 09:02 shiponcs

@shiponcs what OpenTelemetry SDK version is built here?

ThomsonTan avatar Feb 12 '24 21:02 ThomsonTan

@ThomsonTan tip of the current main branch.

shiponcs avatar Feb 13 '24 05:02 shiponcs

This issue was marked as stale due to lack of activity.

github-actions[bot] avatar Apr 14 '24 02:04 github-actions[bot]