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

[bug] detect_api.detect_clang_compiler provides the minor version of the compiler #16226

Closed
jwillikers opened this issue May 8, 2024 · 4 comments
Assignees

Comments

@jwillikers
Copy link
Contributor

Describe the bug

On Linux, using detect_api.detect_clang_compiler in profiles results in the minor version of the compiler being included. On Ubuntu 22.04, it provides 14.0 and on Ubuntu 24.04 it provides 18.1. This is problematic because these versions don't exist in the default settings.yml file and because it isn't consistent with how the detect_api.detect_gcc_compiler returns its version, i.e. just the major version.

How to reproduce it

Use {% set compiler, compiler_version, compiler_exe = detect_api.detect_clang_compiler() %} in a Conan profile with Clang installed on Linux. On Debian, sudo apt -y install clang.

@memsharded memsharded self-assigned this May 8, 2024
@memsharded
Copy link
Member

Hi @jwillikers

Thanks for your report.

I am not sure this is a bug, but intended. The api is designed to return the version with the minor.
If you want to obtain the equivalent default version that the conan profile detect is returning, you need to pass it to the detect_api.default_compiler_version().

This is done this way, because this way allows user to decide if they want to keep the minor or not.

@jwillikers
Copy link
Contributor Author

jwillikers commented May 8, 2024

Thanks, I think I missed default_compiler_version. Does detect_api.detect_gcc_compiler() work the same way? It didn't seem to for me, just including the major version only.

@jwillikers
Copy link
Contributor Author

Oh wait, my bad, the GCC profiles are already using default_compiler_version. I'll close this then!

@memsharded
Copy link
Member

No, it is true that detect_gcc_compiler is using gcc -dumpversion which happened to change and only return the major version since gcc 7.1, and it stayed this way. It should be possible to use gcc -dumpfullversion, but I am concerned this could also break some users, not sure what would be the best way to change this, if a newer api method or an argument or other approach.

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

No branches or pull requests

2 participants