haskell / haskell/cabal

Add option to collect GHC eventlog

Open
#8,621 2 comments 1 reaction 0 assignees View on GitHub
cabal-install: v2-build system re: ghc-options type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

#### Summary

GHC supports outputting information to the eventlog (see: https://www.haskell.org/ghc/blog/20190924-eventful-ghc.html). Normally collecting the eventlog from a haskell application is as simple as passing `+RTS -lout.eventlo -RTS` and then you get an eventlog at `out.eventlog`. So, you might expect that adding that to `ghc-options` would allow you to collect an eventlog from Cabal's invocation of GHC. But this doesn't work because Cabal invokes GHC multiple times, so, subsequent invocations will overwrite previous ones.

#### Suggestion
Add a new option that will pass flags to GHC to write eventlogs to a well-known location in the work dir. It would ensure that eventlogs don't get overwritten by ensuring that the paths they are writing to are made unique.
The option could be called `ghc-collect-eventlog`.

#### Workarounds
If people want eventlog's from GHC in practice I've mostly seen them write wrapper scripts that invoke GHC in a way to ensure eventlogs don't get overwritten. EG, head.hackage calls it in a way that the `-l` option is only passed for the `--make` call and includes which unit is being compiled. https://gitlab.haskell.org/ghc/head.hackage/-/blob/master/ci/logging-ghc

Contributor guide

Open the contributing guide

Research direction

Start by reviewing Cabal's repeated GHC invocations and the head.hackage logging-ghc workaround linked in the issue, including the distinction around the --make call. Done means specifying and testing a ghc-collect-eventlog option that writes eventlogs to unique paths in the work directory without overwriting earlier invocations.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.