Repository navigation
Closed
Description
Due to the vector package upgrade, the following happened:
vanessa@thinkpad ~/programming 🌸 cabal new-install ats-pkg
Resolving dependencies...
Build profile: -w ghc-8.6.2 -O1
In order, the following will be built (use -v for more details):
- ats-pkg-3.2.4.4 (lib) (requires build)
- ats-pkg-3.2.4.4 (exe:atspkg) (requires build)
Starting ats-pkg-3.2.4.4 (lib)
Building ats-pkg-3.2.4.4 (lib)
Failed to build ats-pkg-3.2.4.4.
Build log (
/home/vanessa/.cabal/logs/ghc-8.6.2/ats-pkg-3.2.4.4-220240a7fc982f1ef6dbbd3d7adca7552df6a1a213963e5fccd3aa4e9777ba0d.log
):
Warning: ats-pkg.cabal:52:5: The field "build-tools" is deprecated in the
Cabal specification version 2.0. Please use 'build-tool-depends' field
Configuring library for ats-pkg-3.2.4.4..
Warning: The package has an extraneous version range for a dependency on an
internal library: ats-pkg -any && ==3.2.4.4. This version range includes the
current package but isn't needed as the current package's library will always
be used.
Warning:
This package indirectly depends on multiple versions of the same package. This is very likely to cause a compile failure.
package ats-pkg (ats-pkg-3.2.4.4-a0502221d0d07ee100c04ace74149f498e46682acc88ea189fea506f5623b3ee) requires dhall-1.19.1-1fe9a070c032067f2d160ed443460097fec88c08fcd38d54eede84d5563dcb39
package ats-pkg (ats-pkg-3.2.4.4) requires dhall-1.19.1-7f45d71c84a4f197a2691eb97907b8bd119d9ca492a802e003e397032de7b119
package dhall (dhall-1.19.1-1fe9a070c032067f2d160ed443460097fec88c08fcd38d54eede84d5563dcb39) requires serialise-0.2.1.0-5d9662694e8f9b09c2f191eb32be6eef1ece0c9136b3ad50bb8f100ea14d93fa
package dhall (dhall-1.19.1-7f45d71c84a4f197a2691eb97907b8bd119d9ca492a802e003e397032de7b119) requires serialise-0.2.1.0-c251b18b942c982fe79f40f9864275e9a5c111ad79cc6e4d869e0de51819b2a3
package serialise (serialise-0.2.1.0-5d9662694e8f9b09c2f191eb32be6eef1ece0c9136b3ad50bb8f100ea14d93fa) requires vector-0.12.0.1-959b3278eb03c494c9c33864bcaa5e8ecf0455b6f6d8fd11e984803a63c05b49
package dhall (dhall-1.19.1-1fe9a070c032067f2d160ed443460097fec88c08fcd38d54eede84d5563dcb39) requires vector-0.12.0.1-959b3278eb03c494c9c33864bcaa5e8ecf0455b6f6d8fd11e984803a63c05b49
package serialise (serialise-0.2.1.0-c251b18b942c982fe79f40f9864275e9a5c111ad79cc6e4d869e0de51819b2a3) requires vector-0.12.0.2-7479aef3e2736f944c6682efd74d870b2a80551faaa63d55fd6849324aacdd74
package dhall (dhall-1.19.1-7f45d71c84a4f197a2691eb97907b8bd119d9ca492a802e003e397032de7b119) requires vector-0.12.0.2-7479aef3e2736f944c6682efd74d870b2a80551faaa63d55fd6849324aacdd74
Preprocessing library for ats-pkg-3.2.4.4..
Building library for ats-pkg-3.2.4.4..
[ 1 of 14] Compiling Language.ATS.Package.Build.C ( src/Language/ATS/Package/Build/C.hs, dist/build/Language/ATS/Package/Build/C.o )
[ 2 of 14] Compiling Language.ATS.Package.Compiler ( src/Language/ATS/Package/Compiler.hs, dist/build/Language/ATS/Package/Compiler.o )
[ 3 of 14] Compiling Language.ATS.Package.Config ( src/Language/ATS/Package/Config.hs, dist/build/Language/ATS/Package/Config.o )
[ 4 of 14] Compiling Language.ATS.Package.Debian ( src/Language/ATS/Package/Debian.hs, dist/build/Language/ATS/Package/Debian.o )
src/Language/ATS/Package/Debian.hs:30:49: error:
Ambiguous occurrence ‘Interpret’
It could refer to either ‘Dhall.Interpret’,
imported from ‘Dhall’ at src/Language/ATS/Package/Debian.hs:17:1-57
or ‘Quaalude.Interpret’,
imported from ‘Quaalude’ at src/Language/ATS/Package/Debian.hs:18:1-25
(and originally defined in ‘dhall-1.19.1:Dhall’)
|
30 | deriving (Generic, Binary, Interpret)
| ^^^^^^^^^
src/Language/ATS/Package/Debian.hs:32:27: error:
Ambiguous occurrence ‘Interpret’
It could refer to either ‘Dhall.Interpret’,
imported from ‘Dhall’ at src/Language/ATS/Package/Debian.hs:17:1-57
or ‘Quaalude.Interpret’,
imported from ‘Quaalude’ at src/Language/ATS/Package/Debian.hs:18:1-25
(and originally defined in ‘dhall-1.19.1:Dhall’)
|
32 | deriving newtype instance Interpret Version
| ^^^^^^^^^
cabal: Failed to build ats-pkg-3.2.4.4 (which is required by exe:atspkg from
ats-pkg-3.2.4.4). See the build log above for details.
I believe that this is due to the fact that quaalude (an internal prelude for ats-pkg) depends on dhall. As the build report above attests, quaalude was not rebuilt in light of the vector upgrade; I'm guessing that cabal tried to link the old cached quaalude against the new dhall.
Metadata
Metadata
Assignees
Labels
No labels
Activity
23Skidoo commentedon Jan 16, 2019
Would it be possible to come up with a small repro case?
Mikolaj commentedon Apr 1, 2019
I had something similar caused by executable depending on an internal library from its package and the whole (anonymous) library of this package as well (the internal library depended on the whole library as well). In the result, the build used two versions of the whole library (I suppose, it took the whole library already installed previously and then probably compiled the internal library again). Note the double
LambdaHack-0.9.2.0I got in the resulting GHC invocation below. And then the types didn't agree (diamond import problem).If there is interest, I can create a branch to repro, but I doubt I could come up with a small example.
23Skidoo commentedon Apr 1, 2019
A repro case would surely be nice to have.
Mikolaj commentedon Apr 2, 2019
I'm not sure if the errors I'm getting are because I've broken my cabal DB and I don't want to rebuild all the packages to check, but I guess these are the steps to reproduce:
If it still doesn't fail, run
make build-binary-common.Edit: yes, after the first
cabal new-installI'm getting:sebright commentedon Apr 28, 2019
I wasn't able to reproduce the multiple versions error with LambdaHack. I tried running the first set of commands in #5782 (comment) with both cabal-install-2.4.1.0 and HEAD (27cf519 and 6316102), with GHC 8.6.4 and
--index-state=2019-04-01T00:00:00Z.Cabal listed five LambdaHack components to be built (main library, three internal libraries, and an executable), which seems correct:
Here is the end of the log, which corresponds to the log in the previous comment. I noticed that the components were built in a different order, with
this-game-contentbuilt between the main library andthis-game-src.There was one directory for each LambdaHack component in the store afterwards.
Which version of cabal caused the error? Were any other packages installed? Do you know what index state was used or have a full log?
Mikolaj commentedon Apr 28, 2019
@GrayJay: thank you for trying to repro. That was cabal version 3.0.0.0, somewhat older than my bug report. I can't tell the exact date. All deps were already installed. Can you try re-installing? I've just tried again with cabal from 6316102 and here's the full log: https://gist.github.com/Mikolaj/5661f4e69635e5c4f3c040ef211b1d68. Note how "indirectly depends on multiple" only appears when I run cabal again. Let me know if I can help any more.
sebright commentedon Apr 29, 2019
@Mikolaj Thanks for the log. I tried installing the dependencies separately, as well as making code changes to trigger a partial rebuild, but all of the commands succeeded.
I noticed that the first new-install in the log failed with some profiling errors:
How is profiling enabled? I tried installing LambdaHack with
--enable-profiling, but that failed due to #5982.Mikolaj commentedon Apr 29, 2019
Profiling is enabled through my ~/.cabal/config file: https://gist.github.com/Mikolaj/da6494a16d6f121eefad1930394de699
Mikolaj commentedon Apr 29, 2019
I do remember meddling with cabal package DB before originally posting about the error. Some
ghc-pkginvocations, perhaps even some raw deletions from.cabalor.ghc. So now I've removed both.cabalor.ghcand started in a fresh clone of the repo. Compilation succeeded. Then I turned on profiling in ~/.cabal/config (no other changes) and tried again. It recompiled everything and now I'm getting "indirectly depends on multiple versions" again.Mikolaj commentedon Apr 29, 2019
I'm now even getting this:
which looks like some file corruption to me.
phadej commentedon Apr 29, 2019
@Mikolaj I don't see any
Binary EnumSetinstance in https://hackage.haskell.org/package/enummapset-0.6.0.1/docs/Data-EnumSet.html, so that error feels valid?Mikolaj commentedon Apr 29, 2019
Well, yes, the instance is here:
https://github.com/LambdaHack/LambdaHack/blob/16e5632a10b116905e499f2dd83ca21d0a0be261/definition-src/Game/LambdaHack/Core/Prelude.hs#L85
but the anonymous library depends on the
definitionlibraryhttps://github.com/LambdaHack/LambdaHack/blob/16e5632a10b116905e499f2dd83ca21d0a0be261/LambdaHack.cabal#L330
so it should be included.
Edit: Which is why it compiles fine most of the time.
phadej commentedon Apr 29, 2019
Oh, I see.
yet
if it's reproducible, at least on your machine. Could you upload here the
plan.json(found indist-newstyle/cache/plan.json)Mikolaj commentedon Apr 29, 2019
@phadej, @GrayJay: Yes, it's reproducible, but only once. Then, on a second run (even after
cabal new-clean; cabal clean, it exhibits theCould not find module ‘Game.LambdaHack.Core.Prelude’error instead. So then you have to wipe out ~/.cabal again, docabal new-updateand doit will succeed. Then set
library-profiling: Truein~/.cabal/config, docabal new-install -j1 .and wait until it all rebuilds. Only then you get the error (if you enable profiling in the first run, I think, it just succeeds, but the evidence has scrolled pass the terminal memory threshold, so I'm not sure). The resultingplan.jsonafter the error isThe ending of the log:
sebright commentedon Apr 30, 2019
Thanks! I was able to reproduce the issue by enabling profiling in ~/.cabal/config and rebuilding. I'll look into it further when I have time.
8 remaining items
Mikolaj commentedon May 6, 2021
Nobody reports that this issue is reproducible with current stable cabal or newer, so, if @emilypi, @fgaz and others don't object, I'm going to close this soon, together with half a dozen related issues (some of them mentioned in GHC tickets, so the noise is considerable). BTW, thank you everybody for providing repros and comments --- I'm sure they were helpful in keeping the work on the improvements in the area going, even if we eventually missed the point when the problem was finally fixed for good and the issues didn't get closed with proper thanks to all involved.
jneira commentedon May 6, 2021
I am for closing optimistically issues, but would be great to know what was the cause of the bug, what commits fixed it and what regression tests will ensure it will not arise again.
Maybe it is asking too much, I know. 🙂
Mikolaj commentedon May 6, 2021
@jneira: no, these are reasonable aspirations and an especially good point about adding tests. Sadly, the only reasonably small original repro, by @GrayJay, no longer works for unrelated reasons (many things changed since then). We could use my first test from #5782 (comment) (it can be simplified a bit, but I tried to keep it close to the original) but the problem is it has never failed (and I'm not sure it would be accepted in cabal version old enough to trigger the original error --- could you perhaps try to iterate through versions and find one where it fails for the right reason?). Generally, this and the related issues were hard to repro, where many initial repros non-deterministic, etc., so it's a lot of extra work especially after such a long time. I'm afraid we don't have the capacity ATM, unless somebody helps. Volunteers?
jneira commentedon May 6, 2021
Yeah this is one of the really fun kind of bugs. Maybe if we only would know what pr or commits are the main candidates for having been the ones which have fixed it...
We experienced it in haskell-language-server when we had a private library for shared testing code, but not consistently, removing the store fixed it iirc. We had to convert it in a package due to this bug (i guess many projects had to do it, even without reporting it here)
Mikolaj commentedon May 6, 2021
You are right, this issue may have been more widespread than meets the eye. Therefore, if somebody would volunteer to bisect cabal commits history using my test from #5782 (comment), that would be very welcome. Also, any running any likely reproduction, successfully or not, with an up to date cabal version would help.
I will ask on the other issues related to this one [edit: will limit myself to cabal issues, there's too many in other repos, e.g., changing internal libraries to common stanzas] and wait for a week.
Mikolaj commentedon May 6, 2021
BTW, Oleg says in #6483 (comment) that possibly the commit fixing #6410 also fixed this set of problems and he confirms he can't repro his original examples either. Perhaps worth testing the commit just before the one that fixes #6410 and then the one, e.g., with my test above?
Edit: And the commit in question is backported twice, one time as far back as to v3.0.1.0: 9089b0e which would suggest original v3.0 had the problem, but an updated v.3.0 didn't and v3,2 didn't have the problem from the start.
Mikolaj commentedon May 7, 2021
Data point: my test compiles fine (two runs, with changed code in Module.hs in between) with cabal 3.3 and GHC 8.6.5.
Mikolaj commentedon May 7, 2021
Data point 2: but it fails in the following way, matching the problem we are after, with cabal 3.0.2.0 and GHC 8.6.5. Which either means it's not deterministic, after all (but I think these little tests are) or the fix for #6410 did not yet (fully) solve the problem [edit: not so, I mixed up Cabal and cabal-install versions, see next comment].
Edit: yet another explanation might be that some change tweaked the non-determinism so that the problem does not manifest in the small tests, but still manifests in huge ones that involve strange timing of file writes, etc.
Mikolaj commentedon May 7, 2021
Data point 3: my test passes fine with cabal 3.2 and GHC 8.6.5.
BTW, I've double-checked and the fix to #6410 seems to be included in cabal-install 3.0.1.0, which was never released until cabal-install 3.2. I don't see any evidence it was included in Cabal 3.0.2.0, only in Cabal 3.2.0.0 (alpha). So, in the end, this is consistent with Oleg's hunch which commit fixed it.
Edit: even though it passes fine and there are no warnings "indirectly depends on multiple versions", the executable gives a wrong result, ignoring the change to the file and the second compilation. So 3.2 probably fixed depending on multiple version, but the single version the executable depends on is the wrong one (the older one).
Mikolaj commentedon May 7, 2021
Data point 4: cabal 3.4 (with GHC 8.6.5) fixes this for good, both no longer depending on multiple versions of an internal library and actually depending on the last compiled version, not the first compiled version.
That's as far as I have capacity to go. If anybody would like to bisect to find the relevant commit(s), please volunteer before or after I close the issue and share here in a comment.
The great outcome of @jneira aspirations and this series of tests is that we now know what to include as regression test (and that we need to run the executable and check the result or carefully inspect the install plan --- grepping for a warning is not enough). Any volunteer to add the test to our test suite? It can still be simplified, I'm sure.
jneira commentedon May 7, 2021
wow, impressive summary of the state of things, many thanks
btw I had forgotten my own issue 😂
Mikolaj commentedon May 11, 2021
Nobody volunteered nor dissuaded me, so I'm adding the test for this issue myself. I can't find a similar test. All have too few internal libraries to form a diamond. Directory
cabal/cabal-testsuite/PackageTests/InternalLibrariessounds like the right place to add one.Merge pull request #7397 from Mikolaj/master
Mikolaj commentedon May 24, 2021
We have the regression test in place and it fails with cabal 3.2 (and even more often with 3.0) and works with 3.4, Closing. Thank you all.