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

cipher-aes128:setup.Cabal-3.8.0.20220526/installed-3.8.0.20220526 (conflict: cipher-aes128 => cipher-aes128:setup.Cabal>=1.10 && <3.7) #9294

Closed
exarkun opened this issue Sep 29, 2023 · 6 comments
Assignees

Comments

@exarkun
Copy link
Collaborator

exarkun commented Sep 29, 2023

Describe the bug

When attempting to build https://whetstone.private.storage/privatestorage/tahoe-chk (be0695ac38d8c1c623907f60b883a547c9d743e4) using ghc 9.2 or 9.4 and ghc-wasm-meta I encountered the following build error:

❯ cabal build --allow-newer=base  --allow-newer=text --disable-tests                                                                                                                                                                             [134/406]
Resolving dependencies...                                                                                                                                                                                                                                 
Error: cabal: Could not resolve dependencies:                                                                                                                                                                                                             
[__0] trying: tahoe-chk-0.1.0.2 (user goal)                                                                                                                                                                                                               
[__1] trying: cipher-aes128-0.7.0.6 (dependency of tahoe-chk)                                                                                                                                                                                             
[__2] next goal: cipher-aes128:setup.Cabal (dependency of cipher-aes128)                                                                                                                                                                                  
[__2] rejecting:                                                                                                                                                                                                                                          
cipher-aes128:setup.Cabal-3.8.0.20220526/installed-3.8.0.20220526 (conflict:                                                                                                                                                                              
cipher-aes128 => cipher-aes128:setup.Cabal>=1.10 && <3.7)                                                                                                                                                                                                 
[__2] skipping: cipher-aes128:setup.Cabal-3.10.1.0,                                                                                                                               
cipher-aes128:setup.Cabal-3.8.1.0 (has the same characteristics that caused                                                                                                       
the previous version to fail: excluded by constraint '>=1.10 && <3.7' from                                                                                                        
'cipher-aes128')                                                                                                                                                                  
[__2] rejecting: cipher-aes128:setup.Cabal-3.6.3.0,                                                                                                                               
cipher-aes128:setup.Cabal-3.6.2.0, cipher-aes128:setup.Cabal-3.6.1.0,                                                                                                             
cipher-aes128:setup.Cabal-3.6.0.0, cipher-aes128:setup.Cabal-3.4.1.0,                                                                                                             
cipher-aes128:setup.Cabal-3.4.0.0, cipher-aes128:setup.Cabal-3.2.1.0,                                                                                                             
cipher-aes128:setup.Cabal-3.2.0.0, cipher-aes128:setup.Cabal-3.0.2.0,                                                                                                             
cipher-aes128:setup.Cabal-3.0.1.0, cipher-aes128:setup.Cabal-3.0.0.0,                                                                                                             
cipher-aes128:setup.Cabal-2.4.1.0, cipher-aes128:setup.Cabal-2.4.0.1,                                                                                                             
cipher-aes128:setup.Cabal-2.4.0.0, cipher-aes128:setup.Cabal-2.2.0.1,                                                                                                             
cipher-aes128:setup.Cabal-2.2.0.0, cipher-aes128:setup.Cabal-2.0.1.1,                                                                                                             
cipher-aes128:setup.Cabal-2.0.1.0, cipher-aes128:setup.Cabal-2.0.0.2,  
cipher-aes128:setup.Cabal-1.24.2.0, cipher-aes128:setup.Cabal-1.24.0.0,
cipher-aes128:setup.Cabal-1.22.8.0, cipher-aes128:setup.Cabal-1.22.7.0,
cipher-aes128:setup.Cabal-1.22.6.0, cipher-aes128:setup.Cabal-1.22.5.0,                                                                                                           
cipher-aes128:setup.Cabal-1.22.4.0, cipher-aes128:setup.Cabal-1.22.3.0,                  
cipher-aes128:setup.Cabal-1.22.2.0, cipher-aes128:setup.Cabal-1.22.1.1,                  
cipher-aes128:setup.Cabal-1.22.1.0, cipher-aes128:setup.Cabal-1.22.0.0,
cipher-aes128:setup.Cabal-1.20.0.4, cipher-aes128:setup.Cabal-1.20.0.3,                  
cipher-aes128:setup.Cabal-1.20.0.2, cipher-aes128:setup.Cabal-1.20.0.1,
cipher-aes128:setup.Cabal-1.20.0.0, cipher-aes128:setup.Cabal-1.18.1.7,      
cipher-aes128:setup.Cabal-1.18.1.6, cipher-aes128:setup.Cabal-1.18.1.5,                  
cipher-aes128:setup.Cabal-1.18.1.4, cipher-aes128:setup.Cabal-1.18.1.3, 
cipher-aes128:setup.Cabal-1.18.1.2, cipher-aes128:setup.Cabal-1.18.1.1,   
cipher-aes128:setup.Cabal-1.18.1, cipher-aes128:setup.Cabal-1.18.0,                                                                                                               
cipher-aes128:setup.Cabal-1.16.0.3, cipher-aes128:setup.Cabal-1.16.0.2,                                                                                                           
cipher-aes128:setup.Cabal-1.16.0.1, cipher-aes128:setup.Cabal-1.16.0,                                                                                                             
cipher-aes128:setup.Cabal-1.14.0, cipher-aes128:setup.Cabal-1.12.0,                      
cipher-aes128:setup.Cabal-1.10.2.0, cipher-aes128:setup.Cabal-1.10.1.0,                                                                                                           
cipher-aes128:setup.Cabal-1.10.0.0, cipher-aes128:setup.Cabal-1.8.0.6,                                                                                                            
cipher-aes128:setup.Cabal-1.8.0.4, cipher-aes128:setup.Cabal-1.8.0.2,                    
cipher-aes128:setup.Cabal-1.6.0.3, cipher-aes128:setup.Cabal-1.6.0.2,                    
cipher-aes128:setup.Cabal-1.6.0.1, cipher-aes128:setup.Cabal-1.4.0.2,                    
cipher-aes128:setup.Cabal-1.4.0.1, cipher-aes128:setup.Cabal-1.4.0.0,                    
cipher-aes128:setup.Cabal-1.2.4.0, cipher-aes128:setup.Cabal-1.2.3.0,                
cipher-aes128:setup.Cabal-1.2.2.0, cipher-aes128:setup.Cabal-1.2.1,                      
cipher-aes128:setup.Cabal-1.1.6, cipher-aes128:setup.Cabal-1.24.1.0  
(constraint from minimum version of Cabal used by Setup.hs requires >=3.8)               
[__2] fail (backjumping, conflict set: cipher-aes128,                                    
cipher-aes128:setup.Cabal)                                                               
After searching the rest of the dependency tree exhaustively, these were the             
goals I've had most trouble fulfilling: cipher-aes128:setup.Cabal, tahoe-chk,
cipher-aes128                                                                            

To Reproduce
Steps to reproduce the behavior:

  • Get ghc (I got mine from nixos 23.05, haskell.compiler.ghc941)
  • Get ghc-wasm-meta (I got mine with nix shell https://gitlab.haskell.org/ghc/ghc-wasm-meta/-/archive/master/ghc-wasm-meta-master.tar.gz, rev bd1b3778e8100a5e8c89962903a8c2ae3ff5c611)
  • Make a project that depends on cipher-aes12, (eg, like tahoe-chk does)
  • cabal build (or cabal build --allow-newer=base --allow-newer=text --disable-tests if trying with tahoe-chk)

Expected behavior

A successful build!

System information

  • Operating system - NixOS 23.05
  • cabal 3.10.1.0 (see above)
  • ghc.9.4.1 (see above)
@Mikolaj
Copy link
Member

Mikolaj commented Sep 29, 2023

Ping @mpickering @sheaf @dcoutts: that's the ticket I was talking about.

@exarkun: let us know if the solution @fgaz found (the one related to

-- While we can talk to older Cabal versions (we need to be able to
-- do so for custom Setup scripts that require older Cabal lib
-- versions), we have problems talking to some older versions that
-- don't support certain features.
--
-- For example, Cabal-1.16 and older do not know about build targets.
-- Even worse, 1.18 and older only supported the --constraint flag
-- with source package ids, not --dependency with installed package
-- ids. That is bad because we cannot reliably select the right
-- dependencies in the presence of multiple instances (i.e. the
-- store). See issue #3932. So we require Cabal 1.20 as a minimum.
--
-- Moreover, lib:Cabal generally only supports the interface of
-- current and past compilers; in fact recent lib:Cabal versions
-- will warn when they encounter a too new or unknown GHC compiler
-- version (c.f. #415). To avoid running into unsupported
-- configurations we encode the compatibility matrix as lower
-- bounds on lib:Cabal here (effectively corresponding to the
-- respective major Cabal version bundled with the respective GHC
-- release).
--
-- GHC 9.2 needs Cabal >= 3.6
-- GHC 9.0 needs Cabal >= 3.4
-- GHC 8.10 needs Cabal >= 3.2
-- GHC 8.8 needs Cabal >= 3.0
-- GHC 8.6 needs Cabal >= 2.4
-- GHC 8.4 needs Cabal >= 2.2
-- GHC 8.2 needs Cabal >= 2.0
-- GHC 8.0 needs Cabal >= 1.24
-- GHC 7.10 needs Cabal >= 1.22
--
-- (NB: we don't need to consider older GHCs as Cabal >= 1.20 is
-- the absolute lower bound)
) works for you (using and older cabal-install binary is it, I guess?).

Let me cite a part of the discussion from #7088

image

image

@mpickering
Copy link
Collaborator

It seems unlikely this will work in any case as custom Setup.hs don't work with cross-compilers?

@fgaz
Copy link
Member

fgaz commented Sep 29, 2023

let us know if the solution @fgaz found works for you (using and older cabal-install binary is it, I guess?)

The solution would be to downgrade GHC. Quoting the comment:

To avoid running into unsupported configurations we encode the compatibility matrix as lower bounds on lib:Cabal here (effectively corresponding to the respective major Cabal version bundled with the respective GHC release).

So cabal-install imposes a Cabal bound depending on the GHC version.

You could also attempt to relax the upper bound on Cabal with --allow-newer=Cabal.

If downgrading GHC is not possible and you confirmed that relaxing the upper bound breaks the package, in theory downgrading cabal can also work since older cabal-installs don't know about newer GHCs, but the result can be unpredictable.


The error message can definitely be improved, by explaining what "minimum version of Cabal used by Setup.hs" is and why it's there

@andreabedini
Copy link
Collaborator

andreabedini commented Oct 2, 2023

Note that this can be reproduced without ghc-wasm-meta:

$ cabal-3.10.1.0 init -m -n -d base,cipher-aes128
[Log] Using cabal specification: 3.0
[Warning] unknown license type, you must put a copy in LICENSE yourself.
[Log] Creating fresh file CHANGELOG.md...
[Log] Creating fresh directory ./app...
[Log] Creating fresh file app/Main.hs...
[Log] Creating fresh file cabal-issue9294.cabal...
[Warning] No synopsis given. You should edit the .cabal file and add one.
[Info] You may want to edit the .cabal file and add a Description field.

$ cabal-3.10.1.0 build
Resolving dependencies...
Error: cabal-3.10.1.0: Could not resolve dependencies:
....

Unfortunately relaxing the bound in cipher-aes128's custom-setup does not help:

❯ cabal-3.10.1.0 build --allow-newer=Cabal
Build profile: -w ghc-9.4.7 -O1
In order, the following will be built (use -v for more details):
 - cipher-aes128-0.7.0.6 (lib:cipher-aes128) (requires build)
 - cabal-issue9294-0.1.0.0 (exe:cabal-issue9294) (first run)
Starting     cipher-aes128-0.7.0.6 (all, legacy fallback)
Error: cabal-3.10.1.0: Failed to build cipher-aes128-0.7.0.6 (which is
required by exe:cabal-issue9294 from cabal-issue9294-0.1.0.0). The failure
occurred during the configure step. The exception was:
/home/andrea/.cabal/logs/ghc-9.4.7/cipher-aes128-0.7.0.6-ce595940690a94de95adb303a0f49bfb2e3cc3234d70cfc0d2542c368d373cb0.log:
withFile: user error (Error: cabal-3.10.1.0: '/home/andrea/.ghcup/bin/ghc'
exited with an error:

/home/andrea/Scratchpad/cabal-issue-9294/dist-newstyle/tmp/src-19690/cipher-aes128-0.7.0.6/dist/setup/setup.hs:36:66:
error:
Empty 'do' block
Suggested fix: Perhaps you intended to use NondecreasingIndentation
|
36 | withTempDirectory normal "" "testIntrinsic" $ \tmpDir -> do
| ^^
)

but this error has nothing to do with Cabal's API. It is a breaking change in GHC-9.2:

The default mode of GHC until 9.0 included NondecreasingIndentation, but GHC2021 does not. This may break code implicitly using this extension.

(taken from https://downloads.haskell.org/ghc/9.2.8/docs/html/users_guide/9.2.1-notes.html?highlight=nondecreasingindentation)

Indeed cabal-3.10.1.0 build -w ghc-9.0 works fine.

But this side-steps the upper bound on Cabal because ghc-9.0 comes with Cabal-3.4.1.0! I hear you saying. Well no, you can build Cabal-3.10.1.0 on ghc-9.0 and everything would work:

❯ cabal-3.10.1.0 build -w ghc-9.0 --constraint=cipher-aes128:setup.Cabal==3.10.1.0 --allow-newer=cipher-aes128:Cabal
Resolving dependencies...
Build profile: -w ghc-9.0.2 -O1
In order, the following will be built (use -v for more details):
 - Cabal-syntax-3.10.1.0 (lib) (requires build)
 - Cabal-3.10.1.0 (lib) (requires build)
 - cipher-aes128-0.7.0.6 (lib:cipher-aes128) (requires build)
 - cabal-issue9294-0.1.0.0 (exe:cabal-issue9294) (configuration changed)
Starting     Cabal-syntax-3.10.1.0 (lib)
Building     Cabal-syntax-3.10.1.0 (lib)
Installing   Cabal-syntax-3.10.1.0 (lib)
Completed    Cabal-syntax-3.10.1.0 (lib)
Starting     Cabal-3.10.1.0 (lib)
Building     Cabal-3.10.1.0 (lib)
Installing   Cabal-3.10.1.0 (lib)
Completed    Cabal-3.10.1.0 (lib)
Starting     cipher-aes128-0.7.0.6 (all, legacy fallback)
Building     cipher-aes128-0.7.0.6 (all, legacy fallback)
Installing   cipher-aes128-0.7.0.6 (all, legacy fallback)
Completed    cipher-aes128-0.7.0.6 (all, legacy fallback)
Configuring executable 'cabal-issue9294' for cabal-issue9294-0.1.0.0..
Preprocessing executable 'cabal-issue9294' for cabal-issue9294-0.1.0.0..
Building executable 'cabal-issue9294' for cabal-issue9294-0.1.0.0..
Linking /home/andrea/Scratchpad/cabal-issue-9294/dist-newstyle/build/x86_64-linux/ghc-9.0.2/cabal-issue9294-0.1.0.0/x/cabal-issue9294/build/cabal-issue9294/cabal-issue9294 ...

@andreabedini
Copy link
Collaborator

Is there a bug here? This issue can be turned into a UX issue if anyone is keen.

@andreabedini
Copy link
Collaborator

I am going to close this as I don't think there is a bug anywhere. Feel free to reopen in case I am mistaken.

@andreabedini andreabedini closed this as not planned Won't fix, can't repro, duplicate, stale Oct 24, 2023
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