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

[BUILD] Compile WITH_OTLP failed #2095

Closed
ivgotcrazy opened this issue Apr 13, 2023 · 5 comments · Fixed by #2163
Closed

[BUILD] Compile WITH_OTLP failed #2095

ivgotcrazy opened this issue Apr 13, 2023 · 5 comments · Fixed by #2163
Assignees
Labels
bug Something isn't working help wanted Good for taking. Extra help will be provided by maintainers

Comments

@ivgotcrazy
Copy link

Describe your environment
Linux CentOS7 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
gcc 12.2.0

Steps to reproduce

  1. git clone master
  2. cmake3 -DBUILD_TESTING=OFF -DCMAKE_CXX_STANDARD=17 -DWITH_OTLP=ON ..

-- The C compiler identification is GNU 12.2.0
-- The CXX compiler identification is GNU 12.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Building for architecture ARCH=x64
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
CMake Warning at /usr/share/cmake3/Modules/FindProtobuf.cmake:500 (message):
Protobuf compiler version 22.2 doesn't match library version 4.22.2
Call Stack (most recent call first):
CMakeLists.txt:333 (find_package)

-- Found Protobuf: /usr/local/lib64/libprotobuf.a;-lpthread (found version "4.22.2")
-- PROTOBUF_PROTOC_EXECUTABLE=/usr/local/bin/protoc
-- opentelemetry-proto dependency satisfied by: git submodule
-- Performing Test check_cxx_compiler_flag_-Wno-type-limits
-- Performing Test check_cxx_compiler_flag_-Wno-type-limits - Success
-- Performing Test check_cxx_compiler_flag_-Wno-deprecated-declarations
-- Performing Test check_cxx_compiler_flag_-Wno-deprecated-declarations - Success
-- Performing Test check_cxx_compiler_flag_-Wno-unused-parameter
-- Performing Test check_cxx_compiler_flag_-Wno-unused-parameter - Success
-- gRPC_CPP_PLUGIN_EXECUTABLE=/usr/local/bin/grpc_cpp_plugin
Building with nostd types...
PATH:/root/opentelemetry-cpp/examples/grpc/protos:/root/opentelemetry-cpp/examples/grpc/protos/messages.proto
-- Configuring done
-- Generating done
-- Build files have been written to: /root/opentelemetry-cpp/build

  1. make

What is the expected behavior?
success

What is the actual behavior?
failed

Additional context
error.txt

@ivgotcrazy ivgotcrazy added the bug Something isn't working label Apr 13, 2023
@marcalff
Copy link
Member

marcalff commented Apr 13, 2023

I suspect that -DCMAKE_CXX_STANDARD=17 in fact requires -DWITH_STL in practice, which should be documented and/or enforced in the makefile.

Here, the compiler which supports C++17 compiles with replacement headers in the nostd namespace, which are meant to provide C++11 features to pre-C++11 compilers ... causing the errors reported.

See related options:

  • WITH_GSL
  • WITH_ABSEIL

@ivgotcrazy
Copy link
Author

thanks a lot, it seems to work.

@lalitb lalitb added the help wanted Good for taking. Extra help will be provided by maintainers label May 17, 2023
@lidavidm
Copy link
Contributor

We ran into this on the conda-forge package when Protobuf got bumped. WITH_STL mostly fixes things, but it seems Protobuf 4.23 also removed google/protobuf/stubs/stringpiece.h and google/protobuf/stubs/strutil.h which causes issues for otlp_http_client.cc. (And removing the includes isn't enough, since that file calls google::protobuf::Base64Escape; that appears to no longer be in the Protobuf API.)

@h-vetinari
Copy link

but it seems Protobuf 4.23 also removed google/protobuf/stubs/stringpiece.h and google/protobuf/stubs/strutil.h which causes issues for otlp_http_client.cc

The commit for this is protocolbuffers/protobuf@a3c8e2d, and it seems to be due to the switch to abseil, e.g.:

   static const char kSuffix[] = "_FIELD_NUMBER";
   if (PyString_AsStringAndSize(name, &attr, &attr_size) >= 0 &&
-      HasSuffixString(StringPiece(attr, attr_size), kSuffix)) {
+      HasSuffixString(absl::string_view(attr, attr_size), kSuffix)) {
     std::string field_name(attr, attr_size - sizeof(kSuffix) + 1);
     LowerString(&field_name);

@owent owent self-assigned this May 27, 2023
@marcalff marcalff changed the title compile WITH_OTLP failed [BUILD] Compile WITH_OTLP failed Jun 1, 2023
@github-actions
Copy link

github-actions bot commented Aug 1, 2023

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

@github-actions github-actions bot added the Stale label Aug 1, 2023
@lalitb lalitb removed the Stale label Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Good for taking. Extra help will be provided by maintainers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants