[llvm] [bazel] Improve building on/for Windows (PR #171761)

David Zbarsky via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 16 08:28:11 PST 2025


================
@@ -297,7 +320,21 @@ cc_library(
     }),
     includes = ["include"],
     linkopts = select({
-        "@platforms//os:windows": [
+        ":is_windows_clang_mingw": [
+            "-lole32",
+            "-luuid",
+            "-lws2_32",
+            "-lntdll",
+        ],
+        ":is_windows_clang_cl": [
+            "ole32.lib",
+            "uuid.lib",
+            "ws2_32.lib",
+            "ntdll.lib",
+        ],
+        ":is_windows_msvc": [
----------------
dzbarsky wrote:

I'm not a windows expert by any means but this seems to be the only thing supported by rules_rust for example. I'm not sure who else (besides me) builds clang with bazel on windows, it must be a very small niche :) I think if it doesn't work for someone they'll complain and we can fix.

The real problem is I have no idea what to set the default to, picking either of these could lead to wrong flag formats being passed, I think it's nicer to get an analysis-time error due to `select` not matching

https://github.com/llvm/llvm-project/pull/171761


More information about the llvm-commits mailing list