haskellcabal-install

cabal install fails with "arithmetic overflow"


I saw a possible solution for an utf8 problem here: Read file with UTF-8 in Haskell as IO String. I wanted to try that out, but I'm having a problem I can't resolve.

When I run the command cabal v2-install encoding --lib almost everything works but fails in the end with these lines:

[8 of 8] Compiling Main ( /tmp/cabal-install.-169090/dist-newstyle/tmp/src-169090/encoding-0.8.5/dist/setup/setup.hs, /tmp/cabal-install.-169090/dist-newstyle/tmp/src-169090/encoding-0.8.5/dist/setup/Main.o )
Linking /tmp/cabal-install.-169090/dist-newstyle/tmp/src-169090/encoding-0.8.5/dist/setup/setup ...
Configuring encoding-0.8.5...
Preprocessing library for encoding-0.8.5..
arithmetic overflow
cabal: Failed to build encoding-0.8.5. See the build log above for details.

If I add --verbose=3 to the command line the last few output lines are

creating dist/build/Data
creating dist/build/Data/Encoding
Data/Encoding/ISO88592.hs generated from mapping
Data/Encoding/ISO88592.mapping
arithmetic overflow
CallStack (from HasCallStack):
   die', called at ./Distribution/Client/ProjectOrchestration.hs:1041:55 in
main:Distribution.Client.ProjectOrchestration
cabal: Failed to build
encoding-0.8.5-aa69e7dd952ebb6bcbe7b0947ad7f87838ecbfac327d0aa020c7f7f0f19b3e18.

I'm using cabal 3.2 and GHC 8.10.2 under Linux Mint 20.

I've looked "all over the place" for a solution, and the only trace of something similar is that the error is confirmed in Gentoo's Bugzilla.

Any help is appreciated!


Solution

  • This is apparently a bug in the library encoding (I could reproduce it), and there's a fix available as a PR on the source repository:

    https://github.com/dmwit/encoding/pull/11