-
Notifications
You must be signed in to change notification settings - Fork 981
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
[feature] add clang support on windows #9295
Comments
We would need a bit more details, please. We have MinGW tests in our test suite that pass for every commit, on Windows. Please extract from the conan-center thread the relevant details, and try to provide some minimum reproducible example (can we just try it with a Also, these might be 2 different features, don't hesitate to submit 2 separate issues, if they are actually different. |
Ok, totally make sense, I will change caption from 'add clang and mingw support on windows' to 'add clang support on windows' A reproducible example you can find here: |
Maybe I have just filled a conan profile wrong? But I have tried different configurations... |
Well, this could also be that the ConanCenter The "legacy" build system integrations, which are the stable ones, and generated with Maybe a better |
I have re-written test code to use a 'hello' test. It still demonstrate the problem. Please, investigate. |
Here is the log output: Step 9/10 : RUN conan new hello/0.1 -m v2_cmake Installing (downloading, building) binaries... |
I have managed to get it working with LLVM-clang 12:
There are a couple of unknowns/unmodeled for this, for example which libstdc++ is using (the MSVC one, and it seems the latest installed one MSVC 16 in my case, but this seems a bit uncontrolled). Definitely this needs some further testing, UI improvements and documentation, both for "clang" and "clang-cl" styles, and also both in Windows and Linux. |
It is still failing in docker. Could you please try to compile this docker on your side?
Installing (downloading, building) binaries...
is not able to compile a simple test program. It fails with the following output:
CMake will not be able to correctly generate this project. -- Configuring incomplete, errors occurred! |
@memsharded @jgsogo , I have already samples for MSVC, mingw and clang (the last one does not work yet). Should I commit them to docker tools? |
I still have this problem: Click to expand log
|
it seems like it needs libraries from Windows SDK:
have you installed them in your image? I don't think clang redistributes Microsoft libraries. |
linking to the #1839 |
Thanks for the hint, that brings me a bit further to this error: Configuring environment variables
is not able to compile a simple test program. It fails with the following output:
|
Clang on Windows is not self-sufficient. Why not just use clang-cl, you have to install VS anyway? |
these files are not part of the Windows SDK, they are Visual Studio runtime libraries. I don't know if they could be installed without Visual Studio (or Visual Studio build tools). |
The import lib for C runtime library (UCRT) is included in Win SDK.
https://docs.microsoft.com/en-us/cpp/c-runtime-library/crt-library-features?view=msvc-160 |
I want to build in Docker and size of an image is very important. Installing minimal Visual Studio takes 5-8GB. It's not acceptable. |
I am adding tests to our test suite in https://github.com/conan-io/conan/pull/9477/files, so far:
|
Based on the feedback above, at this point seems more an environment setup issue, related to that microsoft tools in that docker image, not a Conan issue? |
A question: does the toolchain |
Good question, the thing is that the test output is: assert "main __clang_major__12" in client.out
# Check this! Clang compiler in Windows is reporting MSC_VER and MSVC_LANG!
assert "main _MSC_VER19" in client.out
assert "main _MSVC_LANG2014" in client.out So clang in windows itself is reporting some MSVC variables, but I think that it doesn't need VS to be installed at all, though it might need the runtime redistributable to run. |
The question of only using llvm on Windows comes up regularly. I would say not yet. But actually only you can answer this question for your project. You can try lld linker and see what happens. But you will need Windows SDK in any case. e.g. here rust-lang/rust#71520 or https://users.rust-lang.org/t/can-i-compile-on-windows-using-nothing-but-the-llvm-toolchain/25683 |
The next problem will be that many recipes are not designed for this at all. Search for compiler != "Visual Studio" and you will see that in this case Mingw is assumed. Please check conan-io/conan-center-index#6155 too. |
yes, same story about other compilers, e.g. Intel - it also installs on top of Visual Studio and requires it, and it also will fail for checks like |
Sure, this is the reason we are putting some effort into this issue, the idea is to keep adding testing and improving the new build system integrations like CMakeToolchain, so it is not necessary to check those conditionals in recipes directly in many cases. For other cases that is necessary, sure, that would be a recipe issue and can be discussed in the recipe or conancenter repo. |
#9477 is merging tests that verify that clang is supported on Windows, at least for the 2 most relevant cases (independent clang and MSVC integrated clang), so considering this solved. Please report detailed failures of the integration, it would be great if possible to use the new tests in the test suite. Thanks! |
@memsharded This is exciting news! Which conan release version will include these changes? |
@mcandre Conan 1.40 to be released tomorrow contains the ClangCL necessary change in CMakeToolchain, but the independent clang should work with 1.39 too. |
Relates to conan-io/conan-center-index#6414 (comment)
If I try to compile with clang, that is not coming from MSVC, conan still try to use it as a MSVC toolchain
MinGW also does not work for windows.
The text was updated successfully, but these errors were encountered: