haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.62k stars 691 forks source link

--enable-executable-profiling seems non-functional #9748

Open chreekat opened 7 months ago

chreekat commented 7 months ago

Describe the bug --enable-executable-profiling seems to have no effect.

To Reproduce Steps to reproduce the behavior:

$ cabal init -m -n --exe no-profiling-huh
<elided>
$ cd no-profiling-huh
$ cabal build --enable-executable-profiling
Resolving dependencies...
Build profile: -w ghc-9.4.8 -O1
In order, the following will be built (use -v for more details):
 - no-profiling-huh-0.1.0.0 (exe:no-profiling-huh) (first run)
Configuring executable 'no-profiling-huh' for no-profiling-huh-0.1.0.0..
Preprocessing executable 'no-profiling-huh' for no-profiling-huh-0.1.0.0..
Building executable 'no-profiling-huh' for no-profiling-huh-0.1.0.0..
[1 of 1] Compiling Main             ( app/Main.hs, /home/b/tmp/no-profiling-huh/dist-newstyle/build/x86_64-linux/ghc-9.4.8/no-profiling-huh-0.1.0.0/x/no-profiling-huh/build/no-profiling-huh/no-profiling-huh-tmp/Main.o )
[2 of 2] Linking /home/b/tmp/no-profiling-huh/dist-newstyle/build/x86_64-linux/ghc-9.4.8/no-profiling-huh-0.1.0.0/x/no-profiling-huh/build/no-profiling-huh/no-profiling-huh

$ ./dist-newstyle/build/x86_64-linux/ghc-9.4.8/no-profiling-huh-0.1.0.0/x/no-profiling-huh/build/no-profiling-huh/no-profiling-huh +RTS -p |& head
no-profiling-huh: the flag -p requires the program to be built with -prof

Expected behavior I expected --enable-executable-profiling to build the executable with -prof.

System information

Additional context I'm in favor of deprecating this argument and using --enable-profiling instead. It already seems to work:

[b@kuusi:~/tmp/no-profiling-huh]$ cabal build --enable-profiling
Build profile: -w ghc-9.4.8 -O1
In order, the following will be built (use -v for more details):
 - no-profiling-huh-0.1.0.0 (exe:no-profiling-huh)  --enable-profiling (configuration changed)
Configuring executable 'no-profiling-huh' for no-profiling-huh-0.1.0.0..
Preprocessing executable 'no-profiling-huh' for no-profiling-huh-0.1.0.0..
Building executable 'no-profiling-huh' for no-profiling-huh-0.1.0.0..
[1 of 1] Compiling Main             ( app/Main.hs, /home/b/tmp/no-profiling-huh/dist-newstyle/build/x86_64-linux/ghc-9.4.8/no-profiling-huh-0.1.0.0/x/no-profiling-huh/build/no-profiling-huh/no-profiling-huh-tmp/Main.p_o )
[2 of 2] Linking /home/b/tmp/no-profiling-huh/dist-newstyle/build/x86_64-linux/ghc-9.4.8/no-profiling-huh-0.1.0.0/x/no-profiling-huh/build/no-profiling-huh/no-profiling-huh [Objects changed]

[b@kuusi:~/tmp/no-profiling-huh]$ ./dist-newstyle/build/x86_64-linux/ghc-9.4.8/no-profiling-huh-0.1.0.0/x/no-profiling-huh/build/no-profiling-huh/no-profiling-huh +RTS -p |& head
Hello, Haskell!
chreekat commented 7 months ago

If the bash completion for cabal already just suggested --enable-profiling instead of the other ones, I would have not even noticed this bug. I don't know where NixOS gets its completion from, though.