daml/bazel_tools/haskell-windows-extra-libraries.patch
Moritz Kiefer 8a7aaa0c3d
Fix Windows linking issues (#13097)
I have to admit I still fdon’t fully understand why this sometimes
fails and sometimes doesn’t. It looks like some caching issue is
involved (e.g. currently builds in /d/a/2 succeed while builds in
/d/a/1 succed) but I’m not entirely sure that’s all.

This PR tries to address this in two ways:

1. Add the library when linking the Haskell bits instead of only on
the C library. I think this is required since we the final Haskell
binary is linked against the static cbits which does not carry a
reference to bcrypt but I’m not completely sure.
2. Rename the target to avoid interference with builds from before the
grpc upgrade. I suspect what is happening is that due to the lack of
sandboxing we sometimes end up picking up that library if it is in the
build tree from an older build instead of the new one.

changelog_begin
changelog_end
2022-02-28 08:35:30 +01:00

20 lines
843 B
Diff

diff --git a/haskell/private/actions/package.bzl b/haskell/private/actions/package.bzl
index fddf30fd..564da872 100644
--- a/haskell/private/actions/package.bzl
+++ b/haskell/private/actions/package.bzl
@@ -105,7 +105,13 @@ def package(
"library-dirs": [pkgroot_lib_path] + extra_lib_dirs,
"dynamic-library-dirs": [pkgroot_lib_path] + extra_dynamic_lib_dirs,
"hs-libraries": [pkg_id.library_name(hs, my_pkg_id)] if has_hs_library else [],
- "extra-libraries": extra_libs,
+ "extra-libraries": extra_libs + ([
+ "stdc++",
+ "crypt32",
+ "shlwapi",
+ "ws2_32",
+ "bcrypt",
+ ] if hs.toolchain.is_windows else []),
"depends": hs.package_ids,
# TODO[AH] Add haskell_module modules
"exposed-modules": exposed_modules,