`--enable-executable-profiling` not having desired effect in `new-run`
- Dominant language
- Haskell
- Stars
- 1.7k
- Forks
- 750
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 28
Description
Consider the following repro-case:
```
$ cabal get uhttpc-0.1.1.0 && cd uhttpc-0.1.1.0
Unpacking to uhttpc-0.1.1.0/
$ cabal new-run --enable-executable-profiling exe:uhttpc-bench -- +RTS --info
Resolving dependencies...
Build profile: -w ghc-8.4.4 -O1
In order, the following will be built (use -v for more details):
- uhttpc-0.1.1.0 (lib) (first run)
- uhttpc-0.1.1.0 (exe:uhttpc-bench) (first run)
Configuring library for uhttpc-0.1.1.0..
Preprocessing library for uhttpc-0.1.1.0..
Building library for uhttpc-0.1.1.0..
[1 of 1] Compiling Network.HTTP.MicroClient ( Network/HTTP/MicroClient.hs, /tmp/uhttpc-0.1.1.0/dist-newstyle/build/x86_64-linux/ghc-8.4.4/uhttpc-0.1.1.0/build/Network/HTTP/MicroClient.o )
Configuring executable 'uhttpc-bench' for uhttpc-0.1.1.0..
Warning: The package has an extraneous version range for a dependency on an
internal library: uhttpc -any && ==0.1.1.0. This version range includes the
current package but isn't needed as the current package's library will always
be used.
Preprocessing executable 'uhttpc-bench' for uhttpc-0.1.1.0..
Building executable 'uhttpc-bench' for uhttpc-0.1.1.0..
[1 of 1] Compiling Main ( src-exe/uhttpc-bench.hs, /tmp/uhttpc-0.1.1.0/dist-newstyle/build/x86_64-linux/ghc-8.4.4/uhttpc-0.1.1.0/x/uhttpc-bench/build/uhttpc-bench/uhttpc-bench-tmp/Main.o )
Linking /tmp/uhttpc-0.1.1.0/dist-newstyle/build/x86_64-linux/ghc-8.4.4/uhttpc-0.1.1.0/x/uhttpc-bench/build/uhttpc-bench/uhttpc-bench ...
[("GHC RTS", "YES")
,("GHC version", "8.4.4")
,("RTS way", "rts_thr")
,("Build platform", "x86_64-unknown-linux")
,("Build architecture", "x86_64")
,("Build OS", "linux")
,("Build vendor", "unknown")
,("Host platform", "x86_64-unknown-linux")
,("Host architecture", "x86_64")
,("Host OS", "linux")
,("Host vendor", "unknown")
,("Target platform", "x86_64-unknown-linux")
,("Target architecture", "x86_64")
,("Target OS", "linux")
,("Target vendor", "unknown")
,("Word size", "64")
,("Compiler unregisterised", "NO")
,("Tables next to code", "YES")
]
```
IOW, `--enable-executable-profiling` had not the effect expected;
----
Invoking with `--enable-library-profiling` instead caused `lib:uhttpc` to be compiled vanilla+prof, but the executable only as vanilla -- **this is expected** (however, no mention of `--enable-library-profiling` in the planned build items list):
```
$ cabal new-run --enable-library-profiling exe:uhttpc-bench -- +RTS --info
Resolving dependencies...
Build profile: -w ghc-8.4.4 -O1
In order, the following will be built (use -v for more details):
- uhttpc-0.1.1.0 (lib) (first run)
- uhttpc-0.1.1.0 (exe:uhttpc-bench) (first run)
Configuring library for uhttpc-0.1.1.0..
Preprocessing library for uhttpc-0.1.1.0..
Building library for uhttpc-0.1.1.0..
[1 of 1] Compiling Network.HTTP.MicroClient ( Network/HTTP/MicroClient.hs, /tmp/uhttpc-0.1.1.0/dist-newstyle/build/x86_64-linux/ghc-8.4.4/uhttpc-0.1.1.0/build/Network/HTTP/MicroClient.o )
[1 of 1] Compiling Network.HTTP.MicroClient ( Network/HTTP/MicroClient.hs, /tmp/uhttpc-0.1.1.0/dist-newstyle/build/x86_64-linux/ghc-8.4.4/uhttpc-0.1.1.0/build/Network/HTTP/MicroClient.p_o )
Configuring executable 'uhttpc-bench' for uhttpc-0.1.1.0..
Preprocessing executable 'uhttpc-bench' for uhttpc-0.1.1.0..
Building executable 'uhttpc-bench' for uhttpc-0.1.1.0..
[1 of 1] Compiling Main ( src-exe/uhttpc-bench.hs, /tmp/uhttpc-0.1.1.0/dist-newstyle/build/x86_64-linux/ghc-8.4.4/uhttpc-0.1.1.0/x/uhttpc-bench/build/uhttpc-bench/uhttpc-bench-tmp/Main.o )
Linking /tmp/uhttpc-0.1.1.0/dist-newstyle/build/x86_64-linux/ghc-8.4.4/uhttpc-0.1.1.0/x/uhttpc-bench/build/uhttpc-bench/uhttpc-bench ...
[("GHC RTS", "YES")
,("GHC version", "8.4.4")
,("RTS way", "rts_thr")
,("Build platform", "x86_64-unknown-linux")
,("Build architecture", "x86_64")
,("Build OS", "linux")
,("Build vendor", "unknown")
,("Host platform", "x86_64-unknown-linux")
,("Host architecture", "x86_64")
,("Host OS", "linux")
,("Host vendor", "unknown")
,("Target platform", "x86_64-unknown-linux")
,("Target architecture", "x86_64")
,("Target OS", "linux")
,("Target vendor", "unknown")
,("Word size", "64")
,("Compiler unregisterised", "NO")
,("Tables next to code", "YES")
]
```
----
Finally, invoking with `--enable-profiling` does result in an executable linked against the profiling runtime (also note that the `--enable-profiling` flag shows up in the planned build item list!):
```
$ cabal new-run --enable-profiling exe:uhttpc-bench -- +RTS --info
Build profile: -w ghc-8.4.4 -O1
In order, the following will be built (use -v for more details):
- uhttpc-0.1.1.0 (lib) --enable-profiling (configuration changed)
- uhttpc-0.1.1.0 (exe:uhttpc-bench) --enable-profiling (configuration changed)
Configuring library for uhttpc-0.1.1.0..
Preprocessing library for uhttpc-0.1.1.0..
Building library for uhttpc-0.1.1.0..
Configuring executable 'uhttpc-bench' for uhttpc-0.1.1.0..
Preprocessing executable 'uhttpc-bench' for uhttpc-0.1.1.0..
Building executable 'uhttpc-bench' for uhttpc-0.1.1.0..
[1 of 1] Compiling Main ( src-exe/uhttpc-bench.hs, /tmp/uhttpc-0.1.1.0/dist-newstyle/build/x86_64-linux/ghc-8.4.4/uhttpc-0.1.1.0/x/uhttpc-bench/build/uhttpc-bench/uhttpc-bench-tmp/Main.p_o )
Linking /tmp/uhttpc-0.1.1.0/dist-newstyle/build/x86_64-linux/ghc-8.4.4/uhttpc-0.1.1.0/x/uhttpc-bench/build/uhttpc-bench/uhttpc-bench ...
[("GHC RTS", "YES")
,("GHC version", "8.4.4")
,("RTS way", "rts_thr_p")
,("Build platform", "x86_64-unknown-linux")
,("Build architecture", "x86_64")
,("Build OS", "linux")
,("Build vendor", "unknown")
,("Host platform", "x86_64-unknown-linux")
,("Host architecture", "x86_64")
,("Host OS", "linux")
,("Host vendor", "unknown")
,("Target platform", "x86_64-unknown-linux")
,("Target architecture", "x86_64")
,("Target OS", "linux")
,("Target vendor", "unknown")
,("Word size", "64")
,("Compiler unregisterised", "NO")
,("Tables next to code", "YES")
]
```
@23Skidoo btw, do we still want to support `--enable-executable-profiling`?
Contributor guide
Research direction
Start by reproducing the three `cabal new-run` commands shown in the issue and compare their planned build items and RTS output. Trace how `--enable-executable-profiling`, `--enable-library-profiling`, and `--enable-profiling` are handled for `new-run`; done means the executable-profiling flag has a defined, tested behavior or its support status is clarified.
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