Skip to content

Alternating between build and install commands gets into contradictory state #7271

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

Closed
andreasabel opened this issue Feb 5, 2021 · 3 comments

Comments

@andreasabel
Copy link
Member

Cabal/cabal-install version 3.5.0.0 (recent development version).
I experimented a bit with how well v2-cabal is caching compilation when alternating between

  • test
  • build
  • install
  • install --lib

Alternating these got me to a point where cabal "Could not resolve dependencies".

The project is a still private repo (hash for me: 8000c81d4ce126ddb2a4a756a0d35ead041bfc8e).
If this isn't a duplicate issue and someone wants to investigate, please contact me for the code.

The cabal file contains a library, an executable and a test-suite.

I played the sequence of cabal v2-commands:

  1. test: builds library and test-suite
  2. build: need build only executable
  3. install: from scratch
  4. build: (up-to-date)
  5. install --lib: from scratch
  6. install: (up-to-date)
  7. build: (up-to-date)
  8. install --lib: configure failure

1. Test

$ cabal test
Resolving dependencies...
Build profile: -w ghc-8.10.3 -O1
In order, the following will be built (use -v for more details):
 - BNFC3-3.0 (lib) (file src/BNFC/Check/Monad.hs changed)
 - BNFC3-3.0 (test:bnfc3-test) (dependency rebuilt)
Preprocessing library for BNFC3-3.0..
Building library for BNFC3-3.0..
[19 of 24] Compiling BNFC.Check.Monad ( src/BNFC/Check/Monad.hs, /Users/abel/project/open-source/bnfc-3/dist-newstyle/build/x86_64-osx/ghc-8.10.3/BNFC3-3.0/build/BNFC/Check/Monad.o, /Users/abel/project/open-source/bnfc-3/dist-newstyle/build/x86_64-osx/ghc-8.10.3/BNFC3-3.0/build/BNFC/Check/Monad.dyn_o )
...
[24 of 24] Compiling BNFC.Main        ( src/BNFC/Main.hs, /Users/abel/project/open-source/bnfc-3/dist-newstyle/build/x86_64-osx/ghc-8.10.3/BNFC3-3.0/build/BNFC/Main.o, /Users/abel/project/open-source/bnfc-3/dist-newstyle/build/x86_64-osx/ghc-8.10.3/BNFC3-3.0/build/BNFC/Main.dyn_o ) [BNFC.Check.Run changed]
Preprocessing test suite 'bnfc3-test' for BNFC3-3.0..
Building test suite 'bnfc3-test' for BNFC3-3.0..
[2 of 2] Compiling Main             ( test/Main.hs, /Users/abel/project/open-source/bnfc-3/dist-newstyle/build/x86_64-osx/ghc-8.10.3/BNFC3-3.0/t/bnfc3-test/build/bnfc3-test/bnfc3-test-tmp/Main.o )
Linking /Users/abel/project/open-source/bnfc-3/dist-newstyle/build/x86_64-osx/ghc-8.10.3/BNFC3-3.0/t/bnfc3-test/build/bnfc3-test/bnfc3-test ...
Running 1 test suites...
Test suite bnfc3-test: RUNNING...
Test suite bnfc3-test: PASS
Test suite logged to:
/Users/abel/project/open-source/bnfc-3/dist-newstyle/build/x86_64-osx/ghc-8.10.3/BNFC3-3.0/t/bnfc3-test/test/BNFC3-3.0-bnfc3-test.log
1 of 1 test suites (1 of 1 test cases) passed.

2. Build

Only needs to build executable.

$ cabal build
Build profile: -w ghc-8.10.3 -O1
In order, the following will be built (use -v for more details):
 - BNFC3-3.0 (exe:bnfc3) (file /Users/abel/project/open-source/bnfc-3/dist-newstyle/build/x86_64-osx/ghc-8.10.3/BNFC3-3.0/cache/build changed)
Preprocessing executable 'bnfc3' for BNFC3-3.0..
Building executable 'bnfc3' for BNFC3-3.0..
Linking /Users/abel/project/open-source/bnfc-3/dist-newstyle/build/x86_64-osx/ghc-8.10.3/BNFC3-3.0/x/bnfc3/build/bnfc3/bnfc3 ...

3. Install

Builds library and executable from scratch.

$ cabal install
Wrote tarball sdist to
/Users/abel/project/open-source/bnfc-3/dist-newstyle/sdist/BNFC3-3.0.tar.gz
Resolving dependencies...
Build profile: -w ghc-8.10.3 -O1
In order, the following will be built (use -v for more details):
 - BNFC3-3.0 (lib) (requires build)
 - BNFC3-3.0 (exe:bnfc3) (requires build)
Configuring library for BNFC3-3.0..
Preprocessing library for BNFC3-3.0..
Building library for BNFC3-3.0..
[ 1 of 24] Compiling BNFC.Abs         ( src/BNFC/Abs.hs, dist/build/BNFC/Abs.o, dist/build/BNFC/Abs.dyn_o )
...
[24 of 24] Compiling BNFC.Main        ( src/BNFC/Main.hs, dist/build/BNFC/Main.o, dist/build/BNFC/Main.dyn_o )
Installing library in /Users/abel/.cabal/store/ghc-8.10.3/incoming/new-86362/Users/abel/.cabal/store/ghc-8.10.3/BNFC3-3.0-44eb9918/lib
Configuring executable 'bnfc3' for BNFC3-3.0..
Warning: The package has an extraneous version range for a dependency on an
internal library: BNFC3 >=0 && ==3.0, BNFC3 >=0 && ==3.0. This version range
includes the current package but isn't needed as the current package's library
will always be used.
Preprocessing executable 'bnfc3' for BNFC3-3.0..
Building executable 'bnfc3' for BNFC3-3.0..
[1 of 1] Compiling Main             ( main/Main.hs, dist/build/bnfc3/bnfc3-tmp/Main.o )
Linking dist/build/bnfc3/bnfc3 ...
Installing executable bnfc3 in /Users/abel/.cabal/store/ghc-8.10.3/incoming/new-86362/Users/abel/.cabal/store/ghc-8.10.3/BNFC3-3.0-7d596a8b/bin
Warning: The directory
/Users/abel/.cabal/store/ghc-8.10.3/incoming/new-86362/Users/abel/.cabal/store/ghc-8.10.3/BNFC3-3.0-7d596a8b/bin
is not in the system search path.
Copying 'bnfc3' to '/Users/abel/.cabal/bin/bnfc3'

4. Build (up to date)

$ cabal build
Resolving dependencies...
Up to date

5. Install --lib

Builds library from scratch.

$ cabal install --lib
Wrote tarball sdist to
/Users/abel/project/open-source/bnfc-3/dist-newstyle/sdist/BNFC3-3.0.tar.gz
Resolving dependencies...
Build profile: -w ghc-8.10.3 -O1
In order, the following will be built (use -v for more details):
 - BNFC3-3.0 (lib) (requires build)
Configuring library for BNFC3-3.0..
Preprocessing library for BNFC3-3.0..
Building library for BNFC3-3.0..
[ 1 of 24] Compiling BNFC.Abs         ( src/BNFC/Abs.hs, dist/build/BNFC/Abs.o, dist/build/BNFC/Abs.dyn_o )
...
[24 of 24] Compiling BNFC.Main        ( src/BNFC/Main.hs, dist/build/BNFC/Main.o, dist/build/BNFC/Main.dyn_o )
Installing library in /Users/abel/.cabal/store/ghc-8.10.3/incoming/new-86839/Users/abel/.cabal/store/ghc-8.10.3/BNFC3-3.0-8123627e/lib

6. Install (up-to-date)

$ cabal install 
Wrote tarball sdist to
/Users/abel/project/open-source/bnfc-3/dist-newstyle/sdist/BNFC3-3.0.tar.gz
Resolving dependencies...
Up to date
Copying 'bnfc3' to '/Users/abel/.cabal/bin/bnfc3'

7. Build (up-to-date)

$ cabal build
Resolving dependencies...
Up to date

8. Install --lib (cannot configure)

$ cabal install --lib
Wrote tarball sdist to
/Users/abel/project/open-source/bnfc-3/dist-newstyle/sdist/BNFC3-3.0.tar.gz
Resolving dependencies...
cabal: Could not resolve dependencies:
[__0] trying: binary-0.8.8.0/installed-0.8.8.0 (user goal)
[__1] next goal: containers (user goal)
[__1] rejecting: containers-0.6.4.1 (conflict: binary =>
containers==0.6.2.1/installed-0.6.2.1)
[__1] rejecting: containers-0.6.3.1, containers-0.6.2.1/installed-0.6.2.1,
containers-0.6.2.1, containers-0.6.1.1, containers-0.6.0.1,
containers-0.5.11.0, containers-0.5.10.2, containers-0.5.10.1,
containers-0.5.9.2, containers-0.5.8.2, containers-0.5.7.1,
containers-0.5.7.0, containers-0.5.6.3, containers-0.5.6.2,
containers-0.5.6.1, containers-0.5.6.0, containers-0.5.5.1,
containers-0.5.5.0, containers-0.5.4.0, containers-0.5.3.1,
containers-0.5.3.0, containers-0.5.2.1, containers-0.5.2.0,
containers-0.5.1.0, containers-0.5.0.0, containers-0.4.2.1,
containers-0.4.2.0, containers-0.4.1.0, containers-0.4.0.0,
containers-0.3.0.0, containers-0.2.0.1, containers-0.2.0.0,
containers-0.1.0.1, containers-0.1.0.0, containers-0.5.9.1, containers-0.5.8.1
(constraint from user target requires ==0.6.4.1)
[__1] fail (backjumping, conflict set: binary, containers)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: binary, containers, ghc
@fgaz
Copy link
Member

fgaz commented Feb 5, 2021

Probably a duplicate of #5559, #6391, #6394...

cabal install --lib is problematic, there are plans to replace it: #6481 (feedback is welcome)

here's a prototype of what it could look like: https://github.com/phadej/cabal-extras/tree/master/cabal-env I've been using it for some time myself and it solves every issue I have with install --lib

@andreasabel
Copy link
Member Author

Thanks @fgaz. Indeed #6394 matches my description, but I didn't find it when searching on the issue tracker...

I was playing with cabal install --lib since I wanted to understand if I could use this as drop-in replacement for cabal v1-install. But this is better discussed at #6478.

@fgaz
Copy link
Member

fgaz commented Jul 21, 2021

Closing as duplicate of the above

@fgaz fgaz closed this as completed Jul 21, 2021
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

3 participants