Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cabal new-build doesn't produce logs for local packages #5901

Open
bgamari opened this issue Feb 26, 2019 · 8 comments
Open

cabal new-build doesn't produce logs for local packages #5901

bgamari opened this issue Feb 26, 2019 · 8 comments

Comments

@bgamari
Copy link
Contributor

bgamari commented Feb 26, 2019

As far as I can tell cabal new-build no longer produces log files for local package builds. For instance,

$ git clone https://github.com/haskell-hvr/cabal-plan
$ cd cabal-plan
$ cabal new-build all
$ find -iname '*.log' | wc -l 
0

Moreover, -v2 shows no indication that a log was generated. I have a vague sense that this used to work so I suspect there is a regression here.

@ulysses4ever
Copy link
Collaborator

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:

, option [] ["build-log"]
"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
Copy link
Collaborator

Could you tell me what are my options for getting verbose build log from Cabal (building local packages)?

@ulysses4ever
Copy link
Collaborator

@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
Copy link
Collaborator

Well, it's not a beautiful workaround - but it works.

@gbaz gbaz added this to To do in Cabal 3.10 via automation Sep 15, 2022
@gbaz gbaz removed this from To do in Cabal 3.10 Jun 8, 2023
@gbaz gbaz added this to To Do in Cabal 3.12 via automation Jun 8, 2023
@andreabedini
Copy link
Collaborator

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?

@ulysses4ever
Copy link
Collaborator

Some good related work is here, I think:

@gbaz revived --build-summary for v2 but suggested to remove --build-log altogether. This felt a bit extreme to me tbh.

@andreabedini
Copy link
Collaborator

andreabedini commented 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
Copy link
Collaborator

FWIW, after #9524, this can be very easily seen in

Nothing -- no log file for inplace builds!

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).

@Mikolaj Mikolaj moved this from To Do to In Progress in Cabal 3.12 May 2, 2024
@Mikolaj Mikolaj removed this from In Progress in Cabal 3.12 May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants