-
Notifications
You must be signed in to change notification settings - Fork 843
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
build-type: Configure; package Cabal-syntax-3.8.1.0
conflicts with itself
#6524
Comments
@hasufell, the source code ( {-# LANGUAGE CPP #-}
{-# LANGUAGE PackageImports #-}
module StackSetupShim where
import Main
#if defined(MIN_VERSION_Cabal)
#if MIN_VERSION_Cabal(3,8,1)
import Distribution.PackageDescription (PackageDescription, emptyHookedBuildInfo)
#else
import "Cabal" Distribution.PackageDescription (PackageDescription, emptyHookedBuildInfo)
#endif
#else
import Distribution.PackageDescription (PackageDescription, emptyHookedBuildInfo)
#endif I am wondering if I have the logic of the |
I'm not sure. It seems to be spurious. Sometimes the CI succeeds, sometimes not. |
Some comments for my own use: If the 'setup-exe' has not been cached, it is built with (for example, extracts, reformatted):
the However, there is also code in runExe compilerPath $
[ "--make"
, "-odir", toFilePathNoTrailingSep setupDir
, "-hidir", toFilePathNoTrailingSep setupDir
, "-i", "-i."
] ++ packageArgs ++
[ toFilePath setuphs
, toFilePath ee.setupShimHs
, "-main-is"
, "StackSetupShim.mainOverride"
, "-o", toFilePath outputFile
, "-threaded"
] ++
-- Apply GHC options
-- https://github.com/commercialhaskell/stack/issues/4526
map
T.unpack
( Map.findWithDefault
[]
AGOEverything
config.ghcOptionsByCat
++ case config.applyGhcOptions of
AGOEverything -> ee.buildOptsCLI.ghcOptions
AGOTargets -> []
AGOLocals -> []
) So, if I take the example given in 79e6134, one of the steps is (extracts, reformatted):
At the end of the build, the package database |
@hasufell, an odd thing about your error message:
is that it is referring to the same package identifier Back when I was experiencing ambiguity, it was between different packages:
EDIT: I think that is the problem (the same two package identifiers, 'conflicting with itself') not the source code for the shim. |
I think the logic of my: #if MIN_VERSION_Cabal(3,8,1)
import Distribution.PackageDescription (PackageDescription, emptyHookedBuildInfo)
#else
import "Cabal" Distribution.PackageDescription (PackageDescription, emptyHookedBuildInfo)
#endif was that (a) with Cabal >= 3.8.1 GHC knew how to handle the clash of module names between The GHC-supplied exposed-modules:
...
Distribution.PackageDescription from Cabal-syntax-3.8.1.0:Distribution.PackageDescription,
... |
Cabal-syntax-3.8.1.0
somehow conflicting with itself
As indicated, I could not reproduce on Windows 11. The snapshot is I wonder if package shadowing is not occurring as it should for GHC 9.4.8 on macOS? |
On Windows 11, using
|
An observation: Returning to my 79e6134 example: The GHC-supplied ...
id: Cabal-3.8.1.0
...
abi: c52458c52981c7dfb414e1264fc98757
...
exposed-modules:
...
Distribution.PackageDescription from Cabal-syntax-3.8.1.0:Distribution.PackageDescription,
... but the extra-dep ...
id: Cabal-3.8.1.0-9FYtgyN7c9W8mwkFl4FEqj
...
abi: d42177acfcf8b8f3b778fbe4e0cfa473
...
exposed-modules:
...
Distribution.PackageDescription from Cabal-syntax-3.8.1.0-CC9Bfx5CE7X4XpP9arS2OL:Distribution.PackageDescription, Could something like that, somehow, result in GHC 9.4.8 thinking two |
The GHC 9.4.8 Users Guide has:
It is not clear to me if "the same installed package id is present" refers to (a) the |
@hasufell, I have switched to macOS/AArch64, and I can't reproduce the problem locally on that platform either. I am using the |
Another observation: The At the point in @hasufell's CI run where the build fails at In my local build which works, the extra-dep This likely difference in the contents of the snapshot package database at the relevant time may explain why the problem is intermittent. |
That (the explanation for intermittent failure) seems to be it: locally, if I delete the snapshot package database and start afresh with the example, but in two steps:
the build fails (with dependency
EDIT: This applies on OS other than macOS - it applies to Windows 11, for example. |
I am looking at the -- This branch is usually taken for builds, and is always taken
-- for `stack sdist`.
--
-- This approach is debatable. It adds access to the snapshot
-- package database for Cabal. There are two possible objections:
--
-- 1. This doesn't isolate the build enough; arbitrary other
-- packages available could cause the build to succeed or fail.
--
-- 2. This doesn't provide enough packages: we should also
-- include the local database when building local packages.
--
-- Currently, this branch is only taken via `stack sdist` or when
-- explicitly requested in the stack.yaml file. What @hasufell is experiencing seems to me to be an instance of objection No. 1 in the code comment. I am wondering: for EDIT: I am going to try that solution in a pull request. |
Cabal-syntax-3.8.1.0
somehow conflicting with itselfCabal-syntax-3.8.1.0
conflicts with itself
@hasufell, in summary, you have uncovered a long-standing bug in Stack that affects the build of packages with I think I have a fix (#6526) and an ugly work-around in the interim. The work-around is to build the extra-dep
|
Great investigation. I'll check your branch out later and maybe run it through CI. |
@hasufell, if you could run it through CI, that would be much appreciated. I am planning on releasing a Stack 2.15.5 soon (because of https://discourse.haskell.org/t/ann-stacks-default-source-for-list-of-stackage-snapshots-not-up-to-date/9023) and it would be good if I could include the resolution of this as part of that release. |
@mpilgrem maybe we do a pre-release, that would make it easier? |
I've no objection to a pre-release. I may make the exposure period shorter than the usual fortnight, given the nature of the 'new URL' fix. |
Fix #6524 Exclude snapshot package DB for `build-type: Configure`
I'll try to trigger it a couple times to see if it fails again |
I have not been able to re-trigger the failure with the pre-release after 4 runs: https://github.com/haskell/ghcup-hs/actions/runs/8378001994?pr=1031 |
https://github.com/haskell/ghcup-hs/actions/runs/8307024100/job/22735795982
stack version 2.15.3
To reproduce:
git clone https://github.com/haskell/ghcup-hs.git
stack build
This seems to only happen on macOS (in CI).
The text was updated successfully, but these errors were encountered: