Skip to content

Building GHC on an Ubuntu WSL2 install fails with incorrect complaints about missing files

Summary

First of all, I'm not sure if this can be fixed on the GHC side, but at the very least I want to record the issue, in case other people encounter the same problem and are looking for a workaround: Using an Arch WSL2 installation works for me.

When building GHC on an Ubuntu installation on WSL2 with hadrian/build -j, it results in a variety of errors, with the common theme that some file is not found - though when I check manually, every file it complains about exists. I encountered this same issue on two separate machines.

Example errors:

_build/stage0/lib/../lib/x86_64-linux-ghc-8.10.4/template-haskell-2.17.0.0/Language/Haskell/TH/Syntax.hi: setFileMode: does not exist (No such file or directory)
_build/stage0/lib/../lib/x86_64-linux-ghc-8.10.4/hpc-0.6.1.0/libHShpc-0.6.1.0.a: setFileMode: does not exist (No such file or directory)

A few times I also encountered a missing file error unrelated to setFileMode, though I don't have the exact error messages noted down - these include, for example, rule finished running but did not produce file for .../autogen/cabal_macros.h, a file which then was also present when I checked.

Steps to reproduce

  • Set up WSL2
  • Install Ubuntu for WSL2 from the Microsoft store
  • follow the steps described at https://ghc.dev to build ghc

I encountered the same errors when following the process described in the Building Guide followed by hadrian/build -j

Expected behavior

the GHC build should be successful, as it is on Arch on WSL2

Environment

  • GHC version used: 9.1.20210214

Optional:

  • Operating System: Ubuntu on WSL2 on Windows
  • System Architecture: x86_64
Edited by Jakob Brünker
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information