You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cabal new-build doesn't produce logs for local packages #5901
Was cabal new-build supposed to generate a log with no explicit request for it? I tried versions back to 2.0 and didn't see it producing any logs on its own, so I'm curious what kind lf logs @bgamari meant and which verision of cabal-install produced those.
If anything, I'd expect v2-build to produce logs if the --build-log flag is triggered. Alas, the same experiment (cabal-install 3 as well as 2) don't produce anything even with the flag. This sounds like a bug as mentioned in #6811. I'm not sure if this is the same bug (and one of these issues should be closed as a dup) or not.
Grepping for --build-log returns a curious result:
"Log all builds to file (name template can use $pkgid, $compiler, $os, $arch)"
installLogFile (\v flags -> flags { installLogFile = v })
So, the CLI flag triggers an InstallFlag called installLogFile. It was commited 14 years back here: 5702472 and was supposed for cabal install. And today it's essentially used only in Distribution/Client/Install.hs. No wonder, it has no impact on v2-build.
Arguably, the bug here is that --build-log is shown in cabal v2-build --help: it probably shouldn't (with the current design). Having logs for v2-build would be a feature request.
@mouse07410 the only workaround I’m aware about is to redirect cabal build’s stdout (and maybe stderr) to a file. Let me know if this is not good enough. This bug (or rather omission in v2) is rather unfortunate, I agree. We’d love to have someone fix it and happy to advise.
This should be easy to fix. All the changes should be contained in buildInplaceUnpackedPackage (to be compared with buildAndInstallUnpackedPackage). One decision to be made would be where to to store them; if we don't already have a good spot in distDirLayout I think we can make a new one?
Thanks @ulysses4ever I was going to suggest we close this and #6811 as duplicates of #8456 but I had missed the ticket you mention.
ninja edit: I am tempted to suggest we could simply log all local package builds in the dist folder (even by default) but I cannot have a clear picture until we collect all these tickets into a single one.
ninja edit 2: #7567 is mostly around build reports and only incidentally mentions build-log. I agree we should not remove it altogether.
We /never/ use a log file for building inplace packages, so regardless of the default log file or specified via cli flags, we will write the output of an inplace build to the stdout (see setup in the same file, which calls withLogging).
Activity
ulysses4ever commentedon Jun 12, 2022
Was
cabal new-buildsupposed to generate a log with no explicit request for it? I tried versions back to 2.0 and didn't see it producing any logs on its own, so I'm curious what kind lf logs @bgamari meant and which verision ofcabal-installproduced those.If anything, I'd expect
v2-buildto produce logs if the--build-logflag is triggered. Alas, the same experiment (cabal-install3 as well as 2) don't produce anything even with the flag. This sounds like a bug as mentioned in #6811. I'm not sure if this is the same bug (and one of these issues should be closed as a dup) or not.Grepping for
--build-logreturns a curious result:cabal/cabal-install/src/Distribution/Client/Setup.hs
Lines 1889 to 1891 in 8248c3d
So, the CLI flag triggers an
InstallFlagcalledinstallLogFile. It was commited 14 years back here: 5702472 and was supposed forcabal install. And today it's essentially used only inDistribution/Client/Install.hs. No wonder, it has no impact onv2-build.Arguably, the bug here is that
--build-logis shown incabal v2-build --help: it probably shouldn't (with the current design). Having logs forv2-buildwould be a feature request.mouse07410 commentedon Sep 9, 2022
Could you tell me what are my options for getting verbose build log from Cabal (building local packages)?
ulysses4ever commentedon Sep 9, 2022
@mouse07410 the only workaround I’m aware about is to redirect
cabal build’s stdout (and maybe stderr) to a file. Let me know if this is not good enough. This bug (or rather omission in v2) is rather unfortunate, I agree. We’d love to have someone fix it and happy to advise.mouse07410 commentedon Sep 15, 2022
Well, it's not a beautiful workaround - but it works.
andreabedini commentedon Jul 11, 2023
This should be easy to fix. All the changes should be contained in
buildInplaceUnpackedPackage(to be compared withbuildAndInstallUnpackedPackage). One decision to be made would be where to to store them; if we don't already have a good spot indistDirLayoutI think we can make a new one?ulysses4ever commentedon Jul 11, 2023
Some good related work is here, I think:
@gbaz revived
--build-summaryforv2but suggested to remove--build-logaltogether. This felt a bit extreme to me tbh.andreabedini commentedon Jul 11, 2023
Thanks @ulysses4ever I was going to suggest we close this and #6811 as duplicates of #8456 but I had missed the ticket you mention.
ninja edit: I am tempted to suggest we could simply log all local package builds in the dist folder (even by default) but I cannot have a clear picture until we collect all these tickets into a single one.
ninja edit 2: #7567 is mostly around build reports and only incidentally mentions build-log. I agree we should not remove it altogether.
alt-romes commentedon Feb 9, 2024
FWIW, after #9524, this can be very easily seen in
cabal/cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs
Line 461 in 0e66a4b
We /never/ use a log file for building inplace packages, so regardless of the default log file or specified via cli flags, we will write the output of an inplace build to the stdout (see
setupin the same file, which callswithLogging).