Can't compile unix-2.8.8.0 on AARCH64

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:

  1. LTS 24.60
  2. 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:

Haskell Downloads

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.

I was under the impression that stack will use per project dependencies instead of system ones unless explicitly told.

I also used the ghc compiler locally installed by stack, but it still can’t find the package os-string, even though it was installed by stack, too. Any ideas?

Are you able to give more of your project setup? It seems that you maybe installed packages system wide from what you’re saying. It’s possible you are depending on versions of packages that are incompatible with the stackage resolver you are set to.

  • You can view my stack.yaml configuration here: stack.yaml
  • The package.yaml file can be accessed here: package.yaml

The stack installation has the following version:

stack --version

Version 3.11.1, Git revision 979bf6339fd4d5837c4d2fa8166dc715eef30ee2 aarch64 hpack-0.39.6

These are are the warnings which I receive before starting to compile the project:

stack build

Warning: Ignoring unix’s bounds on filepath (>=1.4.100.0 && <1.5.0.0) and using filepath-1.5.5.0.
Reason: unix is an allow-newer-dep and allow-newer enabled.

Warning: Ignoring process’s bounds on filepath (>=1.4.100.0 && <1.5.0.0) and using filepath-1.5.5.0.
Reason: process is an allow-newer-dep and allow-newer enabled.

Warning: Ignoring semigroupoids’s bounds on transformers (>=0.6.1.0) and using transformers-0.5.6.2.
Reason: semigroupoids is an allow-newer-dep and allow-newer enabled.

Warning: Ignoring Cabal’s bounds on Cabal-syntax (^>=3.16.1.0) and using Cabal-syntax-3.18.1.0.
Reason: Cabal is an allow-newer-dep and allow-newer enabled.

Warning: Ignoring connection’s bounds on tls (>=1.4 && <1.7) and using tls-2.1.8.
Reason: connection is an allow-newer-dep and allow-newer enabled.

Warning: Ignoring espial’s bounds on persistent-mysql (>=2.14 && <2.19) and using persistent-mysql-2.13.1.5.
Reason: espial is an allow-newer-dep and allow-newer enabled.

Warning: Ignoring espial’s bounds on persistent-mysql (>=2.14 && <2.19) and using persistent-mysql-2.13.1.5.
Reason: espial is an allow-newer-dep and allow-newer enabled.

Warning: Ignoring espial’s bounds on persistent-mysql (>=2.14 && <2.19) and using persistent-mysql-2.13.1.5.
Reason: espial is an allow-newer-dep and allow-newer enabled.

I changed this project “espial” by myself. Now, it’s able to access a mysql database. Users can change the configuration of the database or execute commands in a terminal. So the handling of the configuration is done using ConfigFile which relies on an older mtl version.

@lmcyber could you remove all allow-newer flags from stack.yaml? Using them likely broke package flags and you got an inconsistent configuration.