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

[package] boost/1.75.0: Builds under the "msvc" toolset instead of "clang-win" when "ClangCL" toolset is specified with Visual Studio #4727

Closed
IanE9 opened this issue Feb 28, 2021 · 1 comment · Fixed by #4749
Labels
bug Something isn't working

Comments

@IanE9
Copy link
Contributor

IanE9 commented Feb 28, 2021

Package and Environment Details

  • Package Name/Version: boost/1.75.0
  • Operating System+version: Windows 10
  • Compiler+version: MSVC 2019 v16.8.6/Clang v11.0.1
  • Conan version: Conan version 1.33.1
  • Python version: Python 3.9.2

Conan profile

[settings]
os=Windows
os_build=Windows
arch=x86_64
arch_build=x86_64
compiler=Visual Studio
compiler.toolset=ClangCL
compiler.version=16
build_type=Release
[options]
[build_requires]
[env]

Steps to reproduce

I've found that using clang directly as a compiler on windows is very hit and miss with regard to what packages will actually build successfully, and I've had much more success using Visual Studio with the toolset set to ClangCL as seen in the above profile. However when building boost with this profile, the recipe selects "msvc" as the toolset to use for building which results in cl.exe being invoked instead of clang-cl.exe.

conan install boost/1.75.0@ -r conan-center -pr vs-clang can be used with a common conan installation to reproduce the behavior, where profile vs-clang equals the aforementioned profile.

It's unlikely that building under the "msvc" toolset will ever be the intent of a user using the above profile and so I'd suggest the behavior be changed to select the "win-clang" toolset when conan specifies the compiler toolset as ClangCL in conjunction with the Visual Studio compiler.

The current behavior is caused by the branch on line 1054 of conanfile.py (seen below) being eagerly taken when Visual Studio is the compiler specified by conan.

        if self._is_msvc: # <-- branch always followed when compiler given by conan is "Visual Studio"
            return "msvc"
        elif self.settings.os == "Windows" and self.settings.compiler == "clang": # <-- ideally this branch should be followed when compiler.toolset is "ClangCL"
            return "clang-win"

I've had success with building using the "clang-win" toolset on the above profile by changing the first branch to read the following, but it feels like a very dirty solution considering that the next branch still exists and serves a similar purpose.

        if self._is_msvc:
            return "clang-win" if self.settings.compiler.toolset == "ClangCL" else "msvc"
@IanE9 IanE9 added the bug Something isn't working label Feb 28, 2021
@SSE4
Copy link
Contributor

SSE4 commented Mar 1, 2021

yes, sounds logical, feel free to submit a PR with suggested fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants