-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[profile] Can not detect default compiler when it is c++ #4322
Comments
The variable is already defined:
So the problem is that the auto-detect doesn't understand if "gcc" in command:
gcc = _gcc_compiler(output, command) So, yes, it could make sense to fix the auto detect of c++ => g++ (gcc) |
Yes, it's defined by CMake. You could check by |
please assign this one to me, I am working on proper compiler detection code as part of clang-cl support |
Hi @memsharded am I right in assuming that this is an example of the same problem? If so, +1 to being able to deduce version from Thanks, John |
I have just assigned this issue to @SSE4 so he can have a look, hopefully propose a fix for it. I am concerned that this could be breaking for users that have in their environment the env-vars defined but do not rely on them (e.g. in Windows, the Visual Studio compiler will have priority, but could be that CC, CXX env vars might be different to what people expect in their default profile) @lasote do you think this could be breaking behavior in some way? |
I think this could be consider it a bug. Also, we always recommend to not trust the autodetected default profile. If the env vars are there, Conan should try to detect the compiler with "c++" also. I vote for improving the detection. And if someone report a breaking behavior we can, as usual, analyze if it is legit or not. |
#5740 was merged, but this doesn't really fix this issue, as it is for CONAN_V2_MODE only. Adding |
#7586 merged this, will be released in Conan 1.29 |
change was reverted, need to re-open for a while |
Hi @SSE4 @memsharded , should this issue be reopened since it has been reverted from 1.29 release in the end? Any plans to fix it properly in the near future? |
The workaround which works for me:
|
In case it helps anyone, I still see this error conan 1.57 with env. var. CXX=g++ conan profile new --detect x reports
and produces a profile, x, without compiler fields, but CC=gcc CXX=g++ conan profile new --detect x happily proceed with:
|
Lets try to fix it in #13002 for Conan 2.0 at least. |
Closed by #13002, will be in 2.0-beta.9 |
To help us debug your issue please explain:
According Conan code, to detect the default compiler, if CC or CXX are configured and there is a valid compiler named there, then it will be used as the default one.
However, when we are running cmake-cmake, CXX is configured by CMake, and it could be valuated as
/usr/bin/c++
and Conan will not be able to detect the correct compiler.I see two possibilities in this case:
_get_default_compiler
to detect the correct compiler.NOTE: This situation only affects the scenario where cmake-conan is used AND there is no default profile.
Steps to reproduce
For this example we will need to use cmake-conan, because CMake has a custom CXX.
At this point we dont care about conanfile.txt or hello.cpp.
The output shall be:
As you can see, CXX was detected by Conan, because CMake found /usr/bin/c++ as a valid C++ compiler. But Conan is not able understand who is c++.
Environment
Conan Version: 1.11.2
Related Issue: conan-io/conan-docker-tools#95
The text was updated successfully, but these errors were encountered: