Closed mmuetzel closed 6 months ago
I want to point out that on Windows, there are two types of ecosystems: 1. Gnu-like toolchain and libraries from msys2, which won't use the Windows headers and standard libraries; 2. Native Win32 ecosystem with MSVC. The msys2 can have the gnu Clang compiler, but the Clang in LLVM for Windows is a frontend for the Win32 ecosystem (because clang and LLVM are not GNU so they are not bundled with GNU ecosystems), which relies on MSVC and uses native Win32 headers and libraries. Clang-cl is designed to be C++ ABI-compatible with MSVC, so the libraries are still using Win32 rules, which must have a .lib
for both dynamic and static targets.
The current CMakefiles and some complex-number-related codes didn't notice that other compilers can use the same libraries from MSVC (Windows SDK). The current CI of SuiteSparse only tests with MSVC for the native Windows ecosystem.
The reason to use clang with MSVC ecosystem: vcpkg mainly uses clang on Windows, and it can have a problem if we mix msys2 and native win32 libraries. Besides, MSVC only supports OpenMP 2.0 while clang on windows supports OpenMP 5.1. So I hope we can have a better solution on Windows.
Besides, MSVC only supports OpenMP 2.0 while clang on windows supports OpenMP 5.1. So I hope we can have a better solution on Windows.
As a work-around, you could use clang-cl
for the time being that also supports OpenMP 5.1 but is already correctly handled by the current build rules.
I'm working on a fix to correctly handle clang
from MSVC for this issue and will open a PR shortly.
See #752.
It will also have a problem to include "complex.h" when using the clang with the GNU command line on Windows. So maybe in that case the 2 issues should be solved together. Besides, we should notice that the ninja generator doesn't work well with clang-cl
:ninja issue.
It will also have a problem to include "complex.h"
That is a different issue. See #751
Besides, we should notice that the ninja generator doesn't work well with
clang-cl
If you are running into issues with the Ninja generator, using a Visual Studio generator with -TClangCl
might be an option.
Besides, we should notice that the ninja generator doesn't work well with
clang-cl
If you are running into issues with the Ninja generator, using a Visual Studio generator with
-TClangCl
might be an option.
Yes, but I found my vs doesn't have a ClangCL tool kit option, i think it requires installing Clang inside Visual Studio. I am looking forward to having better treatment for Windows compilers so we can avoid Visual Studio problems and only make it depend on Windows SDK.
This issue is fixed now and covered in CI.
In the closed issue #309, @chengts95 noted in the 30th comment:
Probable cause is using a version of LLVM Clang with MSVC backend.
@chengts95: Just to make sure that we are on the right track: Does it work if you use
clang-cl
instead ofclang
andclang++
?