I'm not sure it is a bug or just designed behavior? But I can't install profiling-enabled exe with cabal 3.2.0.0, while direct running works correctly.
$ cabal --version
cabal-install version 3.2.0.0
compiled using version 3.2.0.0 of the Cabal library
$ cabal run --enable-profiling --enable-executable-profiling exe:els -- +RTS --info
Up to date
[("GHC RTS", "YES")
,("GHC version", "8.8.4")
,("RTS way", "rts_thr_p")
,("Build platform", "x86_64-apple-darwin")
,("Build architecture", "x86_64")
,("Build OS", "darwin")
,("Build vendor", "apple")
,("Host platform", "x86_64-apple-darwin")
,("Host architecture", "x86_64")
,("Host OS", "darwin")
,("Host vendor", "apple")
,("Target platform", "x86_64-apple-darwin")
,("Target architecture", "x86_64")
,("Target OS", "darwin")
,("Target vendor", "apple")
,("Word size", "64")
,("Compiler unregisterised", "NO")
,("Tables next to code", "YES")
,("Flag -with-rtsopts", "-maxN31 -qg")
]
$ cabal install --enable-profiling --overwrite-policy=always --enable-executable-profiling exe:els && els +RTS --info
Wrote tarball sdist to
...
Resolving dependencies...
Up to date
Copying 'els'
[("GHC RTS", "YES")
,("GHC version", "8.8.4")
,("RTS way", "rts_thr")
,("Build platform", "x86_64-apple-darwin")
,("Build architecture", "x86_64")
,("Build OS", "darwin")
,("Build vendor", "apple")
,("Host platform", "x86_64-apple-darwin")
,("Host architecture", "x86_64")
,("Host OS", "darwin")
,("Host vendor", "apple")
,("Target platform", "x86_64-apple-darwin")
,("Target architecture", "x86_64")
,("Target OS", "darwin")
,("Target vendor", "apple")
,("Word size", "64")
,("Compiler unregisterised", "NO")
,("Tables next to code", "YES")
,("Flag -with-rtsopts", "-maxN31 -qg")
]
$ cabal install --enable-profiling --overwrite-policy=always --enable-executable-profiling exe:els && els +RTS -p
Wrote tarball sdist to
...
Resolving dependencies...
Up to date
Copying 'els'
els: the flag -p requires the program to be built with -prof
els:
els: Usage: <prog> <args> [+RTS <rtsopts> | -RTS <args>] ... --RTS <args>
els: ...