Skip to content

Commit

Permalink
Remove libc++.dll.a to enforce static linking to libc++
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
avdv committed Oct 18, 2023
1 parent eac633c commit 3bf3c0b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions haskell/ghc_bindist.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 3bf3c0b

Please sign in to comment.