I've tried a hadrian/build.sh -j on my FreeBSD machine and got greeted by a rather nasty looking error.
Up to dateshakeArgsWith 0.000s 0%Function shake 0.275s 80% =========================Database read 0.000s 0%With database 0.000s 0%Running rules 0.065s 19% =====Total 0.340s 100%Error when running Shake build system:* OracleQ (KeyValue ("hadrian/cfg/system.config","host-os"))* hadrian/cfg/system.config* hadrian/cfg/system.config settings mk/config.h compiler/ghc.cabal rts/rts.cabalConfiguration file hadrian/cfg/system.config is missing.Run the configure script manually or let Hadrian run it automatically by passing the flag --configure.CallStack (from HasCallStack): error, called at src/Rules/Configure.hs:25:13 in main:Rules.Configure
I've tried this with commit 1a3b9bd0b674ad16a41b942c738b8f34564bcd8d and my current system is FreeBSD lain 12.0-BETA3 FreeBSD 12.0-BETA3 r340097 GENERIC amd64.
Building GHC with the old build system worked perfectly fine though.
Trac metadata
Trac field
Value
Version
8.7
Type
Bug
TypeOfFailure
OtherFailure
Priority
normal
Resolution
Unresolved
Component
Build System (Hadrian)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
As stated in the #ghc IRC channel and as suggested by the error message, I suspect you have not run ./configure (and maybe not even ./boot?). You can run ./boot && ./configure yourself or ask hadrian to do it by passing --configure or -c.
I guess the useful part of the error message is not easy to spot:
Configuration file hadrian/cfg/system.config is missing.
Run the configure script manually or let Hadrian run it automatically by passing the flag --configure.
Or do the above two lines look nasty too?
One thing we could improve is not show the stats when Hadrian terminates with a build error.
Just running /usr/home/raichoo/Sources/ghc/ghc/_build/stage0/bin/ghc also reports ghc: missing -B<dir> option. Am I again missing something that's obvious here?
-B is used to point a given ghc executable to its associated "topdir" in GHC parlance, which corresponds to the lib/ dir, which contains the settings file, the package db and all that. See this note for more.
You can see that the error is thrown by this piece of code, which tries to locate the topdir by looking up an env var and then by calling getBaseDir, whose implementations uses getExecutablePath on darwin/linux, does something else on Windows but returns Nothing the rest of the time. To put it another way, any GHC you build needs to be passed its topdir with -B (or to be used through a wrapper script), I think.
@snowleopard: I view printing the call stack when the build fails as very useful. Also note that it's not just printing the call stack of Haskell, some of those parts are the Shake build call stack. It's printed better in the latest version of Shake, as:
Error when running Shake build system: at src/Test/Self.hs:27:5-26:* Depends on: Main.exe at src/Test/Self.hs:48:9-16:* Depends on: General/Wait.o* Depends on: General/Wait.o General/Wait.hi* Raised the exception:...
Which hopefully improves things. I can see two further improvements:
Don't print timing information on an error.
If the exception is an ErrorCallWithLocation then grab the location information and put it in the rest of the stack trace - which then puts the stack traces together and the error at the end.
You can of course override the Shake behaviour entirely by catching the ShakeException - but I think the call stack is super helpful.
I've a patch that gets me a working ghc build with hadrian on FreeBSD. I still need to pass --integer-simple as a flag since for some reason hadrian won't pass the libgmp library path to the linker. https://phabricator.haskell.org/D5335