-
Notifications
You must be signed in to change notification settings - Fork 993
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
fixing definition of CXX11_ABI for gcc-like #10165
fixing definition of CXX11_ABI for gcc-like #10165
Conversation
elif libcxx == "libstdc++": | ||
|
||
if compiler in ['clang', 'apple-clang', 'gcc']: | ||
if libcxx == "libstdc++": |
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.
Lets be aware that from https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
Using the default configuration options for GCC the default value of the macro is 1 which causes the new ABI to be active, so to use the old ABI you must explicitly define the macro to 0 before including any library headers. (Be aware that some GNU/Linux distributions configure GCC 5 differently so that the default value of the macro is 0 and users must define it to 1 to enable the new ABI.)
So if we go this way, users from those distros will need to customize the CMakeToolchain
, something like this:
def generate(self):
tc = CMakeToolchain(self)
tc.blocks["libcxx"].values["glibcxx"] = "1" if self.settings.libcxx == "libstdc++11" else "0"
tc.generate()
There were requests to eliminate the default GLIBCXX_USE_CXX11_ABI=1
, as it was raising some warnings (undefined in some compilers, but not errors), so it seems there is no perfect solution for 100% of users.
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.
I would add a test with the generate
you suggest in case someone uses a custom distro. Also, we have to document this default.
I have added tests for both I have also added a new conf |
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.
👍 Could be merged
Changelog: Bugfix: Fix the definition of D_GLIBCXX_USE_CXX11_ABI in gcc-like compilers for
CMakeToolchain
andAutotoolsToolchain
. Define it only toD_GLIBCXX_USE_CXX11_ABI=0
for new compilers, assuming that the default is alread 1.Docs: Omit
Address conan-io/conan-center-index#8389
Lets see if something breaks, need to add tests.