haskell / attoparsec

A fast Haskell library for parsing ByteStrings
http://hackage.haskell.org/package/attoparsec
Other
514 stars 93 forks source link

Trouble building Attoparsec against Text v2 #218

Closed alcinnz closed 1 year ago

alcinnz commented 1 year ago

Honestly, I'm having trouble understanding this issue & I'm not entirely sure I'm reporting it to the right project. But I'm attempting to build a project against Text v2 & when I attempt to pull in an indirect dependency on Attoparsec I get build errors:

Resolving dependencies... Build profile: -w ghc-8.8.4 -O1 In order, the following will be built (use -v for more details):

  • attoparsec-0.14.4 (lib) (requires build)
  • cattrap-0.2.0.0 (lib) (configuration changed)
  • mono-traversable-1.0.15.3 (lib) (requires build)
  • publicsuffixlist-0.1 (lib) (requires build)
  • regex-1.1.0.2 (lib) (requires build)
  • x509-1.7.7 (lib) (requires build)
  • xml-types-0.3.8 (lib) (requires build)
  • cattrap-0.2.0.0 (exe:cattrap) (configuration changed)
  • conduit-1.3.5 (lib) (requires build)
  • x509-store-1.6.9 (lib) (requires build)
  • conduit-extra-1.3.6 (lib) (requires build)
  • x509-validation-1.6.12 (lib) (requires build)
  • x509-system-1.6.7 (lib) (requires build)
  • xml-conduit-1.8.0.1 (lib) (requires build)
  • tls-1.6.0 (lib) (requires build)
  • xml-conduit-stylist-3.0.0.1 (lib) (requires build)
  • html-conduit-1.3.2.2 (lib) (requires build)
  • connection-0.3.1 (lib) (requires build)
  • http-client-tls-0.3.6.1 (lib) (requires build)
  • hurl-2.3.0.1 (lib) (requires build)
  • hurl-xml-0.2.0.2 (lib) (requires build)
  • cattrap-0.2.0.0 (exe:cattrap-argonaut) (first run) Configuring library for cattrap-0.2.0.0.. Starting mono-traversable-1.0.15.3 (lib) Starting publicsuffixlist-0.1 (lib) Starting attoparsec-0.14.4 (lib) Building publicsuffixlist-0.1 (lib) Building attoparsec-0.14.4 (lib) Building mono-traversable-1.0.15.3 (lib) Preprocessing library for cattrap-0.2.0.0.. Building library for cattrap-0.2.0.0.. Starting regex-1.1.0.2 (lib) Installing publicsuffixlist-0.1 (lib) Building regex-1.1.0.2 (lib) Completed publicsuffixlist-0.1 (lib) Installing regex-1.1.0.2 (lib) Completed regex-1.1.0.2 (lib) Installing mono-traversable-1.0.15.3 (lib) Completed mono-traversable-1.0.15.3 (lib)

Failed to build attoparsec-0.14.4. Build log ( /home/alcinnz/.cabal/logs/ghc-8.8.4/attoparsec-0.14.4-52b3f9259cafc26ca0902f1f74f1f78af62688a9bc291cb2d80f95516634b231.log ): Configuring library for attoparsec-0.14.4.. Warning: This package indirectly depends on multiple versions of the same package. This is very likely to cause a compile failure. package text (text-1.2.4.0) requires binary-0.8.7.0 package text (text-2.0.2-633b852027b20c0fa15cdc6aa0582a16799aa2dba778e609e65489fd22c4a0c8) requires binary-0.8.9.1-0f5f037a6179f75aed6abb77ac1a7a0ae025cbd9e3dcd0e23ca509b9fae6dc9a package scientific (scientific-0.3.7.0-168e40d6131f6472caa3b498eb8ff6b8a358fc3a44e178b0a83ea936dcf50d19) requires binary-0.8.9.1-0f5f037a6179f75aed6abb77ac1a7a0ae025cbd9e3dcd0e23ca509b9fae6dc9a package text (text-1.2.4.0) requires bytestring-0.10.10.1 package binary (binary-0.8.7.0) requires bytestring-0.10.10.1 package attoparsec (attoparsec-0.14.4-ff0b17084884f6158ddadcb12faca37440647280ff60156061adf50bcd02bfbf) requires bytestring-0.10.10.1 package text (text-2.0.2-633b852027b20c0fa15cdc6aa0582a16799aa2dba778e609e65489fd22c4a0c8) requires bytestring-0.11.4.0-7180aa0dc02744d1241f201d995e3f2c13042c6a53630f87ca36e74ecf16120e package scientific (scientific-0.3.7.0-168e40d6131f6472caa3b498eb8ff6b8a358fc3a44e178b0a83ea936dcf50d19) requires bytestring-0.11.4.0-7180aa0dc02744d1241f201d995e3f2c13042c6a53630f87ca36e74ecf16120e package hashable (hashable-1.4.2.0-b8b664940394d69d95b3b1d89b707a3f383bc095853826d9498f363dccb8442a) requires bytestring-0.11.4.0-7180aa0dc02744d1241f201d995e3f2c13042c6a53630f87ca36e74ecf16120e package binary (binary-0.8.9.1-0f5f037a6179f75aed6abb77ac1a7a0ae025cbd9e3dcd0e23ca509b9fae6dc9a) requires bytestring-0.11.4.0-7180aa0dc02744d1241f201d995e3f2c13042c6a53630f87ca36e74ecf16120e package attoparsec (attoparsec-0.14.4) requires bytestring-0.11.4.0-7180aa0dc02744d1241f201d995e3f2c13042c6a53630f87ca36e74ecf16120e package attoparsec (attoparsec-0.14.4-ff0b17084884f6158ddadcb12faca37440647280ff60156061adf50bcd02bfbf) requires text-1.2.4.0 package scientific (scientific-0.3.7.0-168e40d6131f6472caa3b498eb8ff6b8a358fc3a44e178b0a83ea936dcf50d19) requires text-2.0.2-633b852027b20c0fa15cdc6aa0582a16799aa2dba778e609e65489fd22c4a0c8 package hashable (hashable-1.4.2.0-b8b664940394d69d95b3b1d89b707a3f383bc095853826d9498f363dccb8442a) requires text-2.0.2-633b852027b20c0fa15cdc6aa0582a16799aa2dba778e609e65489fd22c4a0c8 package attoparsec (attoparsec-0.14.4) requires text-2.0.2-633b852027b20c0fa15cdc6aa0582a16799aa2dba778e609e65489fd22c4a0c8 Preprocessing library for attoparsec-0.14.4.. Building library for attoparsec-0.14.4.. [ 1 of 16] Compiling Data.Attoparsec.Internal.Types ( Data/Attoparsec/Internal/Types.hs, dist/build/Data/Attoparsec/Internal/Types.o )

Data/Attoparsec/Internal/Types.hs:242:18: error: • Couldn't match type ‘ByteString’ with ‘bytestring-0.10.10.1:Data.ByteString.Internal.ByteString’ NB: ‘bytestring-0.10.10.1:Data.ByteString.Internal.ByteString’ is defined in ‘Data.ByteString.Internal’ in package ‘bytestring-0.10.10.1’ ‘ByteString’ is defined in ‘Data.ByteString.Internal.Type’ in package ‘bytestring-0.11.4.0’ Expected type: State ByteString -> ByteString -> State ByteString Actual type: B.Buffer -> bytestring-0.10.10.1:Data.ByteString.Internal.ByteString -> B.Buffer • In the expression: B.pappend In an equation for ‘pappendChunk’: pappendChunk = B.pappend In the instance declaration for ‘Chunk ByteString’ | 242 | pappendChunk = B.pappend | ^^^^^^^^^

Data/Attoparsec/Internal/Types.hs:257:18: error: • Couldn't match type ‘Text’ with ‘text-1.2.4.0:Data.Text.Internal.Text’ NB: ‘text-1.2.4.0:Data.Text.Internal.Text’ is defined in ‘Data.Text.Internal’ in package ‘text-1.2.4.0’ ‘Text’ is defined in ‘Data.Text.Internal’ in package ‘text-2.0.2’ Expected type: State Text -> Text -> State Text Actual type: T.Buffer -> text-1.2.4.0:Data.Text.Internal.Text -> T.Buffer • In the expression: T.pappend In an equation for ‘pappendChunk’: pappendChunk = T.pappend In the instance declaration for ‘Chunk Text’ | 257 | pappendChunk = T.pappend | ^^^^^^^^^

Data/Attoparsec/Internal/Types.hs:262:41: error: • Couldn't match expected type ‘Iter’ with actual type ‘text-1.2.4.0:Data.Text.Unsafe.Iter’ NB: ‘text-1.2.4.0:Data.Text.Unsafe.Iter’ is defined in ‘Data.Text.Unsafe’ in package ‘text-1.2.4.0’ ‘Iter’ is defined in ‘Data.Text.Unsafe’ in package ‘text-2.0.2’ • In the expression: T.iter buf i In a pattern binding: Iter c l = T.iter buf i In the expression: let Iter c l = T.iter buf i in Just (c, l) | 262 | | i < T.length buf = let Iter c l = T.iter buf i in Just (c, l) | ^^^^^^^^^^^^ cabal: Failed to build attoparsec-0.14.4 (which is required by exe:cattrap-argonaut from cattrap-0.2.0.0). See the build log above for details.

Any help figuring this out would be appreciated! In the error message Attoparsec's the only transitive dependency named as requiring Text v1.

andreasabel commented 1 year ago

Can't say much since you haven't supplied a reproducer of the issue (which must be independent of your system). Some things to investigate further:

alcinnz commented 1 year ago

Thanks for engaging, cabal build --version='text>=2'.

Weirdly consulting cabal-plan does not list what is pulling the outdated Text dependency: out.txt

Here's the git repository I'm having issue with: https://git.argonaut-constellation.org/~alcinnz/CatTrap In the Cabal file commenting out my "executable cattrap-argonaut" section silences the issue, but I do need to pull together these dependencies.

I guess I might try testing this on other systems & narrow down a simpler test to trigger this error I'm facing. I'll get back to you on that tomorrow.

andreasabel commented 1 year ago

Here's the git repository I'm having issue with: git.argonaut-constellation.org/~alcinnz/CatTrap

I reenabled the commented out executable in the .cabal file, but I am getting a build error in commit 590ef319be4179b113a8fc2212fe0f27b0dc3daf of this repo.

$ cabal build -w ghc-8.8.4
...
[ 7 of 12] Compiling Graphics.Layout.Inline ( Graphics/Layout/Inline.hs, /Users/abel/tmp/CatTrap/dist-newstyle/build/x86_64-osx/ghc-8.8.4/cattrap-0.2.0.0/build/Graphics/Layout/Inline.o )

Graphics/Layout/Inline.hs:94:15: error:
    • The constructor ‘ParagraphLayout’ should have 3 arguments, but has been given 2
    • In the pattern: ParagraphLayout a b
      In an equation for ‘layoutMap’:
          layoutMap cb (ParagraphLayout a b)
            = ParagraphLayout a $ map inner b
            where
                inner self@Fragment {fragmentUserData = (a, b, c)}
                  = self
                      {fragmentUserData = (a, cb b, c),
                       fragmentAncestorBoxes = map inner' $ fragmentAncestorBoxes self}
                inner' self@AncestorBox {boxUserData = (a, b, c)}
                  = self {boxUserData = (a, cb b, c)}
   |
94 | layoutMap cb (ParagraphLayout a b) = ParagraphLayout a $ map inner b
   |               ^^^^^^^^^^^^^^^^^^^

Cannot reproduce the configuration error you are reporting.

alcinnz commented 1 year ago

Sorry, it seems I forgot to commit a fix necessitated by a different dependency! I'll make sure to address that today!

alcinnz commented 1 year ago

That issues addressed, & here's a simpler test: https://git.argonaut-constellation.org/~alcinnz/integration

andreasabel commented 1 year ago

here's a simpler test: git.argonaut-constellation.org/~alcinnz/integration

This builds fine, e.g. with GHC 8.8.4:

$ cabal build -w ghc-8.8.4
...
$ cabal-plan fingerprint
0bdbab8e4c3178016fb0f070d8b62bc3067f93afabfbd3aa17c8065d0ecc98ee G Cabal-3.10.1.0
3b80092355327768a0de8298ac50ee906b7e82462e2ba14542730573b453f522 G Cabal-syntax-3.10.1.0
________________________________________________________________ B array-0.5.4.0
484df85be0e76c4fed9376451e48e1d0c6e97952ce79735b72d54297e7e0a725 G async-2.2.4
3f337fe58624565de12426f607c23e60c7b09c86b4e3adfc827ca188c9979e6c G attoparsec-0.14.4
dc6906d1e782f8e241b827609143f226dc534293722df3352b83ac747911d93f G balkon-1.3.0.0
________________________________________________________________ B base-4.13.0.0
613ed4d8241ed5a648a59ae6569a6962990bb545711d020d49fb83fa12d16e62 G base-orphans-0.9.0
ac21ca63452dfc9b0bcab87c57699c531d87f7a9bcb6230ca46fba1b7faeebc0 G binary-0.8.9.1
68f0b1e01604ca8bdeaef47b3621faec456d6f76d6820a321eccd4d3749454a8 G bitvec-1.1.4.0
2cdc998c021d3a5f2a66a95138b93386271c26a117e7676d78264a90e536af67 G blaze-builder-0.4.2.2
60503f42546c6c1b954014d188ea137e43d74dcffd2bf6157c113fd91a0c394c G blaze-html-0.9.1.2
43fc3f6872dc8d1be8d0fe091bd4775139b42179987f33d6490a7c5f1e07a349 G blaze-markup-0.8.2.8
76193d39b66197107f452184597a4e458194c64731efbba1e9605550c732f7f4 G bytestring-0.11.5.0
5556088496111d33810c4ae6c4a065bb37fa3315e9e8891e8000b1ab6707ba73 G cabal-doctest-1.0.9
2bb0d3e0eecc43e3d1d8cfc2125914f9175cde752be2d5908a1e120f321c782d G conduit-1.3.5
8950c38049d892c38590d389bed49ecf880671f58ec63dd4709d9fe3d4b8f153 G conduit-extra-1.3.6
________________________________________________________________ B containers-0.6.2.1
1bb6eca0b3e02d057fe7f4e14c81ef395216f421ab30fdaa1b18017c9c025600 G data-array-byte-0.1.0.1
4f01b423f000c3e069aaf52a348564a6536797f31498bb85c3db4bd2d0973e56 G data-default-class-0.1.2.0
________________________________________________________________ B deepseq-1.4.4.0
4c337451af8309e2597c388b734d4c4837bd2117438fcf947d285d8faf90447f G derive-storable-0.3.1.0
bd8253197587d32d4553070d2de89d3817176860932b0e9ab7bb7ba3759d8e9c G directory-1.3.8.1
9a42ade4c8b53d8da5350e8e0e2929f4ef128c4b8591b120656455310b546049 G exceptions-0.10.7
82876250347c2fdf0f9de5448ce44f02539f37951b671d9a30719a6c4f96e9ad G filepath-1.4.100.4
55b93f3a18c10b1db4da86634e5388ad97a38a4881fca2feebcb2c464d85bfb9 G freetype2-0.2.0
________________________________________________________________ B ghc-boot-th-8.8.4
________________________________________________________________ B ghc-prim-0.5.3
a028d1969adc80776eac7c0aeb6348c66d27061debfc33c938deaf5c81417936 G harfbuzz-pure-1.0.3.2
1b4000ea82b81f69d46d0af4152c10c6303873510738e24cfc4767760d30e3f8 G hashable-1.4.2.0
c95b10ce0b2c881480e35118d738dcc9cefc435ec72baa0031af81d0d4d3bc0a G hsc2hs-0.68.9
________________________________________________________________ B integer-gmp-1.0.2.0
9b0a9f9fab609b15cd015865721fb05f744a1bc77ae92fd133872de528bbea7f G integer-logarithms-1.0.3.1
________________________________________________________________ L integration-test-0.1.0.0
98b220f3313d74227a4249210c8818e839678343e62b3ebb1b8c867cf2b974b7 G mono-traversable-1.0.15.3
________________________________________________________________ B mtl-2.2.2
b452a2afac95d9207357eb3820c719c7c7d27871ef4b6ed7bfcd03a036b9158e G network-3.1.4.0
170453a71a2a8b31cca63125533f7771d7debeb639700bdabdd779c34d8a6ef6 G parallel-3.2.2.0
a41962e5d76ea68658876735b8d5b755e0eff336b079d0a2f439c364755d1246 G parsec-3.1.16.1
________________________________________________________________ B pretty-1.1.3.6
5553c21b4a789f9b591eed69e598cc58484c274af29250e517b5a8bcc62b995f G primitive-0.8.0.0
4c5c454e0f5c864c79b9fabd850307b26d8ac4037e45a6a39ab87e20b583bf06 G process-1.6.17.0
3e1272f7ed6a4d7bd1712b90143ec326fee9b225789222379fea20a9c90c9b76 G random-1.2.1.1
ec601785ee42a201f32adb205b8685c983f18757b1bd33d2e806d571e0f9996b G resourcet-1.3.0
________________________________________________________________ B rts-1.0
a3a121c4b3d68fb8b9f8c709ab012e48f090ed553609247a805ad070d6b343a9 G scientific-0.3.7.0
bf8aa8d610354a2b576946a6c838251ec5988c8374100638e6b2604513b93159 G split-0.2.3.5
6d065402394e7a9117093dbb4530a21342c9b1e2ec509516c8a8d0ffed98ecaa G splitmix-0.1.0.4
________________________________________________________________ B stm-2.5.0.0
0180958a882eb0f6262b812fe886c2b1b8285474b5b958f814ae4f05409fbf79 G streaming-commons-0.2.2.6
________________________________________________________________ B template-haskell-2.15.0.0
c735be650a898606ce9f2c8642bc6ac6123eea82871d5e90f92797801f59efad G text-2.0.2
2d99aa88c0b4c7a1a4fc10e7bd0590c334f49bae81ef76c77a370254a4ce3d3b G text-icu-0.8.0.2
________________________________________________________________ B time-1.9.3
________________________________________________________________ B transformers-0.5.6.2
948c59540675d85f35c99e285cdb8686713ec1689f530d5d21813239ea91f625 G typed-process-0.2.11.0
37a5dea6801940beb65c4ac4b9d0f7e653a686cf773507f0ca61c210e0b06080 G unicode-data-0.4.0.1
807549db1a626e9cf53a5d2076d2fe7c5a9e1e9867aaa606f5d1279eca13ea4e G unicode-data-scripts-0.2.0.1
cc287659427c80f3598c199387ba7eb7d4cc3270cbb31f75e2f677e879f26384 G unix-2.8.1.1
99384cba8d56d9d61b85e38a313a93ebcdb78be6566367f0930ef580597fe3e3 G unliftio-core-0.2.1.0
1b27bec5e0d522b27a6029ebf4c4a6d40acbc083c787008e32fb55c4b1d128d2 G unordered-containers-0.2.19.1
c5d3167d15e12f52e00879ddf304a591672a74e369cc47bc5c7fa1d5a8d15b4f G vector-0.13.0.0
2ba7c0d3a8f26ef3ada24ff4abe81609225ecbab3b5754f048f8a0a3ecc33841 G vector-algorithms-0.9.0.1
a888210f6467f155090653734be5cc920406a07227e0d3adb59096716fdb806c G vector-stream-0.1.0.0
d8e9169562c71c9e6bc616f15832f521a68c362aa4fc03682748a809755f1bf4 G xml-conduit-1.9.1.3
dad5e4ce602b7d1f4be37c0cfd99a261a4573746bfd80d917dc955b72da84c80 G xml-types-0.3.8
9eaa989ad4534438b5beb51c1d3a4c8f6a088fdff0b259a5394fbf39aaee04da G zlib-0.6.3.0

Maybe you have a problem on your system. Have you tried nuking your ~/.cabal/store?

Bodigrim commented 1 year ago

dist/build/Data/Attoparsec/Internal/Types.o suggests an extremely old Cabal invocation. Please upgrade Cabal to 3.10 and do not use v1- commands.

andreasabel commented 1 year ago

dist/build/Data/Attoparsec/Internal/Types.o suggests an extremely old Cabal invocation.

Oops, I overlooked this detail. I once considered whether maybe v1-cabal is used here...

@alcinnz If you use v1, then nuking the store/ does not help, as it is for v2. Then you need to nuke another part of the .cabal tree, which I have forgotten, as it is so long ago that I was in v1-cabal hell...

I am closing this issue, this is apparently just the old cabal hell of the past, nothing to do with attoparsec.

alcinnz commented 1 year ago

Yes, upgrading GHC & Cabal fixed my issue! Took me a bit to test this, but I'm happy to close this issue.