klapaucius / vector-hashtables

Other
33 stars 5 forks source link

Build failure of `vector-hashtables-0.1.0.0` with `cabal build -w ghc-8.6.5 --prefer-oldest` #19

Closed andreasabel closed 11 months ago

andreasabel commented 11 months ago

Looks like the lower bounds of vector-hashtables-0.1.0.0 are not set correctly, please make suitable Hackage revisions! (I have not tested if other versions of vector-hashtables are affected.)

$ cabal get vector-hashtables-0.1.0.0
$ cd vector-hashtables-0.1.0.0/
$ cabal build -w ghc-8.6.5 --prefer-oldest

Building library for vector-hashtables-0.1.0.0...
[1 of 4] Compiling Data.Primitive.PrimArray.Utils ( src/Data/Primitive/PrimArray/Utils.hs, /Users/abel/tmp/vector-hashtables-0.1.0.0/dist-newstyle/build/x86_64-osx/ghc-8.6.5/vector-hashtables-0.1.0.0/build/Data/Primitive/PrimArray/Utils.o )

src/Data/Primitive/PrimArray/Utils.hs:9:1: error:
    Could not load module ‘Data.Primitive.PrimArray’
    It is a member of the hidden package ‘primitive-0.8.0.0’.
    Perhaps you need to add ‘primitive’ to the build-depends in your .cabal file.
    It is a member of the hidden package ‘primitive-0.7.4.0’.
    Perhaps you need to add ‘primitive’ to the build-depends in your .cabal file.
    It is a member of the hidden package ‘primitive-0.7.1.0’.
    Perhaps you need to add ‘primitive’ to the build-depends in your .cabal file.
    Use -v to see a list of the files searched for.
  |
9 | import Data.Primitive.PrimArray
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

$ cabal-plan fingerprint
...
... primitive-0.6.1.1
...
ulysses4ever commented 11 months ago

Thanks for reporting! Our bounds are very much loose, indeed. Will look into it.

andreasabel commented 11 months ago

Looks like you need primitive-0.6.4.0 at least, which adds the module Data.Primitive.PrimArray.

I also see that a point release 0.1.1.2 was made to revise some bounds: https://github.com/klapaucius/vector-hashtables/blob/29abb49db7d71582d1f9b7ae2cf3fe87a89084ae/changelog.md?plain=1#L9-L12 Let me emphasize here that a point release is not a solution to bound errors, only revisions can fix such errors properly (and these should be applied to all affected releases, not just the most recent one).

andreasabel commented 11 months ago

Looks like you need primitive-0.6.4.0 at least, which adds the module Data.Primitive.PrimArray.

I should be more precise: primitive-0.6.4.0 is the exact lower bound we need, otherwise the package will become incompatible with stackage lts-14.27, see https://www.stackage.org/lts-14.27/package/primitive-0.6.4.0.

andreasabel commented 11 months ago

Sorry, rowing back... primitive-0.6.4.0 is still not sufficient, I get these errors then:

Building library for vector-hashtables-0.1.1.1...
[1 of 4] Compiling Data.Primitive.PrimArray.Utils ( src/Data/Primitive/PrimArray/Utils.hs, dist/build/Data/Primitive/PrimArray/Utils.o )

src/Data/Primitive/PrimArray/Utils.hs:24:12: error:
    • Variable not in scope:
        cloneMutablePrimArray
          :: MutablePrimArray (PrimState m) a
             -> Integer -> Int -> m (MutablePrimArray (PrimState m) a)
    • Perhaps you meant one of these:
        ‘copyMutablePrimArray’ (imported from Data.Primitive),
        ‘sameMutablePrimArray’ (imported from Data.Primitive),
        ‘cloneMutableArray’ (imported from Data.Primitive)
   |
24 | clone xs = cloneMutablePrimArray xs 0 (sizeofMutablePrimArray xs)
   |            ^^^^^^^^^^^^^^^^^^^^^

src/Data/Primitive/PrimArray/Utils.hs:59:14: error:
    • Variable not in scope:
        clonePrimArray :: PrimArray a -> Integer -> Int -> PrimArray a
    • Perhaps you meant one of these:
        ‘copyPrimArray’ (imported from Data.Primitive),
        ‘newPrimArray’ (imported from Data.Primitive),
        ‘foldlPrimArray’ (imported from Data.Primitive)
   |
59 |     return $ clonePrimArray r 0 (sizeofPrimArray r)
   |              ^^^^^^^^^^^^^^

This works:

vector-hashtables-0.1.1.1$ cabal build -w ghc-8.6.5 --prefer-oldest -O0 -c 'primitive >= 0.7.1'
ulysses4ever commented 11 months ago

The changelog entry you referenced suggests that the precise bound is 0.7.1.0 because earlier versions don't have the clone* functions that we use. I just checked that we can't build with 0.6.4.0 and that we can build with 0.7.1.0, and made revisions for all the older versions on Hackage that didn't have a lower bound on primitive. Now, I checked that the 0.1.0.0 version builds with --prefere-oldest on GHC 8.8.4 (this is the oldest one I have handy). Does this sound good to close the issue?

Thanks a lot for educating me on revisions! I have yet to master this skill...

andreasabel commented 11 months ago

Excellent, thank you, Artem!