Open hasufell opened 1 year ago
Should probably also make hadrian default or detect whether a make build system exists. --hadrian
flag should only be required if there's both make and hadrian.
Should probably also make hadrian default or detect whether a make build system exists.
--hadrian
flag should only be required if there's both make and hadrian.
Is it possible to say "Use make for <9.6 and Hadrian for >= 9.6"?
And fwiw I think 9.4 was the only series that officially supported both, although I also think Hadrian was pretty immature then.
Is it possible to say "Use make for <9.6 and Hadrian for >= 9.6"?
Currently, my idea is just to look for the hadrian files and if they're not there, assume make:
The choice can be made explicit with --hadrian | --make
.
I don't know that it's valuable to make it an option to users if 9.4 is the only version that officially supported both. <9.4, --hadrian might work but will be buggy (and the bugs will never get fixed); >=9.6, --make will fail.
Yes, but GHC has made it extra hard to detect which version you're actually compiling: https://gitlab.haskell.org/ghc/ghc/-/issues/22322
The fix was backported, but I have no clear overview at the moment what versions work and which don't.
As such I'm moving away from logic that depends on version numbers. If you try to compile 9.6.1 with make, that may fail. But maybe not, because you're using custom patched bindists, a different branch etc (remember you can already supply patches before the build... that's explicitly supported).
Dynamic detection seems more flexible.
What we probably want is a more descriptive error in case you try to build 9.6.1 with make: "The make build system has been removed since 9.6. You probably want to omit '--make'."
And I'll probably support the VERSION
file, in case it exists.
What's missing now is the question on how to support additional arguments to ./configure
and hadrian ...
.
If we compile, we have two configure phases:
It's not clear whether they support the exact same arguments. Or if you'd even want that.
For hadrian
I think we're mostly good with the --flavour=foo
switch, since many things are now flavour transformers.
EDIT: Sorry, i was running this with github actions and it seems github actions doesn't display a part of the logs. I'll look into it
Hi, thanks again for so awesome tool, and your time.
(i think my issues are related to this ticket) I'm trying to build a cross-compiler from host x86_64-macos to target aarch64-macos with ghcup compile ghc
I've tried multiple combinations of ghc target versions (8.10.7, 9.0.2, 9.2.8, 9.4.5, 9.6.2) (all with bootstrapping version 9.4.5), and additional flags (particularly --jobs), without any success. I am mostly asking if I should keep trying to build using ghcup or I just should try directly from ghc source.
Here I leave some logs w/errors while trying to compile.
ghcup compile ghc -v 9.6.2 -b 9.4.5 "" -x aarch64-apple-darwin
with [ Error ] []8;;https://errors.haskell.org/messages/GHCup-00841\GHCup-00841]8;;\] Process "make" with arguments [] failed with exit code 2.
ghcup compile ghc -v 9.2.8 -b 9.4.5 "" -x aarch64-apple-darwin
with
[ Error ] []8;;https://errors.haskell.org/messages/GHCup-00841\GHCup-00841]8;;\] Process "sh" with arguments ["./configure",
[ ... ] "--target=aarch64-apple-darwin",
[ ... ] "--prefix=/Users/runner/.ghcup/ghc/aarch64-apple-darwin-9.2.8",
[ ... ] ""] failed with exit code 1.
ghcup compile ghc -v 9.0.2 -b 9.4.5 "" -x aarch64-apple-darwin
with
[ Error ] []8;;https://errors.haskell.org/messages/GHCup-00841\GHCup-00841]8;;\] Process "sh" with arguments ["./configure",
[ ... ] "--target=aarch64-apple-darwin",
[ ... ] "--prefix=/Users/runner/.ghcup/ghc/aarch64-apple-darwin-9.0.2",
[ ... ] ""] failed with exit code 1.
ghcup compile ghc -v 8.10.7 -b 9.4.5 "" -x aarch64-apple-darwin
with
[ Error ] []8;;https://errors.haskell.org/messages/GHCup-00841\GHCup-00841]8;;\] Process "sh" with arguments ["./configure",
[ ... ] "--target=aarch64-apple-darwin",
[ ... ] "--prefix=/Users/runner/.ghcup/ghc/aarch64-apple-darwin-8.10.7",
[ ... ] ""] failed with exit code 1.
The error 00841 is:
A process exited prematurely [GHCup-00841]
This error can happen for a variety of reasons and may indicate that GHCup needs to improve error handling/messages. Consider [raising an issue](https://github.com/haskell/ghcup-hs/issues).
One common source of errors is a missing or non-working C toolchain, leading to errors when trying to install GHC:
(i didn't post examples with -j flag, but the error was something like "make no parse -j8". if its necessary ill look it up
Regarding the hadrian flags, I figured out that the "binary-dist" target does work with the '--docs=none'.
We already have a way to specify -j
and --flavour
flags.
In addition the user might want to specify these
--docs[=TARGET] Strip down docs targets (none, no-haddocks, no-sphinx[-{html, pdfs, man}].
--bignum[=BACKEND] Select ghc-bignum backend: native, gmp (default), check-gmp, ffi.
But it would be problematic if the user specifies these
-o[BUILD_ROOT], --build-root[=BUILD_ROOT] Where to store build artifacts. (Default _build).
-c, --configure Deprecated: Run the boot and configure scripts.
Flags other than these are likely not relevant for compilation via ghcup.
So perhaps it would be simpler if ghcup also supports --docs
and --bignum
flags, which are passed on to hadrian.
For ghc-bignum, there is one flavour transformer native_bignum
https://gitlab.haskell.org/ghc/ghc/-/blob/master/hadrian/doc/flavours.md#flavour-transformers
The following flags are already handled by GHCup: --prefix
, --target
, --disable-ld-override
Flags other than these may not be necessary to be specified by most of users.
Note that for cross-compilation, most of the flags have to be specified at the build configure. ref: https://gitlab.haskell.org/ghc/ghc/-/wikis/building/cross-compiling#configuring-the-build
As I have mentioned above, and discussed here --bignum
is likely not necessary, and just adding support of --docs
should suffice.
With reference to #1082, perhaps GHCup should throw an error if user specifies (done via #1085)--config
with hadrian, and tell the user to specify --make
if they wish to use it. (or default to --make
if it is available and user has specified --config
)
And as the --make
has been deprecated from 9.6 onward, the only way the user would be able to do custom builds would be to specify hadrian/UserSettings.hs
file as described here.
Should GHCup support specifying this file via CLI option?
The main issues are:
Currently we support the first case via
--
longopts. But that can only cover one use case.This is particularly important for cross builds, which may need different than default settings.
@hsyl20