haskell / cabal

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

Install test executables with cabal install when "--enable-tests" present #7693

Open mouse07410 opened 2 years ago

mouse07410 commented 2 years ago

Describe the bug Trying to manually (because included Makefile forces v1- commands) build Agda from source, I'm getting the following error:

$ cabal v2-install --enable-tests --disable-documentation --only-dependencies -fenable-cluster-counting
cabal: --enable-tests was specified, but tests can't be enabled in a remote
package

To Reproduce Steps to reproduce the behavior:

$ git clone https://github.com/agda/agda.git --recurse-submodules
$ cd agda
$ cabal v2-install --enable-tests --disable-documentation --only-dependencies -fenable-cluster-counting

Expected behavior Successful build. I am getting it when I omit --enable-tests, but in that case agda-tests executable is not built (so, I can't run tests to validate the created executables).

Note, that cabal v2-build --enable-tests seems to work fine (but it does not install the executables it builds).

System information

mouse07410 commented 2 years ago

@phadej says it's expected and hard to avoid that unit IDs differ between build and install: #7297 (comment)

If dependencies get installed during build (rather than placed in the local dist-newstyle/) - there's no reason for and no sense in their unit IDs changing install from their build values.

gbaz commented 2 years ago

@Mikolaj I think you misinterpreted oleg's comment. The point is that if I "install" or "build" a package, its own hash may be different in those two circumstances. In either case, the packages it depends on will unilaterally be installed into the store. So the differences he's highlighting are not the relevant ones.

@mouse07410 please keep your comments here constructive. Stomping your foot and repeating yourself, saying "that's a bug that needs fixing" while we're still trying to investigate what the reported issue even is, and if we can reproduce it is just adding noise and confusion that's making sorting this out harder. We know what your intuition is. The complicated reality of the system may not conform to that, and maybe the result will be fixing a bug, maybe it will be us understanding and documenting the system better, or maybe it will be realizing that a change could be possible but would require far too much work to be feasible. We don't know, and what we need to do now is patiently investigate, not repeat the same initial concerns.

fgaz commented 2 years ago

Well, there is one relevant case: if a remote package depends on a local package, the remote package and all its reverse dependencies will be rebuilt. This can happen if one vendors a package deep in the dependency tree. I see no such thing in the Agda repo though.

What would be the sequence of commands, including cabal-plan ... that you suggest I run?

this should work but i did not test it:

cabal build ...options...
cabal install --builddir=dist-newstyle-2 ...options...
cabal-plan diff --builddir dist-newstyle --builddir dist-newstyle-2

see cabal-plan --help and cabal-plan diff --help for more. fyi, plan.json is in $builddir/cache

mouse07410 commented 2 years ago

there is one relevant case: if a remote package depends on a local package, the remote package and all its reverse dependencies will be rebuilt. This can happen if one vendors a package deep in the dependency tree.

I'm afraid you lost me here - I don't see how it could be possible for a dependency package (presumably already on Hackage) to depend in turn on the (presumably local) package being currently built. Most likely, I just don't understand the example.

this should work but i did not test it: . . .

Well, in my case, since I've already tried both cabal v2-build ... and cabal v2-install ..., it appears that the packages build and installed by both commands are still in the global store. So, the output of cabal-plan diff ... is not impressive - I'm not sure if it's helpful for you to pinpoint the problem:

$ cabal-plan diff --builddir=dist-newstyle --builddir=dist-newstyle-2

Package versions
~~~~~~~~~~~~~~~~

-Agda-2.6.3 test:agda-tests
-ListLike-4.7.6 lib
-QuickCheck-2.14.2 lib
-ansi-terminal-0.11 lib
-ansi-wl-pprint-0.6.9 lib
-call-stack-0.4.0 lib
-clock-0.8.2 lib
-colour-2.3.6 lib
-data-default-0.7.1.1 lib
-data-default-class-0.1.2.0 lib
-data-default-instances-containers-0.0.1 lib
-data-default-instances-dlist-0.0.1 lib
-data-default-instances-old-locale-0.0.1 lib
-filemanip-0.3.6.3 lib
-fmlist-0.9.4 lib
-generic-deriving-1.14.1 lib
-old-locale-1.0.0.7 lib
-optparse-applicative-0.16.1.0 lib
-process-extras-0.7.4 lib
-tasty-1.4.2 lib
-tasty-hunit-0.10.0.3 lib
-tasty-quickcheck-0.10.1.2 lib
-tasty-silver-3.2.3 lib
-temporary-1.3 lib
-unbounded-delays-0.1.1.1 lib
-unix-compat-0.5.3 lib
-wcwidth-0.0.2 lib

Dependency graph
~~~~~~~~~~~~~~~~

    [Agda:all]-2.6.3
     ├─ Agda-2.6.3
     │   ├─ aeson-1.5.6.0
     │   │   ├─ attoparsec-0.14.1
     │   │   │   └─ scientific-0.3.7.0
     │   │   │       ├─ hashable-1.3.4.1
     │   │   │       │   └─ text-1.2.4.1
     │   │   │       │       ├─ binary-0.8.8.0
     │   │   │       │       │   ├─ bytestring-0.10.12.1
     │   │   │       │       │   │   └─ deepseq-1.4.5.0
     │   │   │       │       │   │       └─ array-0.5.4.0
     │   │   │       │       │   │           └─ base-4.15.0.0
     │   │   │       │       │   │               └─ ghc-bignum-1.0
     │   │   │       │       │   │                   └─ ghc-prim-0.7.0
     │   │   │       │       │   │                       └─ rts-1.0
     │   │   │       │       │   └─ containers-0.6.4.1
     │   │   │       │       │       └─ deepseq-1.4.5.0 ┄┄
     │   │   │       │       └─ template-haskell-2.17.0.0
     │   │   │       │           ├─ ghc-boot-th-9.0.1
     │   │   │       │           │   └─ base-4.15.0.0 ┄┄
     │   │   │       │           └─ pretty-1.1.3.6
     │   │   │       │               └─ deepseq-1.4.5.0 ┄┄
     │   │   │       ├─ integer-logarithms-1.0.3.1
     │   │   │       │   └─ array-0.5.4.0 ┄┄
     │   │   │       └─ primitive-0.7.2.0
     │   │   │           ├─ deepseq-1.4.5.0 ┄┄
     │   │   │           └─ transformers-0.5.6.2
     │   │   │               └─ base-4.15.0.0 ┄┄
     │   │   ├─ base-compat-batteries-0.12.0
     │   │   │   └─ base-compat-0.12.0
     │   │   │       └─ unix-2.7.2.2
     │   │   │           ├─ bytestring-0.10.12.1 ┄┄
     │   │   │           └─ time-1.9.3
     │   │   │               └─ deepseq-1.4.5.0 ┄┄
     │   │   ├─ data-fix-0.3.2
     │   │   │   └─ hashable-1.3.4.1 ┄┄
     │   │   ├─ dlist-1.0
     │   │   │   └─ deepseq-1.4.5.0 ┄┄
     │   │   ├─ strict-0.4.0.1
     │   │   │   └─ these-1.1.1.1
     │   │   │       ├─ assoc-1.0.2
     │   │   │       │   └─ bifunctors-5.5.11
     │   │   │       │       ├─ comonad-5.0.8
     │   │   │       │       │   ├─ distributive-0.6.2.1
     │   │   │       │       │   │   ├─ base-orphans-0.8.5
     │   │   │       │       │   │   │   └─ base-4.15.0.0 ┄┄
     │   │   │       │       │   │   └─ tagged-0.8.6.1
     │   │   │       │       │   │       ├─ template-haskell-2.17.0.0 ┄┄
     │   │   │       │       │   │       └─ transformers-0.5.6.2 ┄┄
     │   │   │       │       │   ├─ indexed-traversable-0.1.1
     │   │   │       │       │   │   ├─ containers-0.6.4.1 ┄┄
     │   │   │       │       │   │   └─ transformers-0.5.6.2 ┄┄
     │   │   │       │       │   └─ transformers-compat-0.7
     │   │   │       │       │       └─ transformers-0.5.6.2 ┄┄
     │   │   │       │       └─ th-abstraction-0.4.3.0
     │   │   │       │           ├─ containers-0.6.4.1 ┄┄
     │   │   │       │           └─ template-haskell-2.17.0.0 ┄┄
     │   │   │       └─ hashable-1.3.4.1 ┄┄
     │   │   ├─ time-compat-1.9.6.1
     │   │   │   ├─ base-orphans-0.8.5 ┄┄
     │   │   │   ├─ hashable-1.3.4.1 ┄┄
     │   │   │   └─ time-1.9.3 ┄┄
     │   │   ├─ unordered-containers-0.2.14.0
     │   │   │   └─ hashable-1.3.4.1 ┄┄
     │   │   ├─ uuid-types-1.0.5
     │   │   │   ├─ hashable-1.3.4.1 ┄┄
     │   │   │   └─ random-1.2.1
     │   │   │       ├─ bytestring-0.10.12.1 ┄┄
     │   │   │       ├─ mtl-2.2.2
     │   │   │       │   └─ transformers-0.5.6.2 ┄┄
     │   │   │       └─ splitmix-0.1.0.3
     │   │   │           └─ deepseq-1.4.5.0 ┄┄
     │   │   └─ vector-0.12.3.1
     │   │       └─ primitive-0.7.2.0 ┄┄
     │   ├─ [alex:exe:alex]-3.2.6
     │   │   ├─ containers-0.6.4.1 ┄┄
     │   │   └─ directory-1.3.6.1
     │   │       ├─ filepath-1.4.2.1
     │   │       │   └─ base-4.15.0.0 ┄┄
     │   │       └─ unix-2.7.2.2 ┄┄
     │   ├─ async-2.2.4
     │   │   ├─ hashable-1.3.4.1 ┄┄
     │   │   └─ stm-2.5.0.0
     │   │       └─ array-0.5.4.0 ┄┄
     │   ├─ blaze-html-0.9.1.2
     │   │   └─ blaze-markup-0.8.2.8
     │   │       └─ blaze-builder-0.4.2.1
     │   │           └─ text-1.2.4.1 ┄┄
     │   ├─ boxes-0.1.5
     │   │   └─ split-0.2.3.4
     │   │       └─ base-4.15.0.0 ┄┄
     │   ├─ case-insensitive-1.2.1.0
     │   │   └─ hashable-1.3.4.1 ┄┄
     │   ├─ data-hash-0.2.0.1
     │   │   └─ containers-0.6.4.1 ┄┄
     │   ├─ edit-distance-0.2.2.1
     │   │   ├─ containers-0.6.4.1 ┄┄
     │   │   └─ random-1.2.1 ┄┄
     │   ├─ equivalence-0.3.5
     │   │   ├─ STMonadTrans-0.4.6
     │   │   │   ├─ array-0.5.4.0 ┄┄
     │   │   │   └─ mtl-2.2.2 ┄┄
     │   │   ├─ containers-0.6.4.1 ┄┄
     │   │   ├─ fail-4.9.0.0
     │   │   └─ transformers-compat-0.7 ┄┄
     │   ├─ ghc-compact-0.1.0.0
     │   │   └─ bytestring-0.10.12.1 ┄┄
     │   ├─ gitrev-1.3.1
     │   │   ├─ base-compat-0.12.0 ┄┄
     │   │   ├─ process-1.6.11.0
     │   │   │   └─ directory-1.3.6.1 ┄┄
     │   │   └─ template-haskell-2.17.0.0 ┄┄
     │   ├─ [happy:exe:happy]-1.20.0
     │   │   ├─ containers-0.6.4.1 ┄┄
     │   │   └─ mtl-2.2.2 ┄┄
     │   ├─ hashtables-1.2.4.1
     │   │   ├─ hashable-1.3.4.1 ┄┄
     │   │   └─ vector-0.12.3.1 ┄┄
     │   ├─ haskeline-0.8.1.0
     │   │   ├─ containers-0.6.4.1 ┄┄
     │   │   ├─ exceptions-0.10.4
     │   │   │   ├─ mtl-2.2.2 ┄┄
     │   │   │   ├─ stm-2.5.0.0 ┄┄
     │   │   │   └─ template-haskell-2.17.0.0 ┄┄
     │   │   ├─ process-1.6.11.0 ┄┄
     │   │   └─ terminfo-0.4.1.4
     │   │       └─ base-4.15.0.0 ┄┄
     │   ├─ monad-control-1.0.3.1
     │   │   └─ transformers-base-0.4.6
     │   │       ├─ base-orphans-0.8.5 ┄┄
     │   │       ├─ stm-2.5.0.0 ┄┄
     │   │       └─ transformers-compat-0.7 ┄┄
     │   ├─ murmur-hash-0.1.0.9
     │   │   └─ bytestring-0.10.12.1 ┄┄
     │   ├─ parallel-3.2.2.0
     │   │   └─ containers-0.6.4.1 ┄┄
     │   ├─ regex-tdfa-1.3.1.1
     │   │   ├─ parsec-3.1.14.0
     │   │   │   ├─ mtl-2.2.2 ┄┄
     │   │   │   └─ text-1.2.4.1 ┄┄
     │   │   └─ regex-base-0.94.0.1
     │   │       ├─ mtl-2.2.2 ┄┄
     │   │       └─ text-1.2.4.1 ┄┄
     │   ├─ text-icu-0.7.1.0
     │   │   └─ text-1.2.4.1 ┄┄
     │   ├─ uri-encode-1.5.0.7
     │   │   ├─ network-uri-2.6.4.1
     │   │   │   ├─ parsec-3.1.14.0 ┄┄
     │   │   │   └─ th-compat-0.1.3
     │   │   │       └─ template-haskell-2.17.0.0 ┄┄
     │   │   └─ utf8-string-1.0.2
     │   │       └─ bytestring-0.10.12.1 ┄┄
     │   └─ zlib-0.6.2.3
     │       └─ bytestring-0.10.12.1 ┄┄
     ├─ [Agda:exe:agda]-2.6.3
     │   └─ base-4.15.0.0 ┄┄
     ├─ [Agda:exe:agda-mode]-2.6.3
     │   └─ process-1.6.11.0 ┄┄
---  ├─ [Agda:test:agda-tests] 2.6.3 -> 
     └─ [setup]-2.6.3
         └─ Cabal-3.4.0.0
             ├─ parsec-3.1.14.0 ┄┄
             └─ process-1.6.11.0 ┄┄
$ 
mouse07410 commented 2 years ago

OK, pulled updates from Agda repo, tried again. Since cabal-plan diffshows some things by "boldifying" elements of the build tree, it seems best to post the screenshots, rather than the mere textual content:

Screen Shot 2021-10-12 at 13 13 04 Screen Shot 2021-10-12 at 13 15 29 Screen Shot 2021-10-12 at 13 16 09 Screen Shot 2021-10-12 at 13 16 44 Screen Shot 2021-10-12 at 13 19 33 Screen Shot 2021-10-12 at 13 21 03
jneira commented 2 years ago

Ok, i think we are out of the issue topic now, it asks for installing executables with cabal install --enable-tests. One of the main motivations was the rebuild between build and install, but there is a specific issue about #6919 as noted by @fgaz. So i am gonna post my tests about there.

EDIT: I ended to open a new issue #7745, as #6919 is about rebuilding local packages and in my case cabal rebuilds all the deps too