Describe the bug
cabal build doesn't respect user-provided ghc-pkg path (in some circumstances), causing version mismatch between compiler and compiler-package commands. This occurs which using GHCup-managed WASM GHC toolchain
Cloning into '/root/cabal-wasm-bug/dist-newstyle/src/miso-7fdae9da4bdb552ef2daf21700284a28ca9d60f6abf96b737c89243d4bad27dc'...
remote: Enumerating objects: 194, done.
remote: Counting objects: 100% (194/194), done.
remote: Compressing objects: 100% (164/164), done.
remote: Total 194 (delta 26), reused 93 (delta 6), pack-reused 0 (from 0)
Receiving objects: 100% (194/194), 266.10 KiB | 5.91 MiB/s, done.
Resolving deltas: 100% (26/26), done.
From https://github.com/dmjio/miso
* branch 2e8dd81f9731229f83cac6137843ec3a9d498b86 -> FETCH_HEAD
HEAD is now at 2e8dd81 Reset `components` global state on hydration failure. (#1299)
Error: [Cabal-4000]
Version mismatch between ghc and ghc-pkg: /root/.ghcup/bin/wasm32-wasi-ghc is version 9.12.2.20250327 /root/.ghcup/bin/ghc-pkg is version 9.6.7
To Reproduce
Follow the steps in https://github.com/andremarianiello/cabal-wasm-bug to reproduce the bug.
Expected behavior
I expect the project to build successfully using wasm GHC and cabal 3.16.0.0, just like with 3.14.2.0
System information
- Operating system
Linux - CentOS stream 9
cabal, ghc versions
Cabal
# cabal --version
cabal-install version 3.16.0.0
compiled using version 3.16.0.0 of the Cabal library (in-tree)
For ghc I am using WASM ghc 9.12.2. See README for details
Additional context
It seems like in 3.16.0.0 that cabal is choosing the ghc-pkg binary over the user-specified wasm32-wasi-ghc-pkg binary, so the build is failing. But this appears to have worked in 3.14.2.0.