You are not logged in.
Hello,
I've been installing a Haskell package, available on AUR (https://aur.archlinux.org/packages/haskell-vector-space).
The installation, after resolving the dependencies, was successful, and I can import the package in ghci:
ghci> import Data.VectorSpace
ghci> However, when I try compile a file containing the same import, it fails:
➜ ~/ cat x.hs
import Data.VectorSpace
➜ ~/ ghc -v x.hs
Glasgow Haskell Compiler, Version 9.0.2, stage 2 booted by GHC version 9.0.1
*** initializing unit database:
Using binary package database: /usr/lib/ghc-9.0.2/package.conf.d/package.cache
package flags []
loading package database /usr/lib/ghc-9.0.2/package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.7.0
wired-in package ghc-bignum mapped to ghc-bignum-1.1
wired-in package base mapped to base-4.15.1.0
wired-in package rts mapped to rts
wired-in package template-haskell mapped to template-haskell-2.17.0.0
wired-in package ghc mapped to ghc-9.0.2
!!! initializing unit database: finished in 24.99 milliseconds, allocated 10.527 megabytes
*** initializing unit database:
package flags []
loading package database /usr/lib/ghc-9.0.2/package.conf.d
wired-in package ghc-prim mapped to ghc-prim-0.7.0
wired-in package ghc-bignum mapped to ghc-bignum-1.1
wired-in package base mapped to base-4.15.1.0
wired-in package rts mapped to rts-1.0.2
wired-in package template-haskell mapped to template-haskell-2.17.0.0
wired-in package ghc mapped to ghc-9.0.2
!!! initializing unit database: finished in 18.50 milliseconds, allocated 3.689 megabytes
*** Chasing dependencies:
Chasing modules from: *x.hs
!!! Chasing dependencies: finished in 2.67 milliseconds, allocated 0.254 megabytes
Stable obj: {}
Stable BCO: {}
Ready for upsweep [2/198]
[NONREC
ModSummary {
ms_hs_date = 2022-08-16 16:42:12.446241941 UTC
ms_mod = Main,
ms_textual_imps = [(Nothing, Prelude), (Nothing, Data.VectorSpace)]
ms_srcimps = []
}]
*** Deleting temp files:
Deleting:
compile: input file x.hs
*** Checking old interface for Main (use -ddump-hi-diffs for more details):
[1 of 1] Compiling Main ( x.hs, x.o )
*** Parser [Main]:
!!! Parser [Main]: finished in 0.09 milliseconds, allocated 0.039 megabytes
*** Renamer/typechecker [Main]:
!!! Renamer/typechecker [Main]: finished in 9.55 milliseconds, allocated 5.511 megabytes
x.hs:1:1: error:
Could not find module ‘Data.VectorSpace’
There are files missing in the ‘vector-space-0.16’ package,
try running 'ghc-pkg check'.
Locations searched:
Data/VectorSpace.hs
Data/VectorSpace.lhs
Data/VectorSpace.hsig
Data/VectorSpace.lhsig
/usr/lib/ghc-9.0.2/site-local/vector-space-0.16/Data/VectorSpace.hi
|
1 | import Data.VectorSpace
| ^^^^^^^^^^^^^^^^^^^^^^^
Upsweep partially successful.
*** Deleting temp files:
Deleting:
link(batch): upsweep (partially) failed OR
Main.main not exported; not linking.
*** Deleting temp files:
Deleting:
*** Deleting temp dirs:
Deleting: I've run `ghc-pkg check` as suggested. Nothing changed, but here's the output if it's any use:
➜ ~/ ghc-pkg check
Warning: haddock-interfaces: /usr/share/doc/haskell-vector-space/html/vector-space.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-vector-space/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-numinstances/html/NumInstances.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-numinstances/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-boolean/html/Boolean.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-boolean/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-newtype-generics/html/newtype-generics.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-newtype-generics/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-memotrie/html/MemoTrie.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-memotrie/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-zlib/html/zlib.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-zlib/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-th-compat/html/th-compat.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-th-compat/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-tar/html/tar.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-tar/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-splitmix/html/splitmix.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-splitmix/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-resolv/html/resolv.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-resolv/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-random/html/random.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-random/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-network/html/network.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-network/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-network-uri/html/network-uri.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-network-uri/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-lukko/html/lukko.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-lukko/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-http/html/HTTP.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-http/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-hashable/html/hashable.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-hashable/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-hackage-security/html/hackage-security.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-hackage-security/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-edit-distance/html/edit-distance.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-edit-distance/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-cryptohash-sha256/html/cryptohash-sha256.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-cryptohash-sha256/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-base64-bytestring/html/base64-bytestring.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-base64-bytestring/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-base16-bytestring/html/base16-bytestring.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-base16-bytestring/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-base-orphans/html/base-orphans.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-base-orphans/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-async/html/async.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-async/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-regex-posix/html/regex-posix.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-regex-posix/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-regex-base/html/regex-base.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-regex-base/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-ghc-bignum-orphans/html/ghc-bignum-orphans.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-ghc-bignum-orphans/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-ed25519/html/ed25519.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-ed25519/html doesn't exist or isn't a directory
Warning: haddock-interfaces: /usr/share/doc/haskell-echo/html/echo.haddock doesn't exist or isn't a file
Warning: haddock-html: /usr/share/doc/haskell-echo/html doesn't exist or isn't a directoryI've also run `cabal update`. Still no joy.
And this is what pacman says about this package:
➜ ~/ pacman -Q -i -l haskell-vector-space
Name : haskell-vector-space
Version : 0.16-2
Description : Vector & affine spaces, linear maps, and derivatives
Architecture : x86_64
URL : https://github.com/conal/vector-space
Licenses : BSD
Groups : None
Provides : None
Depends On : haskell-boolean haskell-memotrie haskell-numinstances
Optional Deps : None
Required By : None
Optional For : None
Conflicts With : None
Replaces : None
Installed Size : 851.24 KiB
Packager : Unknown Packager
Build Date : Tue 16 Aug 2022 17:18:08 BST
Install Date : Tue 16 Aug 2022 17:18:22 BST
Install Reason : Explicitly installed
Install Script : No
Validated By : None
haskell-vector-space /usr/
haskell-vector-space /usr/lib/
haskell-vector-space /usr/lib/ghc-9.0.2/
haskell-vector-space /usr/lib/ghc-9.0.2/site-local/
haskell-vector-space /usr/lib/ghc-9.0.2/site-local/vector-space-0.16/
haskell-vector-space /usr/lib/ghc-9.0.2/site-local/vector-space-0.16/Data/
haskell-vector-space /usr/lib/ghc-9.0.2/site-local/vector-space-0.16/Data/AdditiveGroup.dyn_hi
haskell-vector-space /usr/lib/ghc-9.0.2/site-local/vector-space-0.16/Data/AffineSpace.dyn_hi
haskell-vector-space /usr/lib/ghc-9.0.2/site-local/vector-space-0.16/Data/Basis.dyn_hi
haskell-vector-space /usr/lib/ghc-9.0.2/site-local/vector-space-0.16/Data/Cross.dyn_hi
haskell-vector-space /usr/lib/ghc-9.0.2/site-local/vector-space-0.16/Data/Derivative.dyn_hi
haskell-vector-space /usr/lib/ghc-9.0.2/site-local/vector-space-0.16/Data/LinearMap.dyn_hi
haskell-vector-space /usr/lib/ghc-9.0.2/site-local/vector-space-0.16/Data/Maclaurin.dyn_hi
haskell-vector-space /usr/lib/ghc-9.0.2/site-local/vector-space-0.16/Data/VectorSpace.dyn_hi
haskell-vector-space /usr/lib/ghc-9.0.2/site-local/vector-space-0.16/Data/VectorSpace/
haskell-vector-space /usr/lib/ghc-9.0.2/site-local/vector-space-0.16/Data/VectorSpace/Generic.dyn_hi
haskell-vector-space /usr/lib/libHSvector-space-0.16-B47nan5nhneJwrrOw8qzr-ghc9.0.2.so
haskell-vector-space /usr/share/
haskell-vector-space /usr/share/doc/
haskell-vector-space /usr/share/doc/haskell-vector-space/
haskell-vector-space /usr/share/doc/haskell-vector-space/COPYING
haskell-vector-space /usr/share/haskell/
haskell-vector-space /usr/share/haskell/register/
haskell-vector-space /usr/share/haskell/register/haskell-vector-space.sh
haskell-vector-space /usr/share/haskell/unregister/
haskell-vector-space /usr/share/haskell/unregister/haskell-vector-space.sh
haskell-vector-space /usr/share/licenses/
haskell-vector-space /usr/share/licenses/haskell-vector-space/
haskell-vector-space /usr/share/licenses/haskell-vector-space/LICENSE The obvious thing that I can see from above is that `ghc` looks for `/usr/lib/ghc-9.0.2/site-local/vector-space-0.16/Data/VectorSpace.hi` whereas there's `/usr/lib/ghc-9.0.2/site-local/vector-space-0.16/Data/VectorSpace.dyn_hi` instead.
Any kind soul knows what's the move forward?
Last edited by Krankenhaus (2022-08-18 13:09:15)
Offline
Have you tried using the -dynamic flag i.e. ghc -v -dynamic x.hs?
According to the Haskell Wiki, ghc and packages in the community provide only dynamic linking.
Offline
OK, turns out this is indeed a "Arch Linux peculiarity" as noted on this answer on StackOverflow.
The quickest fix is to use `ghc -dynamic`:
➜ ~/ ghc -dynamic x.hs
[1 of 1] Compiling Main ( x.hs, x.o )
Linking x ...
➜ ~/Similarly, if we want to import the module in ghci, we need to run gchi with that flag
➜ ~/ ghci -dynamic
GHCi, version 9.0.2: https://www.haskell.org/ghc/ :? for help
ghci> :load x.hs
Ok, one module loaded.Other solutions are specified on https://wiki.archlinux.org/title/Haskell#Static_linking, which I had totally missed in the first place, as I thought this was a peculiarity of this specific package.
Offline
Hi d_fajardo - I didn't see your answer, but that's exactly what I needed.
Thought it was something special about "vector-space" but turns out it's just standard behaviour.
Thanks for the hint!
Offline
Just mark your thread 'Solved' as is the custom in this forum whenever one has found the answer.
Offline