ghc-toolchain: Build should set `-package-env=-`
Summary
I had cabal install --lib
some libraries globally, which through the package-env mechanism caused the build of ghc-toolchain
to fail in the following way:
utils/ghc-toolchain/src/GHC/Toolchain/Monad.hs:32:1: error:
Could not load module `Control.Monad.Trans.Class'
It is a member of the hidden package `transformers-0.6.1.0'.
You can run `:set -package transformers' to expose it.
(Note: this unloads all the modules in the current scope.)
It is a member of the hidden package `transformers-0.5.6.2'.
You can run `:set -package transformers' to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v (or `:set -v` in ghci) to see a list of the files searched for.
|
32 | import Control.Monad.Trans.Class
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
I resolved this via the following diff:
diff --git a/m4/ghc_toolchain.m4 b/m4/ghc_toolchain.m4
index 128b285aee..6f3fa1c703 100644
--- a/m4/ghc_toolchain.m4
+++ b/m4/ghc_toolchain.m4
@@ -148,6 +148,7 @@ AC_DEFUN([FIND_GHC_TOOLCHAIN_BIN],[
-ilibraries/ghc-platform/src -iutils/ghc-toolchain/src \
-XNoImplicitPrelude \
-odir actmp-ghc-toolchain -hidir actmp-ghc-toolchain \
+ -package-env=- \
utils/ghc-toolchain/exe/Main.hs -o acghc-toolchain || AC_MSG_ERROR([Could not compile ghc-toolchain])
GHC_TOOLCHAIN_BIN="./acghc-toolchain"
;;
Which I will upstream momentarily.