mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
Fix MacOS version linking issues (#5868)
This should fix the following issue that we see constantly on CI: ``` ld: warning: object file _ was built for newer OSX version (10.15) than being linked (10.14) ``` The issue was that the CC toolchain was not fully used in haskell_cabal_package. --with-gcc (which is really --with-cc) only applies when Cabal is calling the C compiler. However, in most cases it is actually GHC itself which calls the C compiler. To make sure that the right compiler is used in those cases, we have to pass `-pgmc` and friends to GHC. This matches what rules_haskell does for non cabal targets. changelog_begin changelog_end
This commit is contained in:
parent
0c8bf80c6d
commit
a47c734401
@ -363,6 +363,10 @@ haskell_register_ghc_nixpkgs(
|
|||||||
"-fexternal-dynamic-refs",
|
"-fexternal-dynamic-refs",
|
||||||
] + (["-g3"] if enable_ghc_dwarf else ([
|
] + (["-g3"] if enable_ghc_dwarf else ([
|
||||||
"-optl-unexported_symbols_list=*",
|
"-optl-unexported_symbols_list=*",
|
||||||
|
"-optc-mmacosx-version-min=10.14",
|
||||||
|
"-opta-mmacosx-version-min=10.14",
|
||||||
|
"-optl-mmacosx-version-min=10.14",
|
||||||
|
"-optP-mmacosx-version-min=10.14",
|
||||||
] if is_darwin else ["-optl-s"])),
|
] if is_darwin else ["-optl-s"])),
|
||||||
compiler_flags_select = {
|
compiler_flags_select = {
|
||||||
"@com_github_digital_asset_daml//:profiling_build": ["-fprof-auto"],
|
"@com_github_digital_asset_daml//:profiling_build": ["-fprof-auto"],
|
||||||
|
23
bazel_tools/haskell-pgmc.patch
Normal file
23
bazel_tools/haskell-pgmc.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
diff --git a/haskell/private/cabal_wrapper.py.tpl b/haskell/private/cabal_wrapper.py.tpl
|
||||||
|
index 81269cc7..35c24cf4 100755
|
||||||
|
--- a/haskell/private/cabal_wrapper.py.tpl
|
||||||
|
+++ b/haskell/private/cabal_wrapper.py.tpl
|
||||||
|
@@ -143,6 +143,18 @@ with tmpdir() as distdir:
|
||||||
|
"--with-hc-pkg=" + ghc_pkg,
|
||||||
|
"--with-ar=" + ar,
|
||||||
|
"--with-gcc=" + cc,
|
||||||
|
+ "--ghc-option=-pgmc=" + cc,
|
||||||
|
+ "--ghc-option=-pgma=" + cc,
|
||||||
|
+ "--ghc-option=-pgmP=" + cc,
|
||||||
|
+ "--ghc-option=-pgml=" + cc,
|
||||||
|
+ # Setting -pgm* flags explicitly has the unfortunate side effect
|
||||||
|
+ # of resetting any program flags in the GHC settings file. So we
|
||||||
|
+ # restore them here. See
|
||||||
|
+ # https://ghc.haskell.org/trac/ghc/ticket/7929.
|
||||||
|
+ "--ghc-option=-optc-fno-stack-protector",
|
||||||
|
+ "--ghc-option=-optP-E",
|
||||||
|
+ "--ghc-option=-optP-undef",
|
||||||
|
+ "--ghc-option=-optP-traditional",
|
||||||
|
"--with-strip=" + strip,
|
||||||
|
"--enable-deterministic", \
|
||||||
|
] +
|
@ -50,6 +50,7 @@ def daml_deps():
|
|||||||
"@daml//bazel_tools:haskell-strict-source-names.patch",
|
"@daml//bazel_tools:haskell-strict-source-names.patch",
|
||||||
"@daml//bazel_tools:haskell-windows-remove-fake-libs.patch",
|
"@daml//bazel_tools:haskell-windows-remove-fake-libs.patch",
|
||||||
"@daml//bazel_tools:haskell-windows-extra-libraries.patch",
|
"@daml//bazel_tools:haskell-windows-extra-libraries.patch",
|
||||||
|
"@daml//bazel_tools:haskell-pgmc.patch",
|
||||||
],
|
],
|
||||||
patch_args = ["-p1"],
|
patch_args = ["-p1"],
|
||||||
sha256 = rules_haskell_sha256,
|
sha256 = rules_haskell_sha256,
|
||||||
|
2
deps.bzl
2
deps.bzl
@ -73,6 +73,8 @@ def daml_deps():
|
|||||||
# This should be made configurable in rules_haskell.
|
# This should be made configurable in rules_haskell.
|
||||||
# Remove this patch once that's available.
|
# Remove this patch once that's available.
|
||||||
"@com_github_digital_asset_daml//bazel_tools:haskell-opt.patch",
|
"@com_github_digital_asset_daml//bazel_tools:haskell-opt.patch",
|
||||||
|
# This can be upstreamed.
|
||||||
|
"@com_github_digital_asset_daml//bazel_tools:haskell-pgmc.patch",
|
||||||
],
|
],
|
||||||
patch_args = ["-p1"],
|
patch_args = ["-p1"],
|
||||||
sha256 = rules_haskell_sha256,
|
sha256 = rules_haskell_sha256,
|
||||||
|
Loading…
Reference in New Issue
Block a user