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
[question] improve windows clang handling in conan #10955
Comments
The problem with this is that is very likely that users will start requesting immediately some kind of binary compatibility between both, because it is basically the same compiler, with different front/cli syntax. So it totally makes sense that they are considered compatible/same binaries. The same that happens with We would need to understand better some things like the Also, the best would be to "divide and conquer" the different scenarios, from most requested to least one, and specially focusing on the build system integrations, like CMake. So far we have tests for |
it's true, the compiler is the same, and they should be compatible to some degree. still, it turns out there are some differences between their defaults, e.g. I got:
attaching the full outputs, just in case
therefore, binaries produced by them are different in general case. I would just add |
Where can I find this tests? I have tried locally and both clang from msvc and clang-cl from choco-llvm failed for me conan new hello/0.1 -m=cmake_lib |
as I can see, there is one test: https://github.com/conan-io/conan/blob/develop/conans/test/functional/toolchains/cmake/test_cmake_toolchain_win_clang.py |
it would take me a time to understand the differences betwen these installations, and how to use them, to figure out what's the
while Microsoft one (coming with Visual Studio):
notice |
I have installed clang, using 'choco install llvm' and my version looks like: and clang-cl shows the same: |
that's probably the one from llvm.org. I installed one from Visual Studio itself. |
There is no much difference between them for me: |
might be a helpful link: https://www.msys2.org/docs/environments/
summary for MSYS variants:
|
The targets |
I don't think MSYS and MSVC targets are fully compatible, as MSYS has its own sets of defines such as and for sure GNU is diifferent from MSVC: I would just assume (from conan's perspective) |
Hmm, totally forgot about msys having different macros. |
so, do we have a conclusion now? possible set of settings could look like:
|
@memsharded please tell us if you need anything else to make a decision. I can collect all the needed information about various |
@memsharded is windows-clang improvment on the roadmap? |
I think it's on roadmap now, it's got assigned 1.49 milestone. |
Resuming work on this. Lets try to summarize current status and support, and see what pieces are missing Native Windows builds: (With MinGW Makefiles or Ninja)
Profile (assuming clang is in the system PATH):
Compiler:
This approach will work if defining CC/CXX vars pointing to the clang installation, or adding the Clang bin dir to PATH (both via If using Ninja, check
Please check the test, the approach, test it ( |
if it's a native Windows build ( |
Because this is what apparently it is more popular among users, NMake usage is in general much, much lower than Makefiles or Ninja generators. Furthermore, it doesn't work out of the box with
NMake Makefiles should work, but I have tried with different versions of CMake, and it fails in different ways.
|
that sounds suspicious. do you have any reference? because, I assume most of people just have Visual Studio + LLVM installed (or even just Visual Studio + LLVM component selected in its installer). they don't usualy have MinGW installed.
if it doesn't work out of the box, it's sad. I can take a look later today and will let you know. |
Just my understanding from doing Conan support and talking to users:
As you can see there is an order of magnitude. I know it doesn't necessarily apply to Clang in Windows, but adding "Clang" to the search, still seems more popular. My feeling is that users try to avoid NMake, as it is slightly more complex and problematic than the other alternatives. |
I would say it's 'survivorship bias' to judge about popularity of tools by issues ammount. How can I try conan from a branch? are there any instructions for it? |
|
I suppose we're still mixing the things here... nevertheless, here are my testing results. it passes with
I've just hard-coded some values, but in order to use it properly, we need to locate Visual Studio installation (for vcvars). a similar thing will be needed not just for CMake, but for other build systems. in general, I am most concerned about recipes. IMO they should just work out of the box for |
This isn't really true. The build system used is irrelevant, being it MinGW, Ninja or NMake, the result is the same. The usage of VS installation is hardcoded in clang itself, so the resulting binary is basically the same, in three cases, using the VS libraries. By default, it uses latest VS 2022, but this can be changed by activating the Alternatives:
I am moving this to next iteration, as 1.49 is branching today or tomorrow, and this requires more time and discussion. |
the thing is but in reality, yes, binary should be the same, regardless of the CMake generator (unless so I assume we can say (saying here about |
not sure if I like it. it's the same
yes, that might be needed.
sounds a bit confusing. possible targets are:
do we say |
mingw's gcc supports two thread models: win32 & posix. |
and there's also llvm-mingw, which while still using mingw windows headers, it uses llvm's toolchain, libc++ plus msvcrt/ucrt |
This PR #11492, merged for next 1.53 contains a few changes to better support clang in Windows, mainly for the new There are some other pending issues about the Windows subsystems environment management, we are also trying to improve them in #12178, so if you are using Clang in some subsystem and depend on the environment, you might want to track this PR too. Closing this issue now, but we know that there might still be some gaps, so please try to update to the new integration (this is necessary for 2.0 anyway), and report what might still be failing against this new integration. The best starting point would be the tests in https://github.com/conan-io/conan/blob/develop/conans/test/functional/toolchains/cmake/test_cmake_toolchain_win_clang.py, or using any of the predefined templates |
I think it was closed prematurely, it's still unclear how to distinguish all these clang flavors in conan. #11492 has |
Changed #11492 docs to TBD, and I am also writing a blog post about it. |
Looking forward for conan 1.54! |
This has been released already in 1.53! it is missing docs, but we are writing a blog post and will translate to docs later too. |
There are many ways how to use clang on windows and we need to define how to handle most of them.
Usecases are:
GNU-style, using gcc runtime and command line
compiler=clang CC=clang.exe
MSVC-style, using MSVC runtime and command line
compiler=clang CC=clang-cl.exe
MSVC toolset
compiler=Visual Studio toolset=ClangCL
The main problem is that we can't differentiate the first two cases.
The easiest solution, from my point of view, if to treat clang and clang-cl as two different compilers.
What are your thoughts?
@memsharded
@lasote
@danimtb
@jgsogo
@czoido
@SSE4
@uilianries
@madebr
@SpaceIm
@ericLemanissier
@prince-chrismc
@Croydon
The text was updated successfully, but these errors were encountered: