haskell / haskell/cabal

profiling options work differently on different --with-ghc options

Open
#2,037 0 comments 0 reactions 0 assignees View on GitHub
Cabal: other type: bug
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

I'm using `--enable-library-profiling` and `--enable-executable-profiling`, combined with `--with-ghc`. My goal is to run some heap profiling features with both GHC 7.8.2 and 7.6.3, but with GHC 7.6.3, heap profiling RTS options are not working, unless I add `--ghc-options=-prof` option too.

Outputs are very long, but here's a summary:

```
$ cabal install --enable-library-profiling --enable-executable-profiling --ghc-options=-fprof-auto --ghc-options=-rtsopts --with-ghc=/home/omer/ghc-7.6/bin/ghc
# heap profiling RTS options doesn't work

$ `which ghc` --version
The Glorious Glasgow Haskell Compilation System, version 7.8.2

$ cabal install --enable-library-profiling --enable-executable-profiling --ghc-options=-fprof-auto --ghc-options=-rtsopts --with-ghc=`which ghc`
# heap profiling RTS options work

$ cabal install --enable-library-profiling --enable-executable-profiling --ghc-options=-fprof-auto --ghc-options=-rtsopts --with-ghc=/home/omer/ghc-7.6/bin/ghc --ghc-options=-prof
# heap profiling RTS options work
```

I compared `-v3` outputs but same arguments are passed to `configure` command.

Same thing applies to `--ghc-options=-rtsopts` too. It's only required when using GHC 7.6.3 (specified using `--with-ghc`).

I also tried this:

```
➜ hello cat Main.hs
main = putStrLn "hello"
➜ hello ghc --make Main.hs -prof -fforce-recomp
[1 of 1] Compiling Main ( Main.hs, Main.o )
Linking Main ...
➜ hello ./Main +RTS -hc
hello
➜ hello /home/omer/ghc-7.6/bin/ghc --make Main.hs -prof -fforce-recomp
[1 of 1] Compiling Main ( Main.hs, Main.o )
Linking Main ...
➜ hello ./Main +RTS -hc
hello
➜ hello cabal install --enable-executable-profiling --with-ghc=/home/omer/ghc-7.6/bin/ghc
Resolving dependencies...
Notice: installing into a sandbox located at
/home/omer/haskell/hello/.cabal-sandbox
Configuring hello-0.1.0.0...
Building hello-0.1.0.0...
Installed hello-0.1.0.0
➜ hello ./.cabal-sandbox/bin/hello +RTS -hc
hello: Most RTS options are disabled. Link with -rtsopts to enable them.
➜ hello cabal install --enable-executable-profiling
Resolving dependencies...
Notice: installing into a sandbox located at
/home/omer/haskell/hello/.cabal-sandbox
Configuring hello-0.1.0.0...
Building hello-0.1.0.0...
Installed hello-0.1.0.0
➜ hello ./.cabal-sandbox/bin/hello +RTS -hc
hello
```

EDIT: This is on latest HEAD.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the three cabal install command variants with GHC 7.6.3 and 7.8.2, then compare the generated configure and build arguments as described in the issue. Trace how --enable-executable-profiling, --enable-library-profiling, --ghc-options, and --with-ghc are translated; done when profiling RTS options behave consistently across both compilers.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system, cli
Issue type
Bug
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.