Home > Blockchain >  Error with cabal install while building lib
Error with cabal install while building lib

Time:05-24

I'm trying to install FunGEn with cabal install --allow-newer=all FunGEn (I added --allow-newer=all bcs it was having trouble with dependencies). After a few tries of running this I keep getting the same error message:

Resolving dependencies...
Build profile: -w ghc-9.2.1 -O1
In order, the following will be built (use -v for more details):
 - text-1.2.3.2 (lib) (requires build)
 - OpenGLRaw-3.3.4.1 (lib) (requires build)
 - GLURaw-2.0.0.5 (lib) (requires build)
 - OpenGL-3.0.3.0 (lib) (requires build)
 - GLUT-2.7.0.16 (lib) (requires build)
 - FunGEn-1.1.1 (lib) (requires build)
 - FunGEn-1.1.1 (exe:fungen-worms) (requires build)
 - FunGEn-1.1.1 (exe:fungen-hello) (requires build)
 - FunGEn-1.1.1 (exe:fungen-pong) (requires build)
Starting     text-1.2.3.2 (lib)
Building     text-1.2.3.2 (lib)

Failed to build text-1.2.3.2.
Build log (
C:\cabal\logs\ghc-9.2.1\text-1.2.3.2-69443a9a6ed6dc92878e4d67ead16d149c2e752e.log
):
Preprocessing library for text-1.2.3.2..
Building library for text-1.2.3.2..
[ 1 of 44] Compiling Data.Text.Encoding.Error ( Data\Text\Encoding\Error.hs, dist\build\Data\Text\Encoding\Error.o )
[ 2 of 44] Compiling Data.Text.Internal.Builder.Int.Digits ( Data\Text\Internal\Builder\Int\Digits.hs, dist\build\Data\Text\Internal\Builder\Int\Digits.o )
[ 3 of 44] Compiling Data.Text.Internal.Builder.RealFloat.Functions ( Data\Text\Internal\Builder\RealFloat\Functions.hs, dist\build\Data\Text\Internal\Builder\RealFloat\Functions.o )
[ 4 of 44] Compiling Data.Text.Internal.Encoding.Utf16 ( Data\Text\Internal\Encoding\Utf16.hs, dist\build\Data\Text\Internal\Encoding\Utf16.o )

Data\Text\Internal\Encoding\Utf16.hs:32:23: error:
    * Couldn't match expected type `Word#' with actual type `Word16#'
    * In the first argument of `word2Int#', namely `a#'
      In the expression: word2Int# a#
      In an equation for `x#': !x# = word2Int# a#
   |
32 |       !x# = word2Int# a#
   |                       ^^

Data\Text\Internal\Encoding\Utf16.hs:33:23: error:
    * Couldn't match expected type `Word#' with actual type `Word16#'
    * In the first argument of `word2Int#', namely `b#'
      In the expression: word2Int# b#
      In an equation for `y#': !y# = word2Int# b#
   |
33 |       !y# = word2Int# b#
   |                       ^^
cabal.exe: Failed to build text-1.2.3.2 (which is required by exe:fungen-worms
from FunGEn-1.1.1, exe:fungen-hello from FunGEn-1.1.1 and others). See the
build log above for details.

Can somebody please explain what's going wrong here, and possibly how to fix it? Thank You!

CodePudding user response:

These particular errors are coming from using GHC 9.2 to compile code that is not compatible with GHC 9.2. The package you're trying to use compiles okay with GHC 9.0 (no --allow-newer needed), which I suggest you to use. It is very easy to switch between compiler versions these days using GHCup.

Another option, not requiring switching the compiler, is, as you do, to apply --alow-newer in some way. You should understand that it's a very dangerous weapon better used only in cases when you understand how dependency solving works, and have sufficient experience with it and cabal in general. The variant that worked for me:

cabal update
cabal install --allow-newer=bytestring FunGEn

Another possible issue in your approach is that cabal install (without appropriate switches on top of it) will only give you executables in the package, not the library. It's okay if that's what you want.

  • Related