daml/bazel_tools/haskell-drop-fake-static.patch
Nicolas Mattia f57c74d706 Build and run damlc on Windows (#568)
* Fix network build on Windows

Some files were not added to the build, which led missing symbols at
link time.

* Drop dll.a files from Windows GHC bindist

Those files greatly confuse GHC when linking statically.

* Add some Windows system libraries

These libraries are needed when linking GRPC.

* Statically link pthread on Windows

Otherwise the executables fail at runtime because they cannot find the
shared object.

* Build and run damlc on CI

* Try to fix package_db/* nullglob error

* Fix powershell command

* Cleanup package db rule

* Make formatting ugly again
2019-04-17 20:37:35 +00:00

19 lines
743 B
Diff

The presence of files with `dll.a` extensions greatly confuses GHC, so we
remove them for the libraries we link in.
diff --git a/haskell/ghc_bindist.bzl b/haskell/ghc_bindist.bzl
index 941bf18..f9f3276 100644
--- a/haskell/ghc_bindist.bzl
+++ b/haskell/ghc_bindist.bzl
@@ -201,6 +201,10 @@ def _ghc_bindist_impl(ctx):
_execute_fail_loudly(ctx, ["./configure", "--prefix", bindist_dir.realpath])
_execute_fail_loudly(ctx, ["make", "install"])
+ if os == "windows":
+ _execute_fail_loudly(ctx, ["rm", "mingw/lib/gcc/x86_64-w64-mingw32/7.2.0/libstdc++.dll.a"])
+ _execute_fail_loudly(ctx, ["rm", "mingw/x86_64-w64-mingw32/lib/libwinpthread.dll.a"])
+
ctx.template(
"BUILD",
ghc_build,