haskell / haskell/cabal

`cabal run`...`+RTS -l` does not recognize if the binary was built with `-eventlog` or `-debug`

Open
#7,338 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

**Describe the bug**

With cabal v3.4.4.0, `cabal run`...`+RTS -l` prints `cabal: the flag -l requires the program to be built with -eventlog or -debug` etc. instead of running the binary in question, even if the binary was built with `-eventlog` or `-debug`.

**To Reproduce**

With an executable named `ltest` declared in a `.cabal` file with `ghc-options: -eventlog` or `ghc-options: -debug`:

```
$ cabal v2-build ltest
$ cabal run ltest +RTS -l
```
Passing these options to cabal at build time via `--ghc-options` has the same outcome.

**Expected behavior**

Running the binary directly with the same arguments works fine; it runs to completion and outputs a binary event log to the working directory. I would think `cabal run` ought to do the same.

**System information**
Gentoo Linux, kernel v5.11.6 (vanilla)
Haskell tooling installed via ghcup

```
$ cabal -V
cabal-install version 3.4.0.0
compiled using version 3.4.0.0 of the Cabal library
```

```
$ ghc -V
The Glorious Glasgow Haskell Compilation System, version 8.10.4
```

From the `.cabal` file:
```
cabal-version: 2.4
-- ...

executable ltest
-- ...
build-depends:
base ^>=4.14.1.0,

-- ...
default-language: Haskell2010
-- ...
```

**Additional context**

Here's [verbose output](https://gist.github.com/spinnylights/3ac372b58b4d0b0093902de46bcd8acc) from `cabal v2-build` and `cabal run` in this context.

I first encountered this working through [_Parallel and Concurrent Programming in Haskell_](https://simonmar.github.io/pages/pcph.html), but I encounter this behavior even with a fresh project generated via `cabal init` and changed only as described above.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.