forked from digital-asset/daml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update rules_haskell and static GHC (digital-asset#1515)
* Update rules_haskell and static GHC Remove patches that have been upstreamed or are no longer required. Update still required patches to match the new rules_haskell version. Previously we patched rules_haskell to coerce GHC into using static Haskell libraries in most places. In particular we moved hs-libraries entries into extra-libraries entries in the package configuration files. A much cleaner approach is to compile GHC with a static RTS, then GHC will by itself choose to load static Haskell libraries. * Remove haskell_cc_import * da-hs-daml-cli -> daml-cli * da-hs-damlc-app -> damlc-app
- Loading branch information
1 parent
6919b07
commit 93d8e01
Showing
59 changed files
with
132 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
rules_haskell generates symbolic links for dynamic library dependencies to | ||
avoid too long load commands and too many RUNPATH commands and to convert .so | ||
file extensions to .dylib file extensions on MacOS. On Windows creating the | ||
symbolic links can fail due to too long file paths. The symlinks are only | ||
really required on MacOS, so we limit their creation to MacOS. | ||
diff --git a/haskell/providers.bzl b/haskell/providers.bzl | ||
index 7574456..e5b7c2e 100644 | ||
--- a/haskell/providers.bzl | ||
+++ b/haskell/providers.bzl | ||
@@ -266,7 +266,7 @@ def get_extra_libs(hs, cc_info, dynamic = False, pic = None, fixup_dir = "_libs" | ||
elif lib_to_link.static_library and not pic_required: | ||
static_lib = lib_to_link.static_library | ||
|
||
- if dynamic_lib: | ||
+ if dynamic_lib and hs.toolchain.is_darwin: | ||
dynamic_lib = symlink_dynamic_library(hs, dynamic_lib, fixed_lib_dir) | ||
static_lib = mangle_static_library(hs, dynamic_lib, static_lib, fixed_lib_dir) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
On MacOS GHCi fails to load grpc fat_cbits statically due to duplicate symbols. | ||
diff --git a/haskell/providers.bzl b/haskell/providers.bzl | ||
index 7574456..a5241e1 100644 | ||
--- a/haskell/providers.bzl | ||
+++ b/haskell/providers.bzl | ||
@@ -270,6 +270,10 @@ def get_extra_libs(hs, cc_info, dynamic = False, pic = None, fixup_dir = "_libs" | ||
dynamic_lib = symlink_dynamic_library(hs, dynamic_lib, fixed_lib_dir) | ||
static_lib = mangle_static_library(hs, dynamic_lib, static_lib, fixed_lib_dir) | ||
|
||
+ if fixup_dir == "_ghci_libs" and dynamic_lib and get_lib_name(dynamic_lib) == "fat_cbits": | ||
+ dynamic_libs.append(dynamic_lib) | ||
+ continue | ||
+ | ||
if static_lib and not (dynamic and dynamic_lib): | ||
static_libs.append(static_lib) | ||
elif dynamic_lib: |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Some packages, network in particular, require to link additional libraries to | ||
avoid missing symbol errors when linking on Windows. | ||
diff --git a/haskell/private/actions/package.bzl b/haskell/private/actions/package.bzl | ||
index 2b56388..0c5c37c 100644 | ||
--- a/haskell/private/actions/package.bzl | ||
+++ b/haskell/private/actions/package.bzl | ||
@@ -107,7 +107,12 @@ def package( | ||
"library-dirs": ["${pkgroot}"] + extra_lib_dirs, | ||
"dynamic-library-dirs": ["${pkgroot}"] + extra_lib_dirs, | ||
"hs-libraries": [pkg_id.library_name(hs, my_pkg_id)], | ||
- "extra-libraries": extra_libs, | ||
+ "extra-libraries": extra_libs + ([ | ||
+ "stdc++", | ||
+ "crypt32", | ||
+ "shlwapi", | ||
+ "ws2_32", | ||
+ ] if hs.toolchain.is_windows else []), | ||
"depends": hs.package_ids, | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.