open-telemetry / open-telemetry/opentelemetry-cpp

Bazel build of example failed

Open
#2,525 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Stale
Dominant language
C++
Stars
1.4k
Forks
632
Avg merge
1d 13h
Merged PRs (30d)
75

Description

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.

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 reported command, bazel build examples/logs_simple:example_logs_simple, from the repository root. Inspect sdk/src/logs/readable_log_record.cc, sdk/src/logs/BUILD, and the generated instrumentation_scope.h around line 76. Done means the target builds successfully and generates the example_logs_simple binary.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.