Skip to content

Bootstrap of ghc doesn’t do DESTDIR correctly, propagates build dir

Summary

The bootstrap of ghc doesn’t do DESTDIR correctly, embeds the build directory into the ghc binary, and propagates the build directory to binaries built using bootstrapped ghc.

This is embedded in the ghc binary in several places:

vi /opt/local/lib/ghc-8.10.4/bin/ghc

^@/opt/local/var/macports/build/_opt_local_ports_lang_ghc/ghc/work/src/ghc-8.10.4/rts/dist/build^@

Also:

fgrep "/opt/local/var/macports/build" /opt/local/lib/ghc-8.10.4/bin/ghc
Binary file /opt/local/lib/ghc-8.10.4/bin/ghc matches

Looking at binaries built with this bootstrapped ghc shows that the issue propagates.

Here is the binary for pandoc, built using cabal 3.4.0.0 and this ghc-8.10.4 binary:

fgrep "/opt/local/var/macports/build/_opt_local_ports_lang_ghc/ghc/work/src/ghc-8.10.4/rts" /opt/local/bin/pandoc
Binary file /opt/local/bin/pandoc matches

Steps to reproduce

The Portfile simply implements ghc's basic quick start build instructions.

Expected behavior

No build directories in the ghc binary, or binaries built using it.

Environment

  • GHC version used: 8.10.4

Optional:

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