-
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
[bug] detect_default_compiler fails in ubuntu 22 docker when cc is '/usr/bin/cc' #16149
Comments
Thanks for reporting this @Stadik, and thanks specially for the detailed and reproducible example, that really helps. It indeed seems a bug, lets try to improve it. I think this fix might not be that straightforward as proposed above, as |
I have been having a closer look to this. It seems that CMake has acknowledge this was not a great default behavior in https://gitlab.kitware.com/cmake/cmake/-/issues/21378, and it was changed in https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7108, but for older I have modified your CMakeListst.txt to I was surprised that we hadn't suffered this issue in I think we could considered this issue as not a Conan issue, but a CMake one, and it has already been solved, what do you think? |
Thanks for investigating this issue so fast. Yes you are right this error can be fully controlled just by cmake_policy(SET CMP0132 NEW), so it certainly is a cmake issue in this case. This is quite interesting, everything happens silently in the background, also by changing this policy there is no visible difference to identify the actual issue. |
Yes true just by symlinks "/usr/bin/cc" and "/usr/bin/c++" one cannot tell what the actual compiler is, but I can see the if condition is also checking So it seems for me |
This code applies only when the CC/CXX env-var is defined. What it doesn't seem to make sense is users pointing the CC/CXX env-var to the |
Thanks a lot, I can verify that 2.3.0 fixes the original issue I used to derive the example from. |
Thanks for the feedback @Stadik |
Describe the bug
It seems to be a tricky issue since it only occurs in a fresh docker image first time after install.
Only when calling 'conan profile detect' via cmake script.
The reason is probably how cmake sets CC to /usr/bin/cc since it does not happen when directly calling conan profile detect.
The issue seems to be (in 2.2.3) in conan/internal/api/detect_api.py , detect_default_compiler, line 363
command is set to /usr/bin/cc but in the gcc if condition cc is not tested
Adding or
or "cc" in command
to line 369 fixes the issue.How to reproduce it
when following these steps it always occurs for me (maybe not all is necessary, but I didn't test it without them)
By running this CMakeLists.txt
One gets this error
The text was updated successfully, but these errors were encountered: