Skip to content

None of the basic build instructions work to build GHC (for Ubuntu 22.04)

Summary

None of the build instructions seem to work.

I see that the make system is being retired, so I'm not surprised it doesn't work on HEAD, but it also doesn't seem to work on ghc-9.4.2, nor does the hadrian system (default instructions) work on either. It also seems others have had issue with the documentation being out of date, but I'm not sure if this was before or after the latest documentation updates.

I've tried make, hadrian, and docker with a couple different bootstrapping / target compiler pairs

Notes:

  • I realize the docker instructions are their own issue for https://github.com/gregwebs/ghc-docker-dev but I tried it as a last resort and included it for completeness
  • It seems like the core issue is haddock trying to use the newer GHC or incorrect version bounds or something so maybe there's a simple build reconfiguration that will work.
  • Any info on system configuration of people successfully building with the default hadrian build is greatly appreciated too. I'm sure someone somewhere is building successfully!

Steps to reproduce

git clone --recurse-submodules git@gitlab.haskell.org:ghc/ghc.git
$ cd ghc
$ sudo apt-get build-dep ghc
$ ./boot
$ ./configure

I've tried a few alternate paths (each with fresh clone):

boostrapping HEAD via GHC 9.4.2 with make

(Note the mk/build.mk.sample and mk/build.mk files don't ever exist but are still referred to in the documentation)

----------------------------------------------------------------------
Configure completed successfully.

   Building GHC version  : 9.5.20220908
          Git commit id  : 9c4ea90c6b493eee6df1798c63a6031cc18ae6da

   Build platform        : x86_64-unknown-linux
   Host platform         : x86_64-unknown-linux
   Target platform       : x86_64-unknown-linux

   Bootstrapping using   : /home/dai/.ghcup/bin/ghc
      which is version   : 9.4.2
      with threaded RTS? : YES

   Using (for bootstrapping) : gcc
   Using gcc                 : /usr/bin/gcc
      which is version       : 11.2.0
      linker options         : -fuse-ld=gold
   Building a cross compiler : NO
   Unregisterised            : NO
   TablesNextToCode          : YES
   Build GMP in tree         : NO
   hs-cpp       : /usr/bin/gcc
   hs-cpp-flags : -E -undef -traditional
   ar           : /usr/bin/ar
   ld           : ld.gold
   nm           : /usr/bin/nm
   objdump      : /usr/bin/objdump
   ranlib       : /usr/bin/ranlib
   otool        : otool
   install_name_tool : install_name_tool
   windres      : 
   dllwrap      : 
   genlib       : 
   Happy        : /home/dai/.cabal/bin/happy (1.20.0)
   Alex         : /home/dai/.cabal/bin/alex (3.2.7.1)
   sphinx-build : /usr/bin/sphinx-build
   xelatex      : /usr/bin/xelatex
   makeinfo     : /usr/bin/makeinfo
   git          : /usr/bin/git
   cabal-install : /home/dai/.ghcup/bin/cabal

   Using LLVM tools
      clang : clang
      llc   : llc-13
      opt   : opt-13
   HsColour : /home/dai/.cabal/bin/HsColour

   Tools to build Sphinx HTML documentation available: YES
   Tools to build Sphinx PDF documentation available: YES
   Tools to build Sphinx INFO documentation available: NO
----------------------------------------------------------------------


$ make
make: *** No targets specified and no makefile found.  Stop.

Bootstrapping HEAD via ghc 9.4.2 with hadrian

$ hadrian/build -j
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: hadrian-0.1.0.0 (user goal)
[__1] trying: hadrian:+selftest
[__2] trying: QuickCheck-2.14.2 (dependency of hadrian +selftest)
[__3] trying: splitmix-0.1.0.4 (dependency of QuickCheck)
[__4] next goal: base (dependency of hadrian)
[__4] rejecting: base-4.17.0.0/installed-4.17.0.0 (conflict: splitmix =>
base>=4.3 && <4.17)
[__4] rejecting: base-4.16.1.0, base-4.16.0.0, base-4.15.1.0, base-4.15.0.0,
base-4.14.3.0, base-4.14.2.0, base-4.14.1.0, base-4.14.0.0, base-4.13.0.0,
base-4.12.0.0, base-4.11.1.0, base-4.11.0.0, base-4.10.1.0, base-4.10.0.0,
base-4.9.1.0, base-4.9.0.0, base-4.8.2.0, base-4.8.1.0, base-4.8.0.0,
base-4.7.0.2, base-4.7.0.1, base-4.7.0.0, base-4.6.0.1, base-4.6.0.0,
base-4.5.1.0, base-4.5.0.0, base-4.4.1.0, base-4.4.0.0, base-4.3.1.0,
base-4.3.0.0, base-4.2.0.2, base-4.2.0.1, base-4.2.0.0, base-4.1.0.0,
base-4.0.0.0, base-3.0.3.2, base-3.0.3.1 (constraint from non-upgradeable
package requires installed instance)
[__4] fail (backjumping, conflict set: base, hadrian, splitmix)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: base, QuickCheck, splitmix, hadrian,
hadrian:selftest
Try running with --minimize-conflict-set to improve the error message.

Bootstrapping ghc-9.4 via ghc 9.4.2 with make

$ git checkout ghc-9.4
$ cp mk/build.make.sample mk/build.make
$ ./boot
$ ./configure
$ make
# ...
===--- building phase 0
make --no-print-directory -f ghc.mk phase=0 phase_0_builds
ghc.mk:141: *** The make build system requires a boot compiler older than ghc-9.2. Your boot compiler is too new and cannot be used to build ghc-9.4 with make. Either boot with ghc 9.0.2 or build with hadrian. See https://www.haskell.org/ghc/blog/20220805-make-to-hadrian.html for advice on transitioning to hadrian..  Stop.
make: *** [Makefile:124: all] Error 2

Bootstrapping ghc-9.4 via ghc 9.0.2 with make

$ ghcup set ghc 9.0.2
$ ./boot
$ ./configure
#...
----------------------------------------------------------------------
Configure completed successfully.

   Building GHC version  : 9.4.2
          Git commit id  : e8a889a7fc670532a3bf883a3e25acba92e6e6e1

   Build platform        : x86_64-unknown-linux
   Host platform         : x86_64-unknown-linux
   Target platform       : x86_64-unknown-linux

   Bootstrapping using   : /home/dai/.ghcup/bin/ghc
      which is version   : 9.0.2
      with threaded RTS? : YES
     can boot with make? : YES

   Using (for bootstrapping) : gcc
   Using gcc                 : /usr/bin/gcc
      which is version       : 11.2.0
      linker options         : -fuse-ld=gold
   Building a cross compiler : NO
   Unregisterised            : NO
   TablesNextToCode          : YES
   Build GMP in tree         : NO
   hs-cpp       : /usr/bin/gcc
   hs-cpp-flags : -E -undef -traditional
   ar           : /usr/bin/ar
   ld           : ld.gold
   nm           : /usr/bin/nm
   libtool      : libtool
   objdump      : /usr/bin/objdump
   ranlib       : /usr/bin/ranlib
   otool        : otool
   install_name_tool : install_name_tool
   windres      : 
   dllwrap      : 
   genlib       : 
   Happy        : /home/dai/.cabal/bin/happy (1.20.0)
   Alex         : /home/dai/.cabal/bin/alex (3.2.7.1)
   sphinx-build : /usr/bin/sphinx-build
   xelatex      : /usr/bin/xelatex
   makeinfo     : /usr/bin/makeinfo
   git          : /usr/bin/git
   cabal-install : /home/dai/.ghcup/bin/cabal

   Using LLVM tools
      clang : clang
      llc   : llc-13
      opt   : opt-13
   HsColour : /home/dai/.cabal/bin/HsColour

   Tools to build Sphinx HTML documentation available: YES
   Tools to build Sphinx PDF documentation available: YES
   Tools to build Sphinx INFO documentation available: YES
----------------------------------------------------------------------
$ make
# ...
Error: ghc-cabal: Encountered missing or private dependencies:
ghc >=9.5 && <9.6

make[1]: *** [utils/haddock/ghc.mk:20: utils/haddock/dist/package-data.mk] Error 1
make: *** [Makefile:126: all] Error 2

similarly for hadrian:

Bootstrapping ghc-9.4 via 9.0.2 with hadrian

$ ./boot
$ ./configure
$ hadrian/build -j
# ...
| Configure package 'haddock'
# cabal-configure (for _build/stage0/utils/haddock/setup-config)
# cabal-configure (for _build/stage0/ghc/setup-config)
hadrian: Encountered missing or private dependencies:
ghc >=9.5 && <9.6

ExitFailure 1
Build failed.

As a final attempt, the docker's GHC version is out of date:

$ sudo docker run --rm -i -t -v `pwd`:/home/ghc gregweber/ghc-haskell-dev /bin/bash
checking for gfind... no
checking for find... /usr/bin/find
checking for sort... /usr/bin/sort
checking for GHC Git commit id... inferred e8a889a7fc670532a3bf883a3e25acba92e6e6e1
checking for ghc... /opt/ghc/8.4.4/bin/ghc
checking version of ghc... 8.4.4
configure: error: GHC version 9.0 or later is required to compile GHC.

Expected behavior

What do you expect the reproducer described above to do?

Environment

  • GHC version used:

Optional:

  • Operating System:
  • System Architecture:
Edited by sheaf
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information