-
Notifications
You must be signed in to change notification settings - Fork 443
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
libstdc++ span not ABI compatible with nostd::span since GCC 11 #1705
Comments
Option to build with Standard library is only provided for environment where ABI compatibility is not required. No ABI compatibility is guaranteed between nostd implementations and standard library - https://github.com/open-telemetry/opentelemetry-cpp/blob/main/docs/building-with-stdlib.md |
Understood. Perhaps the title of this issue is a bit misleading of my intentions, but it's mainly about the comment in the code. Feel free to close this if that comment should not be updated. |
Thanks for the detailed investigations. The comment is indeed misleading, and should be removed. |
I was debugging some segfaults that occurred when I was building the OTel libraries with
WITH_STL=ON
, statically linking them to an application. I wasn't using an explicitCMAKE_CXX_STANDARD
for OTel which caused it to build with C++20, while the application is built with C++17. This caused a segfault in theInMemorySpanExporter
as that was using a different implementation ofnostd::span
because its included through a header-only file.The solution was to just explicitly set the same
CMAKE_CXX_STANDARD
for the OTel build so the samenostd::span
implementation is selected, but I did notice the following.There is a comment here hinting that it is desirable to have ABI compatibility with
libstdc++
's implementation ofstd::span
:https://github.com/open-telemetry/opentelemetry-cpp/blob/main/api/include/opentelemetry/nostd/span.h#L243-L247
However, that implementation has since GCC 11 swapped around the
extent
anddata
fields:https://github.com/gcc-mirror/gcc/blob/releases/gcc-11.3.0/libstdc++-v3/include/std/span#L392-L393
This was causing my segfaults.
Of course my problem was fixed by properly setting the
CMAKE_CXX_STANDARD
for OTel the same as my application, but I just wanted to mention that here in case this has any implications I am not aware of.The text was updated successfully, but these errors were encountered: