From 3430a886570b585e57c10a84e7493daf69f3f945 Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Tue, 17 Oct 2023 10:34:10 +0200 Subject: [PATCH] Remove `libc++.dll.a` to enforce static linking to `libc++` Newer GHC bindists on Windows come with clang and libc++ instead of gcc and libstdc++. When linking, `.dll.a` files take precedence over the normal `.a` files and cause the resulting binary to depend on the corresponding DLL at runtime. Removing the files causes the linker to pick up the proper static library instead. --- haskell/ghc_bindist.bzl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/haskell/ghc_bindist.bzl b/haskell/ghc_bindist.bzl index 7eda2dd22a..0cbff65308 100644 --- a/haskell/ghc_bindist.bzl +++ b/haskell/ghc_bindist.bzl @@ -122,6 +122,9 @@ def _ghc_bindist_impl(ctx): # on //tests/haddock:haddock-lib-b. dll_a_libs.append("libz.dll.a") + # Similarly causes loading issues when using libc++ with clang on GHC >= 9.4 + dll_a_libs.append("libc++.dll.a") + # It's hard to guesss the paths of these libraries, so we have to use # dir to recursively find them. for lib in dll_a_libs: