-
Notifications
You must be signed in to change notification settings - Fork 977
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
[bug] Invert the logic of _GLIBCXX_USE_CXX11_ABI ? #7070
Comments
Hi @0x8000-0000
I am not sure I understood that. Is that you are using the default auto-detected profile that is using If that is the case, this is not a bug, this is by design, and cannot be changed without breaking. The reason it is this way is because of wider binary compatibility with older distros, even modern compilers can't upgrade to libstdc++11 in older distros: https://blog.conan.io/2016/03/22/From-CMake-syntax-to-libstdc++-ABI-incompatibiliy-migrations-are-always-hard.html Using the default profile is not recommended for production. Better use your own profiles (can manage them with Please let me know if that helps, most likely I didn't understand this well enough. |
I have compiler.libcxx=libstdc++11 in my profile, and it injects the definition on the command line when building, even though it is redundant given the compiler version I'm using. The dual ABI page says:
So since it was introduced, on most distributions the value was 1. What I am asking in effect is that for |
This is the bug in clang-tidy: https://bugs.llvm.org/show_bug.cgi?id=42635 |
The problem I see with this is that it may not be evident what is the default value for all the compilers we are supporting including all the versions. Currently, we adjusting @0x8000-0000 do you know if we can find this information in the GNU website? |
I don't know, and as documented by the page I linked possible that distributions are setting up the default differently than what upstream has. The way that the configuration setting was defined in Conan, it is not clear what the plan for sunsetting it is. GCC5 was released 5 years ago, and when it was release the default was to use the new ABI. Perhaps this should have been followed here and users should have had to explicitly select the old ABI, and by default to follow what the compiler is doing by default. With the current semantic of compiler.libcxx, I am forced to make a choice, and it is possible I'll make the wrong choice. |
@0x8000-0000 I understand the hassle of being forced to set With the lack of information about the defaults, I find it difficult to rely on just the defaults of the compiler and I consider changing this a bit risky for the value. @uilianries @SSE4 WDYT about this topic? |
For gcc you can find out if your compiler was built with
The Red Hat Devtoolset compiler suites continue to use
Devtoolset is very common in Red Hat Enterprise Linux shops. |
Thanks a lot for the info @sourcedelica. I still think it is too much for the value and a bit risky to change the definition for the benefit (just a clang-tidy warning, or am I missing something?). I can only think about something like #5740 to improve this. |
This is not very accurate, and much part of the problem. Specifically this: GCC5 and even more modern versions, when used in a somewhat older distro, still defaults to
Yes, as explained above, because it is not a constant default, it really changes from platform to platform, distro to distro, so the only way is to making it a choice. Summary: I agree with @danimtb, definitely this is too much of a risk. Conan not passing _GLIBCXX_USE_CXX11_ABI will cause many ABI incompatibilities for many compilers, and at the moment it is almost impossible to know which compiler in which distros have this as the default or not. As the request is related to a warning of clang-tidy, it doesn't seem worth the risk (almost a certainty) of breaking hundreds of Conan users. |
Hi @danimtb - I’m not looking for a change. I agree with the current approach. I was just providing a datapoint - that the old ABI is still in use and probably will be indefinitely on Red Hat Enterprise. |
My question is, why am I getting this flag when building on Ubuntu? I understand it to be set when building on RedHat with their official compilers. The point is, for the benefit of a single distro (admittedly with a large influence) we're adding this macro to build systems everywhere until the end of time. |
Because Conan by default, does not manage or model the different distros. It is possible to do it and add custom settings to represent different distros, but it is not built-in. As such, the only safe way is to provide always the flag and switch the 1 or 0 value. We haven't find any docs out there where setting _GLIBCXX_USE_CXX11_ABI=1 was discouraged. |
Actually, in the enterprise case this is a needed feature. We're just running into this where we have to build and package the same application for several versions of Ubuntu/SuSE/RHEL. We can definitely add the setting, but it would be handy for Conan to automatically identify the distribution and create a different binary package - this is more relevant for the GLIBC even since the ancient RHEL stil supported is missing certain functions added in more recent GLIBC versions. And packages that we built with Conan can definitely adapt, but it is surprising if somebody downloads a package built on newer Ubuntu, links against it on RHEL then the application fails to start due to missing symbols. |
#8457, that is intended for next Conan releases, will invert the logic, defining |
After seeing that The concerning bit is this:
from (https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html) So this means that some Linux distros do really need GLIBCXX_USE_CXX11_ABI=11 defined, and Conan would be doing the safe thing, redundant in some cases, but safer than not defining and getting the wrong ABI. It seems that https://bugs.llvm.org/show_bug.cgi?id=42635 was fixed, so if this is not an issue anymore, what Conan should do by default? |
It might be useful to have a survey of supported distributions to see how many build by default with _GLIBCXX_USE_CXX11_ABI=0 . |
Environment Details (include every applicable attribute)
Steps to reproduce (Include if Applicable)
The default for _GLIBCXX_USE_CXX11_ABI is 1 for several years now. Can we invert the logic of compiler.libcxx to use libstdc++ancient for the older version and use libstdc++ by default, or have libstdc++ NOT emit _GLIBCXX_USE_CXX11_ABI ?
The reason I'm asking this is that we have a rule for formatting global macros in clang-tidy which is tripped by this macro, and there is no way to suppress it in tidy, since it does not come from a source file, but it is injected on the command line.
I suppose this is a bug in tidy, but there is some redundancy in Conan / CMake injecting this variable explicitly when it is not needed for quite some time now.
The text was updated successfully, but these errors were encountered: