Opened 8 months ago

Last modified 6 months ago

#16187 new bug

Hadrian: Build fails when using absolute path for build root

Reported by: davide Owned by: sykloid
Priority: normal Milestone:
Component: Build System (Hadrian) Version: 8.6.3
Keywords: hadrian build root relative absolute path Cc: alpmestan, snowleopard
Operating System: Linux Architecture: Unknown/Multiple
Type of failure: Building GHC failed Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

This fails:

$ git clean -xdf
$ ./boot && ./configure && ./hadrian/build.sh -o/tmp/build
...
Error when running Shake build system:
  at src/Main.hs:58:30-42:
* Depends on: test
  at src/Hadrian/Builder.hs:70:5-23:
* Depends on: /tmp/build01/stage2/lib/platformConstants
  at src/Hadrian/Utilities.hs:292:5-18:
* Depends on: /tmp/build01/generated/platformConstants
  at src/Hadrian/Builder.hs:70:5-23:
* Depends on: /tmp/build01/stage0/bin/deriveConstants
  at src/Development/Shake/Internal/Rules/Oracle.hs:157:43-68:
* Depends on: OracleQ (ContextDataKey (Context {stage = Stage0, package = Package {pkgType = Program, pkgName = "deriveConstants", pkgPath = "utils/deriveConstants"}, way = v}))
  at src/Hadrian/Haskell/Cabal/Parse.hs:214:5-36:
* Depends on: /tmp/build01/stage0/utils/deriveConstants/setup-config
* Raised the exception:
Error, rule finished running but did not produce file:
  /tmp/build01/stage0/utils/deriveConstants/setup-config
CallStack (from HasCallStack):
  error, called at src/Development/Shake/Internal/Rules/File.hs:180:58 in shake-0.17.4-5aa097213b9663d13b00fb582ca77bb18e6d60c3b0376f0fc60fdbf22a73c6f4:Development.Shake.Internal.Rules.File

but changing /tmp/build to the relative path succeeds (something like -o../../../../tmp/build).

Change History (4)

comment:1 Changed 8 months ago by sykloid

I'm trying to tackle this issue as a beginner get-started-on-ghc task.

This particular problem is caused by incorrect argument construction in hadrian/src/Settings/Builders/Cabal:cabalBuilderArgs; but other errors pop up when that's fixed, which I'm working on now.

comment:2 Changed 8 months ago by snowleopard

Hi @sykloid! Many thanks for taking this up.

If you need any help navigating Hadrian code base, please don't hesitate to get in touch.

comment:3 Changed 8 months ago by davide

Owner: set to sykloid

comment:4 Changed 6 months ago by Marge Bot <ben+marge-bot@…>

In 2ff77b9/ghc:

Handle absolute paths to build roots in Hadrian.

Fixes #16187.

This patch fixes various path concatenation issues to allow functioning
builds with hadrian when the build root location is specified with an
absolute path.

Remarks:

- The path concatenation operator (-/-) now handles absolute second operands
  appropriately. Its behavior should match that of POSIX (</>) in this
  regard.

- The `getDirectoryFiles*` family of functions only searches for matches
  under the directory tree rooted by its first argument; all of the
  results are also relative to this root. If the first argument is the
  empty string, the current working directory is used.

  This patch passes the appropriate directory (almost always either `top`
  or `root`), and subsequently attaches that directory prefix so that
  the paths refer to the appropriate files.

- Windows `tar` does not like colons (':') in paths to archive files, it
  tries to resolve them as remote paths. The `--force-local` option
  remedies this, and is applied on windows builds.
Note: See TracTickets for help on using tickets.