Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build GHC with cabal-install and a Makefile #3

Draft
wants to merge 156 commits into
base: tmp/make-build-offset
Choose a base branch
from

Conversation

hsyl20
Copy link

@hsyl20 hsyl20 commented Nov 27, 2024

Note that we need a patched cabal: https://github.com/hsyl20/cabal/tree/hsyl20/per-file-extra-source-options

  • Build ghc-stage1
  • Generate valid non-cross stage1 settings (reusing stage0's settings for the most part)
  • Build boot libraries with stage1: ghc-prim, ghc-internal, base
  • Build ghc-stage2
  • Build a bindist
  • For every host/arch we want to build a compiler for:
    • generate valid stage2 settings for the target (using ghc-toolchain?)
    • use ghc-stage2 with these settings to build root libraries
    • use ghc-stage2 with these settings to build iserv
    • (optional) use ghc-stage2 with these settings to cross-build a GHC
  • run the testsuite on CI

@hsyl20
Copy link
Author

hsyl20 commented Nov 27, 2024

Current status: it builds some ghc program in _build/stage0/bin/ghc. It seems to be linked with the wrong ghc-boot because it reports a GHC version of 9.8.2 (my bootstrap GHC).

@hsyl20
Copy link
Author

hsyl20 commented Nov 27, 2024

Ah, I need to pass some environment variable to ghc-boot's Setup.hs

Copy link

@angerman angerman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @hsyl20 this looks like a great start!

@hsyl20
Copy link
Author

hsyl20 commented Nov 28, 2024

Now it seems like cabal doesn't like empty package databases:

Error: [Cabal-9076]
failed to parse output of 'ghc-pkg dump'

Edit: that was my mistake (a debug statement in ghc-pkg...). Now it works.

@andreabedini
Copy link
Member

Effectively we want to completely disable the solver. We can add
active-respositories: :none to cabal.project and remove the source constraints.

@hsyl20
Copy link
Author

hsyl20 commented Nov 29, 2024

Effectively we want to completely disable the solver. We can add active-respositories: :none to cabal.project and remove the source constraints.

I've disabled it for stage1 where we start fresh to build boot libraries.

@hsyl20
Copy link
Author

hsyl20 commented Feb 24, 2025

I get the same failure as on CI:

/bin/sh: 1: -E: not found
Build.hs: readCreateProcess: $CC -E -undef -traditional -P -x c /home/runner/work/ghc/ghc/_build/stage1/src/libraries/ghc/GHC/Builtin/primops.txt.pp (exit 127): failed
make: *** [Makefile:9: all] Error 1

Is $CC supposed to be set by default?

@hsyl20
Copy link
Author

hsyl20 commented Feb 24, 2025

We should perhaps use cc instead?

@angerman
Copy link

I get the same failure as on CI:

/bin/sh: 1: -E: not found
Build.hs: readCreateProcess: $CC -E -undef -traditional -P -x c /home/runner/work/ghc/ghc/_build/stage1/src/libraries/ghc/GHC/Builtin/primops.txt.pp (exit 127): failed
make: *** [Makefile:9: all] Error 1

Is $CC supposed to be set by default?

I did set it in CI. CC=gcc, CXX=g++

We should perhaps use cc instead?

worth a try.

@hsyl20
Copy link
Author

hsyl20 commented Feb 26, 2025

Unexpected failures in the testsuite should be all addressed. Now I need to address unexpected passes

We basically revert https://gitlab.haskell.org/ghc/ghc/-/merge_requests/9418

It doesn't fail for our statically-built GHC, so it could be Alpine/musl specific.
@hsyl20
Copy link
Author

hsyl20 commented Feb 26, 2025

Two unexpected passes left: TEST="frontend01 test-phase-hooks-plugin"

The weird thing is that they don't pass locally... I'll try to debug this.

@hsyl20
Copy link
Author

hsyl20 commented Feb 26, 2025

Two unexpected passes left: TEST="frontend01 test-phase-hooks-plugin"

The weird thing is that they don't pass locally... I'll try to debug this.

"Fixed" by nuking ~/.cabal/store/ghc-9.13-inplace again... I've opened #29 to track this

@hsyl20
Copy link
Author

hsyl20 commented Feb 27, 2025

Last test is now fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants