[GHC] #16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary -------------------------------------+------------------------------------- Reporter: adamse | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: Component: Build System | Version: 8.6.3 (Hadrian) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- hadrian.cabal specifies alex and happy as build-tools, we should make hadrian pass them to ./configure when hadrian is running with {{{-c}}} (Migrated from https://github.com/snowleopard/hadrian/issues/706) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16120 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary -------------------------------------+------------------------------------- Reporter: adamse | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 8.6.3 (Hadrian) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by adamse): hvr suggests using {{{ $ cabal new-exec --project=$PWD/hadrian/cabal.project sh -- -c 'command -v alex' /home/hvr/.cabal/store/ghc-8.4.4/alex-3.2.4-4006f020d0bf93fca9fc50e9f961c4a2af3341f7a44d2bfa6f7feb9c7d6e930b/bin/alex }}} or {{{ $ cabal new-exec --project=$PWD/hadrian/cabal.project which -- alex /home/hvr/.cabal/store/ghc-8.4.4/alex-3.2.4-4006f020d0bf93fca9fc50e9f961c4a2af3341f7a44d2bfa6f7feb9c7d6e930b/bin/alex }}} To find the build-tools. Is it possible for hadrian to call cabal in this way? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16120#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary -------------------------------------+------------------------------------- Reporter: adamse | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 8.6.3 (Hadrian) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by snowleopard): Yes, we can run these Cabal commands and obtain the output using Shake's `cmd` function: https://hackage.haskell.org/package/shake-0.17.3/docs/Development- Shake.html#v:cmd In particular, see the example with `Stdout out <- cmd ...`. However, this makes Cabal a dependency of Hadrian even for users who are building Hadrian using Stack (e.g. using the `build.stack.bat` script). Could we instead use Hadrian's built-in path resolver `lookupInPath`? Have a look here: https://gitlab.haskell.org/ghc/ghc/blob/master/hadrian/src/Hadrian/Oracles/P... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16120#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary -------------------------------------+------------------------------------- Reporter: adamse | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 8.6.3 (Hadrian) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by adamse): Unless I am misunderstanding this would be exactly the same behaviour as default ./configure which will look for alex and happy in path, the issue brought up in the original ticket is that alex and happy that are installed by cabal but not visible in the run time PATH. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16120#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary -------------------------------------+------------------------------------- Reporter: adamse | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 8.6.3 (Hadrian) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by snowleopard):
Yet another possibility might be to do new-exec instead of new-run to run hadrian after it is built by cabal. As hvr's example commands show alex and happy are available in PATH then.
I actually thougth that `new-run` is the same as `new-exec` in this respect, so I expected that both Alex and Happy will be visible to Hadrian's `loopkupInPath`. Same for running Hadrian with Stack. Could you check if it works when using the current `build.cabal.sh`? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16120#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary -------------------------------------+------------------------------------- Reporter: adamse | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 8.6.3 (Hadrian) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by adamse): In hadrian subdirectory: {{{ % which alex /Users/adam/.cabal/bin/alex % cabal new-exec which alex /Users/adam/.cabal/store/ghc-8.4.2/lx-3.2.4-ea33d38f/bin/alex }}} Running hadrian: {{{ % ./hadrian/build.cabal.sh -c -- ... user interrupt % grep AlexCmd config.log AlexCmd='/Users/adam/.cabal/bin/alex' }}} So new-run and new-exec does not have the same behaviour with the PATH. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16120#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary -------------------------------------+------------------------------------- Reporter: adamse | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 8.6.3 (Hadrian) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by snowleopard): Many thanks for checking @adamse! To me the difference in PATH settings between `new-run` and `new-exec` is surprising. Do you know about the rationale for this? If not, perhaps @hvr could clarify? I'm not suggesting to change anything, but merely want to learn a bit more about Cabal. Does switching from `new-run` to `new-exec` come with any disadvantages? I guess `new-exec` requires us to specify the path to the Hadrian executable which may be annoying. Is there anything else? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16120#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary -------------------------------------+------------------------------------- Reporter: adamse | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 8.6.3 (Hadrian) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by snowleopard): * cc: alpmestan, hvr (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16120#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary -------------------------------------+------------------------------------- Reporter: adamse | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 8.6.3 (Hadrian) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by adamse): No need to specify the full path to hadrian, this diff suffices: {{{ diff --git a/hadrian/build.cabal.sh b/hadrian/build.cabal.sh index 9fddd61c4e..3f45272345 100755 --- a/hadrian/build.cabal.sh +++ b/hadrian/build.cabal.sh @@ -24,7 +24,7 @@ CABVER=( ${CABVERSTR//./ } ) if [ "${CABVER[0]}" -gt 2 -o "${CABVER[0]}" -eq 2 -a "${CABVER[1]}" -ge 2 ]; then "$CABAL" --project-file="$PROJ" new-build $CABFLAGS -j exe:hadrian - "$CABAL" --project-file="$PROJ" new-run $CABFLAGS exe:hadrian -- \ + "$CABAL" --project-file="$PROJ" new-exec $CABFLAGS hadrian -- \ --lint \ --directory "$PWD" \ "$@" }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16120#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary -------------------------------------+------------------------------------- Reporter: adamse | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 8.6.3 (Hadrian) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by snowleopard): Sounds great! If there are indeed no disadvantages then I think we should go ahead with this change. Do I understand correctly that this change is sufficient for the `configure` step to go through smoothly, because it can now see all required tools? Or do we also need to change the way we invoke the `configure` script from Hadrian? Another question: can/should we do the same change in the Stack build script? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16120#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary -------------------------------------+------------------------------------- Reporter: adamse | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Build System | Version: 8.6.3 (Hadrian) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by adamse): This change is enough for the configure script to find alex & happy. I do not know if stack has support for installing build tools, so I cannot comment on that part. Gitlab MR: https://gitlab.haskell.org/ghc/ghc/merge_requests/69 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16120#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary -------------------------------------+------------------------------------- Reporter: adamse | Owner: (none) Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 8.6.3 (Hadrian) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://gitlab.haskell.org/ghc/ghc/merge_requests/69 -------------------------------------+------------------------------------- Changes (by adamse): * status: new => patch * differential: => https://gitlab.haskell.org/ghc/ghc/merge_requests/69 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16120#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary -------------------------------------+------------------------------------- Reporter: adamse | Owner: (none) Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 8.6.3 (Hadrian) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://gitlab.haskell.org/ghc/ghc/merge_requests/69 -------------------------------------+------------------------------------- Changes (by sgraf): * cc: mpickering (added) Comment: I just wanted to point out that this makes for different behavior when doing `./configure` and `hadrian/build.cabal.sh -c`. Specifically, when opening a `nix-shell --pure https://github.com/alpmestan/ghc.nix/archive/master.tar.gz`, this pollutes the configured $PATH variable with cabal-specific paths in my user home. Doing just `./configure` doesn't do that. I don't see why we always want to use the happy and alex versions that were used to build Hadrian. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16120#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary -------------------------------------+------------------------------------- Reporter: adamse | Owner: (none) Type: feature request | Status: patch Priority: normal | Milestone: Component: Build System | Version: 8.6.3 (Hadrian) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | https://gitlab.haskell.org/ghc/ghc/merge_requests/69 -------------------------------------+------------------------------------- Changes (by sgraf): * cc: sgraf (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16120#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16120: Hadrian should use cabal build-tools installed Alex and Happy if necessary
-------------------------------------+-------------------------------------
Reporter: adamse | Owner: (none)
Type: feature request | Status: patch
Priority: normal | Milestone:
Component: Build System | Version: 8.6.3
(Hadrian) |
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: | https://gitlab.haskell.org/ghc/ghc/merge_requests/69
-------------------------------------+-------------------------------------
Comment (by Ben Gamari
participants (1)
-
GHC