Skip to content
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

Feature/detect libcxx #7776

Merged
merged 3 commits into from Sep 30, 2020
Merged

Conversation

memsharded
Copy link
Member

@memsharded memsharded commented Sep 30, 2020

Changelog: Feature: Implement real detection of compiler.libcxx value for gcc compiler. Only enabled in CONAN_V2_MODE, otherwise it would be breaking.
Docs: Omit

Close #7264

@memsharded memsharded added this to the 1.30 milestone Sep 30, 2020
#include <string>

using namespace std;
static_assert(sizeof(std::string) != sizeof(void*), "using libstdc++");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static_assert is C++11, can we use it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can just include and check the value of _GLIBCXX_USE_CXX11_ABI?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is only applied for gcc>=5.1 which already support c++11 (passed in the command line)

maybe we can just include and check the value of _GLIBCXX_USE_CXX11_ABI?

That is the original problem, as you described in #7264 (comment), this will be ignored. We need to check for the real thing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I see, you're passing -std=c++11 below

@czoido czoido merged commit 62ead91 into conan-io:develop Sep 30, 2020
@memsharded memsharded deleted the feature/detect_libcxx branch September 30, 2020 15:02
@uilianries
Copy link
Member

uilianries commented Sep 30, 2020

I can't see the warning message when running it on CentOS6 + Devtools7:

python conans/conan.py profile new default --detect
CC and CXX: /opt/rh/devtoolset-7/root/usr/bin/gcc, /opt/rh/devtoolset-7/root/usr/bin/g++ 
Found gcc 7.3
gcc>=5, using the major as version
Profile created with detected settings: /home/conan/.conan/profiles/default
[conan@eb84f8fab0db project]$ python conans/conan.py profile show default
Configuration for profile default:

[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=7
compiler.libcxx=libstdc++
build_type=Release
[options]
[build_requires]
[env]

For regular GCC7 docker image, based on Ubuntu, it works fine:

$ python conans/conan.py profile new default --detect 
CC and CXX: /usr/bin/gcc, /usr/bin/g++ 
Found gcc 7.2
gcc>=5, using the major as version
Profile created with detected settings: /home/conan/.conan/profiles/default
conan@f5cb86db1e8f:~/project$ python conans/conan.py profile show default          
Configuration for profile default:

[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=7
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]

Steps to reproduce:

$ cd <conan_project_folder>
$ docker run --rm -ti -v ${PWD}:/home/conan/project conanio/gcc7-centos6:latest
$ cd project
$ export CONAN_V2_MODE=1
$ export PYTHONPATH=${PWD}
$ python conans/conan.py profile new default --detect
$ python conans/conan.py profile show default

@memsharded
Copy link
Member Author

I can't see the warning message when running it on CentOS6 + Devtools7:

This will not warn if it checks the libcxx correctly, it will just assign the correct value, and seems to work ok, doesn't it?

@uilianries
Copy link
Member

This will not warn if it checks the libcxx correctly, it will just assign the correct value, and seems to work ok, doesn't it?

Hmm, correct!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] compiler.libcxx for dependencies with prebuilt packages
4 participants