I tried to compile a stack project on alpine 3.24 using a raspberry pi 4. Nonetheless, I could compile the same project successfully on an intel 64 bit computer. Here are my specs:
- LTS 24.60
- GHC 9.10.3
During the compilation I receive the following errors by using this command:
stack build
unix > [25 of 53] Compiling System.Posix.PosixPath.FilePath
unix > /tmp/stack-758397ba55b7bb42/unix-2.8.8.0/System/Posix/PosixPath/FilePath.hsc:50:1: error: [GHC-61948]
unix > Could not find module ‘System.OsString.Data.ByteString.Short’.
unix > Perhaps you meant
unix > System.OsString.Data.ByteString.Short (needs flag -package-id os-string-2.0.11)
unix > System.OsString.Data.ByteString.Short (needs flag -package-id os-string-2.0.7)
unix > System.OsString.Data.ByteString.Short.Word16 (needs flag -package-id os-string-2.0.11)
unix > |
unix > 50 | import “os-string” System.OsString.Data.ByteString.Short as BSS
unix > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
unix >
unix > /tmp/stack-758397ba55b7bb42/unix-2.8.8.0/System/Posix/PosixPath/FilePath.hsc:55:1: error: [GHC-87110]
unix > Could not load module ‘System.OsString.Internal.Types’.
unix > It is a member of the hidden package ‘os-string-2.0.7’.
unix > Perhaps you need to add ‘os-string’ to the build-depends in your .cabal file.
unix > It is a member of the hidden package ‘os-string-2.0.11’.
unix > Perhaps you need to add ‘os-string’ to the build-depends in your .cabal file.
unix > Use -v to see a list of the files searched for.
unix > |
unix > 55 | import System.OsString.Internal.Types (PosixString(..), pattern PS)
I understand that the compiler is looking for another package called “os-string”. However, I installed ghc on a system wide level in which this package appears as a library that has been registered by the global compiler:
ghc-pkg list
Cabal-3.12.1.0
Cabal-syntax-3.12.1.0
array-0.5.8.0
base-4.20.2.0
binary-0.8.9.3
bytestring-0.12.2.0
containers-0.7
deepseq-1.5.0.0
directory-1.3.8.5
exceptions-0.10.9
filepath-1.5.4.0
ghc-9.10.3
ghc-bignum-1.3
ghc-boot-9.10.3
ghc-boot-th-9.10.3
ghc-compact-0.1.0.0
ghc-experimental-9.1003.0
ghc-heap-9.10.3
ghc-internal-9.1003.0
ghc-platform-0.1.0.0
ghc-prim-0.12.0
ghc-toolchain-0.1.0.0
ghci-9.10.3
haskeline-0.8.2.1
hpc-0.7.0.2
integer-gmp-1.1
mtl-2.3.1
os-string-2.0.7
parsec-3.1.18.0
pretty-1.1.3.6
process-1.6.26.1
rts-1.0.2
semaphore-compat-1.0.0
stm-2.5.3.1
system-cxx-std-lib-1.0
template-haskell-2.22.0.0
terminfo-0.4.1.7
text-2.1.3
time-1.12.2
transformers-0.6.1.1
unix-2.8.7.0
xhtml-3000.2.2.1
The global compiler is stored in this directory:
/usr/lib/ghc-9.10.3
Then I told stack to install ghc locally by downloading it from the following website:
However the local compiler isn’t still able to import os-string. Sorry, but I’m not able to figure it out by myself. Can you please help me.