Closed Pravila00 closed 3 months ago
I have also seen this issue where the build fails with the same expression #2382 "Build failure in nostd/span.h"
The opentelemetry-cpp CI
covers C++17 already:
and even on the same ubuntu 20.04.
The compiler error message is misleading I think, it complains about lambda and therefore C++20 while the real issue is that the types used in std::is_convertible are not convertible.
Please paste the full build log for the file that fails to build, there must be a reference to which line of code triggered this, and I suspect this line of code assigns two nostd::span variables of incompatible types.
Hi @marcalff
Thanks for the super fast answer, the line that triggers this in my code is:
#include <opentelemetry/exporters/user_events/logs/exporter.h>
So basically I'm not trying to even initialize it yet, it fails when it includes the header file:
In file included from /home/pabloro/LocalApplication/out/vcpkg_linux/installed/x64-linux/include/opentelemetry/sdk/logs/exporter.h:9,
from /home/pabloro/LocalApplication/out/vcpkg_linux/installed/x64-linux/include/opentelemetry/exporters/user_events/logs/exporter.h:8,
from /home/pabloro/LocalApplication/Lib/logging/UserEventsLogEngine.cpp:13:
I see, so some of the code comes from cpp-contrib:
The issue could be in opentelemetry-cpp, or in opentelemetry-cpp-contrib, to investigate.
This should be independent of cpp-contrib, it should be happening with every opentelemetry-cpp logger exporter, as this include of nostd/span.h comes from: /home/pabloro/LocalApplication/out/vcpkg_linux/installed/x64-linux/include/opentelemetry/sdk/logs/exporter.h:9
Can not reproduce.
#include <opentelemetry/exporters/user_events/logs/exporter.h>
int main(int, char*[])
{
return 0;
}
export CPP_API_INC=/data/malff/CODE/MY_GITHUB/opentelemetry-cpp/api/include/
export CPP_SDK_INC=/data/malff/CODE/MY_GITHUB/opentelemetry-cpp/sdk/include/
export CPP_CONTRIB_INC=/data/malff/CODE/MY_GITHUB/opentelemetry-cpp-contrib/exporters/user_events/include/
export LINUX_TP1_INC=/data/malff/CODE/MY_GITHUB/opentelemetry-cpp-contrib/exporters/user_events/third_party/LinuxTracepoints/libeventheader-tracepoint/include
export LINUX_TP2_INC=/data/malff/CODE/MY_GITHUB/opentelemetry-cpp-contrib/exporters/user_events/third_party/LinuxTracepoints/libtracepoint/include
gcc -std=c++17 \
-I${CPP_API_INC} \
-I${CPP_SDK_INC} \
-I${CPP_CONTRIB_INC} \
-I${LINUX_TP1_INC} \
-I${LINUX_TP2_INC} \
-o main.o -c main.cc
This builds.
Please take the scripts provided, adjust the include paths, and check if this build or not in your environment.
Okay it seems my project was importing a different library, which was defining a macro called U and having a conflict on this template U definition, eventually I managed to make it compile.
Thanks a lot for your help on this @marcalff! I'm closing the issue as this is not relevant :)
@Pravila00 What library are you using that caused this issue? I'm also having a similar issue on the same line:
Describe your environment
nostd/span.h
in my application once OpenTelemetry C++ SDK is built successfully.I am trying to use a logging exporter (user_events), as the other exporters, they require span either from STL, GSL or the backport (
nostd/span.h
)Given that I am building with C++17, stl::span is not included, so it goes to use the
nostd/span.h
which fails with the following error when it is included in my application:First of all, it seems to complain about using a lambda-expression in a template argument, saying that this is only supported from C++20 onwards.
I guess the main idea of this span backport is to support previous C++ versions than 20, such as 11/14/17.
The only workaround I have found so far is using C++20 and
std::span
, but I break my application build when we use other C++ libraries that are not supported by C++20. Any idea of why this build is failing in my application?