-
Notifications
You must be signed in to change notification settings - Fork 440
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
Better handling of OPENTELEMETRY_STL_VERSION. #2490
Conversation
…L_VERSION is set to a version unsupported by the current enviornment.
…y-cpp into bcsgh/with_cxx_stdlib
Does anyone know how to get the text of the CLA I'm being asked to agree to before I start the process of agreeing to it? I.e. I'm looking for a public link to that document that can be viewed by anyone on the internet without any authentication or sign in of any kind. |
|
The PDF's there refer to v1 where as the link here refers to v2. Is there only one version of the CLA but two version of EasyCLA? (Really, EasyCLA should show the full text of the agreement before it even asks you to log in. The fact it doesn't seem to actively want the world to know what the agreement is kinds seems suggestive, and not in a good way.) |
Sorry, ignore the link I shared. But I believe there should be a |
Step 4 there is basically "create an account" on system I haven't yet decided I'm willing to have any connection to. They don't even let me file a ticket about that without creating the account. :-( That said, the v1 CLA seems palatable enough (heck, it doesn't even seem to want a licence for interplanetary space!) that I'm willing to take the risk. |
api/include/opentelemetry/version.h
Outdated
#if defined(OPENTELEMETRY_STL_VERSION) | ||
# if OPENTELEMETRY_STL_VERSION > (__cplusplus/100) | ||
# pragma message OPENTELEMETRY_STRINGIFY(OPENTELEMETRY_STL_VERSION) " vs. " OPENTELEMETRY_STRINGIFY(__cplusplus) | ||
# error "OPENTELEMETRY_STL_VERSION set to version newer than compilation version." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# error "OPENTELEMETRY_STL_VERSION set to version newer than compilation version." | |
# error "OPENTELEMETRY_STL_VERSION is set to a version newer than the compiler version." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the compiler version" is ambiguous. Is it saying the version of GCC/Clang it self? The version of C++ supported by the compiler? The version currently being used by the compiler? I'm not sure that "compilation version" is any more accurate, but it at least doesn't invite that first incorrect interpretation. Any suggestions on how to avoid that?
I'll go with whatever you want, but if we can't come up with something clear, then I'd rather something that makes people think a bit before they make a bad assumption.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use _MSVC_LANG
to check C++ version without /Zc:__cplusplus
using MSVC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both done (used slightly different verbiage and I'm still depending on the MSVC CI to test things for me).
For the issue of setting |
Likely? But not necessarily. It's possible you could avoid using any of the headers that check for something between the two. But that might actually be worse because including another header somewhere down the line might surface a preexisting issue and you won't even have the hint that it's related to something you just changed. Regardless, the resulting error message is inscrutable and doesn't tell you anything about what the actual issue is or how to fix to. |
…ver existing incorrect usage).
On further inspection, things on MSVC are more complicated: Note, I don't have a MSVC system to even try to test that on so my only option is blindly firing it at the CI. that said, I'm not totally sure this warrens the added complexity given that
|
yeah, the MSVC compiler historically doesn't update the |
Oh fun! From the
The test claims to be testing C++20, the test is asking for c++23 and it's actually using C++17. Anyone want to take a guess as to what the correct fix is? Things also fail under There is also |
Probably the runtime environment is not correct for this test - the default gcc compiler in ubuntu-20.04 won't be supporting C++20. We should be using ubuntu-latest. Though need to see from where C++23 is coming :) |
Is the checking here similar to cmake_policy(SET CMP0067 NEW) |
I don't know near enough about CMake to figure out how to do that ?? |
I'm thinking that the C++2020 test should explicitly set C++2020. And it also looks like |
Good point, we can probably alter the meaning of "ON" instead of adding yet another choice. |
Never mind, the CMake policy is meant to check |
8a9fe97
to
b44658a
Compare
It seems that
Well, all of those are greater than the official values for the prior standard versions, so we have that goin' for us, which is nice. While pondering this dilemma, this is what happens without the version guard: #2503 |
@ Maybe? Maybe? This is doing more than that, and that "more" is things that I think should be done at some point, but I'm not sure how to do those things and don't want to block the other bits on that unknown. I'm inclined say the other PR should be merged and this one updated to just be what's left over. Even if this PR gets closed at that point, it would leave this in a state that is good documentation on what's going on and why. |
@ThomsonTan bumped back to a draft for now. |
b44658a
to
163b341
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that most of the original code from this PR is merged to main, the last remaining part is:
error "OPENTELEMETRY_STL_VERSION is set to a version newer than the curent C++ version."
For example, when:
- OPENTELEMETRY_STL_VERSION is set to 2017
- The C++ compiler is building with std::c++14
this PR wants to raise an error and prevent the build.
Such a combination can be surprising, but I am not aware of any fundamental reason, such as a limitation in opentelemetry-cpp, to justify failing the build in this case.
If a user ask for a very recent STL, uses a very old C++ standard, and some class from the STL requires support from the compiler (new syntax, C++ intrinsic properties), the build will fail anyway, so this extra check does not provide any value or safety.
If a user asks for an STL just slightly more recent than the C++ standard used at compile time, for example to use a basic class like std::span or std::string_view, I don't think opentelemetry-cpp should fail the build, just because the combination "looks strange".
People may have very strange requirements or environments, including when cross compiling, including when rebuilding the STL from source, and opentelemetry-cpp should not get in the way here, if this really is what people want.
Unless we know of an actual bug that this extra check will prevent, I think this extra check is not justified, and should not be merged to main.
Keeping the PR open a few days so this can be discussed if necessary.
At this point I'm mostly indifferent as what I got in solves the problem for my case. That said, a few observations:
Either way, given that |
I agree with you that this whole area needs further analysis, especially with the overlapping concern with inline namespaces that could be used in the stl. Things in this area are never simple and clear cut. For this very PR in any case, it can not be merged as is, due to the additional complexity caused by some compilers, which don't provide This PR only contains a remaining build check, all the important bits have been merged with #2503 already (and thanks again for that). Closing. |
Fixes #2470
Changes
#error
whenOPENTELEMETRY_STL_VERSION
is unsupported by the actually C++ version.NOTE: this doesn't work because compilers do strange things with
__cplusplus