Can't compile the open telemetry for C++14 #2369
-
Hi, All. We are currently evaluating the open telemetry for our C++ service. We used the following CMAKE options to compile and build the source code: We are building it in CentOS 7 (centos-release-scl-2-3.el7.centos.noarch) cmake /builds/edge-data-services/opentelemetry-cmake-build/deps/opentelemetry-src -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/builds/edge-data-services/opentelemetry-cmake-build/src/clang.linux-x64/Debug -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_STANDARD=14 -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_CXX_FLAGS_INIT=-fvisibility=hidden -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_CXX_FLAGS=-pthread We are trying to link statically into our code and getting the following errors.
This error indicates that the linker is still looking for C++17 symbols. To give you the background, our toolchain does not support STL C++17 features, it only supports C++17 language features. I wonder whether we can build the open telemetry C++ for C++14 and with STL or STL C++14. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Analysis as follows. The error message seen at build time, by the compiler (not the linker), comes from:
A work around is to build in C++14 instead, not sure if this is compatible with your requirements. To do so, please note that:
About building opentelemetry-cpp with the C++14 STL only, this is supported starting with opentelemetry-cpp version 1.12.0 released today. See in particular: |
Beta Was this translation helpful? Give feedback.
Analysis as follows.
The error message seen at build time, by the compiler (not the linker), comes from:
__cplusplus >= 201703L
is testing that the compiler supports C++17 language featuresstd::invoke_result
is part of the C++17 STL, so in this case, in an environment with a C++17 compiler / C++ 14 STL, this fragment of code will fail.A work around is to build in C++14 instead, not sure if th…