open-telemetry / opentelemetry-cpp

The OpenTelemetry C++ Client
https://opentelemetry.io/
Apache License 2.0
810 stars 391 forks source link

[BUILD] protoc error during build of opentelemetry-cpp with OTLP HTTP enabled #2676

Closed philrq closed 1 month ago

philrq commented 1 month ago

Describe your environment

linux, gcc 7.3.1, protobuf 26.1, latest opentelemetry-cpp

Steps to reproduce

mkdir otel-cpp-starter cd otel-cpp-starter git clone https://github.com/open-telemetry/opentelemetry-cpp.git cd opentelemetry-cpp mkdir build cd build cmake -DBUILD_TESTING=OFF -DWITH_OTLP_HTTP=ON -DBUILD_SHARED_LIBS=OFF -DWITH_ABSEIL=ON -DCURL_LIBRARY=/BuySide_dev_home/users/procques/libcurl/lib -DCURL_INCLUDE_DIR=/home/libcurl/include -DCMAKE_PREFIX_PATH=/home/abseil/Install -DProtobuf_LIBRARIES=/tmp/protobuf/lib64/libprotobuf.a -DProtobuf_INCLUDE_DIR=/tmp/protobuf/include/ -DProtobuf_PROTOC_EXECUTABLE=/tmp/protobuf/bin/protoc ..

(works; no errors)

cmake --build .

[ 5%] Built target opentelemetry-proto

Could not make proto path relative: /home/otel-cpp-starter/opentelemetry-cpp/build/opentelemetry-proto-prefix/src/opentelemetry-proto/opentelemetry/proto/profiles/v1experimental/profiles.proto: No such file or directory

gmake[2]: *** [CMakeFiles/opentelemetry_proto.dir/build.make:74: generated/third_party/opentelemetry-proto/opentelemetry/proto/common/v1/common.pb.h] Error 1

gmake[1]: *** [CMakeFiles/Makefile2:694: CMakeFiles/opentelemetry_proto.dir/all] Error 2

gmake: *** [Makefile:136: all] Error 2

(The directory /home/otel-cpp-starter/opentelemetry-cpp/build/opentelemetry-proto-prefix/src/opentelemetry-proto/opentelemetry/proto/ exists, but /home/otel-cpp-starter/opentelemetry-cpp/build/opentelemetry-proto-prefix/src/opentelemetry-proto/opentelemetry/proto/profiles doesn't exist

What is the expected behavior? I expected the build to complete and generate opentelemetry libraries, as it does when OTLP HTTP is not enabled.

What is the actual behavior? The build failed because a command it executed referred to a directory which didn't exist: Could not make proto path relative: /home/otel-cpp-starter/opentelemetry-cpp/build/opentelemetry-proto-prefix/src/opentelemetry-proto/opentelemetry/proto/profiles/v1experimental/profiles.proto: No such file or directory

Additional context

owent commented 1 month ago

Could you please try git submodule update --init after clone? The default proto version is wrong now.

philrq commented 1 month ago

Your suggestion (git submodule update --init after clone) has fixed the problem - thanks