diff --git a/haskell/private/actions/link.bzl b/haskell/private/actions/link.bzl index 14dc9e8b2..24ddd585f 100644 --- a/haskell/private/actions/link.bzl +++ b/haskell/private/actions/link.bzl @@ -1,5 +1,6 @@ """Actions for linking object code produced by compilation""" +load("@bazel_skylib//lib:dicts.bzl", "dicts") load(":private/packages.bzl", "expose_packages", "pkg_info_to_compile_flags") load(":private/pkg_id.bzl", "pkg_id") load(":private/cc_libraries.bzl", "create_link_config") @@ -186,6 +187,7 @@ def link_binary( mnemonic = "HaskellLinkBinary", arguments = args, params_file = objects_dir_manifest, + env = dicts.add(hs.env, cc.env), ) return (executable, dynamic_libs) @@ -368,6 +370,7 @@ def link_library_dynamic(hs, cc, posix, dep_info, extra_srcs, objects_dir, my_pk mnemonic = "HaskellLinkDynamicLibrary", arguments = args, params_file = objects_dir_manifest, + env = dicts.add(hs.env, cc.env), ) return dynamic_library diff --git a/haskell/toolchain.bzl b/haskell/toolchain.bzl index e4e92a61f..68a7b7928 100644 --- a/haskell/toolchain.bzl +++ b/haskell/toolchain.bzl @@ -19,10 +19,7 @@ load(":cc.bzl", "ghc_cc_program_args") _GHC_BINARIES = ["ghc", "ghc-pkg", "hsc2hs", "haddock", "ghci", "runghc", "hpc"] -def _run_ghc(hs, cc, inputs, outputs, mnemonic, arguments, params_file = None, env = None, progress_message = None, input_manifests = None): - if not env: - env = hs.env - +def _run_ghc(hs, cc, inputs, outputs, mnemonic, arguments, env, params_file = None, progress_message = None, input_manifests = None): args = hs.actions.args() extra_inputs = []