I tried running ghc to compile a haskell program, and I get the following error:
$ ghc --make main
Linking main ...
ld: building for macOS, but linking in object file built for iOS Simulator, file 'main.o' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`clang' failed in phase `Linker'. (Exit code: 1)
Here are some details about my machine:
macOS Catalina 10.15.7
Xcode 12.2
The Xcode developer tools were installed with xcode-select --install
I installed ghc with brew install ghc
Some other output that might be relevant:
$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
If I run ghc --make main -v, this is what the output looks like right before it fails (apologies for the long line, not sure how to format this better):
clang -o main -fno-common -U__PIC__ -D__PIC__ -Wl,-no_compact_unwind main.o -L/usr/local/Cellar/ghc/8.10.1_2/lib/ghc-8.10.1/base-4.14.0.0 -L/usr/local/Cellar/ghc/8.10.1_2/lib/ghc-8.10.1/integer-gmp-1.0.3.0 -L/usr/local/Cellar/ghc/8.10.1_2/libexec/integer-gmp/lib -L/usr/local/Cellar/ghc/8.10.1_2/lib/ghc-8.10.1/ghc-prim-0.6.1 -L/usr/local/Cellar/ghc/8.10.1_2/lib/ghc-8.10.1/rts /var/folders/5j/wwtlv8lx0m5fmhc3hy5w5_000000gp/T/ghc49162_0/ghc_2.o -Wl,-u,_base_GHCziTopHandler_runIO_closure -Wl,-u,_base_GHCziTopHandler_runNonIO_closure -Wl,-u,_ghczmprim_GHCziTuple_Z0T_closure -Wl,-u,_ghczmprim_GHCziTypes_True_closure -Wl,-u,_ghczmprim_GHCziTypes_False_closure -Wl,-u,_base_GHCziPack_unpackCString_closure -Wl,-u,_base_GHCziWeak_runFinalizzerBatch_closure -Wl,-u,_base_GHCziIOziException_stackOverflow_closure -Wl,-u,_base_GHCziIOziException_heapOverflow_closure -Wl,-u,_base_GHCziIOziException_allocationLimitExceeded_closure -Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnMVar_closure -Wl,-u,_base_GHCziIOziException_blockedIndefinitelyOnSTM_closure -Wl,-u,_base_GHCziIOziException_cannotCompactFunction_closure -Wl,-u,_base_GHCziIOziException_cannotCompactPinned_closure -Wl,-u,_base_GHCziIOziException_cannotCompactMutable_closure -Wl,-u,_base_ControlziExceptionziBase_absentSumFieldError_closure -Wl,-u,_base_ControlziExceptionziBase_nonTermination_closure -Wl,-u,_base_ControlziExceptionziBase_nestedAtomically_closure -Wl,-u,_base_GHCziEventziThread_blockedOnBadFD_closure -Wl,-u,_base_GHCziConcziSync_runSparks_closure -Wl,-u,_base_GHCziConcziIO_ensureIOManagerIsRunning_closure -Wl,-u,_base_GHCziConcziIO_ioManagerCapabilitiesChanged_closure -Wl,-u,_base_GHCziConcziSignal_runHandlersPtr_closure -Wl,-u,_base_GHCziTopHandler_flushStdHandles_closure -Wl,-u,_base_GHCziTopHandler_runMainIO_closure -Wl,-u,_ghczmprim_GHCziTypes_Czh_con_info -Wl,-u,_ghczmprim_GHCziTypes_Izh_con_info -Wl,-u,_ghczmprim_GHCziTypes_Fzh_con_info -Wl,-u,_ghczmprim_GHCziTypes_Dzh_con_info -Wl,-u,_ghczmprim_GHCziTypes_Wzh_con_info -Wl,-u,_base_GHCziPtr_Ptr_con_info -Wl,-u,_base_GHCziPtr_FunPtr_con_info -Wl,-u,_base_GHCziInt_I8zh_con_info -Wl,-u,_base_GHCziInt_I16zh_con_info -Wl,-u,_base_GHCziInt_I32zh_con_info -Wl,-u,_base_GHCziInt_I64zh_con_info -Wl,-u,_base_GHCziWord_W8zh_con_info -Wl,-u,_base_GHCziWord_W16zh_con_info -Wl,-u,_base_GHCziWord_W32zh_con_info -Wl,-u,_base_GHCziWord_W64zh_con_info -Wl,-u,_base_GHCziStable_StablePtr_con_info -Wl,-u,_hs_atomic_add8 -Wl,-u,_hs_atomic_add16 -Wl,-u,_hs_atomic_add32 -Wl,-u,_hs_atomic_add64 -Wl,-u,_hs_atomic_sub8 -Wl,-u,_hs_atomic_sub16 -Wl,-u,_hs_atomic_sub32 -Wl,-u,_hs_atomic_sub64 -Wl,-u,_hs_atomic_and8 -Wl,-u,_hs_atomic_and16 -Wl,-u,_hs_atomic_and32 -Wl,-u,_hs_atomic_and64 -Wl,-u,_hs_atomic_nand8 -Wl,-u,_hs_atomic_nand16 -Wl,-u,_hs_atomic_nand32 -Wl,-u,_hs_atomic_nand64 -Wl,-u,_hs_atomic_or8 -Wl,-u,_hs_atomic_or16 -Wl,-u,_hs_atomic_or32 -Wl,-u,_hs_atomic_or64 -Wl,-u,_hs_atomic_xor8 -Wl,-u,_hs_atomic_xor16 -Wl,-u,_hs_atomic_xor32 -Wl,-u,_hs_atomic_xor64 -Wl,-u,_hs_cmpxchg8 -Wl,-u,_hs_cmpxchg16 -Wl,-u,_hs_cmpxchg32 -Wl,-u,_hs_cmpxchg64 -Wl,-u,_hs_atomicread8 -Wl,-u,_hs_atomicread16 -Wl,-u,_hs_atomicread32 -Wl,-u,_hs_atomicread64 -Wl,-u,_hs_atomicwrite8 -Wl,-u,_hs_atomicwrite16 -Wl,-u,_hs_atomicwrite32 -Wl,-u,_hs_atomicwrite64 -Wl,-search_paths_first -Wl,-dead_strip -lHSbase-4.14.0.0 -lHSinteger-gmp-1.0.3.0 -lHSghc-prim-0.6.1 -lHSrts -lCffi -liconv -lgmp -lm -ldl -Wl,-dead_strip_dylibs
ld: building for macOS, but linking in object file built for iOS Simulator, file 'main.o' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I am very new to the Haskell platform and I'm having much more trouble than I had wished for with it.
I think I'm getting closer since everything goes well until cabal tries to install shakespeare-css and derive.
I'm working on a Ubuntu 11.10 with ghc-7.4.2 and cabal-install 1.16.0.2
When I input command
~/.cabal/bin$ ./cabal -v install derive
I get the following output
Reading available packages...
Choosing modular solver.
Resolving dependencies...
Ready to install derive-2.5.11
Waiting for install task to finish...
Extracting
/home/tamarin/.cabal/packages/hackage.haskell.org/derive/2.5.11/derive-2.5.11.tar.gz
to /tmp/derive-2.5.11-29920...
Updating derive.cabal with the latest revision from the index.
Configuring derive-2.5.11...
Dependency base ==4.5.1.0: using base-4.5.1.0
Dependency bytestring ==0.9.2.1: using bytestring-0.9.2.1
Dependency containers ==0.4.2.1: using containers-0.4.2.1
Dependency directory ==1.1.0.2: using directory-1.1.0.2
Dependency filepath ==1.3.0.0: using filepath-1.3.0.0
Dependency haskell-src-exts ==1.13.5: using haskell-src-exts-1.13.5
Dependency pretty ==1.1.1.0: using pretty-1.1.1.0
Dependency process ==1.1.0.1: using process-1.1.0.1
Dependency syb ==0.3.7: using syb-0.3.7
Dependency template-haskell ==2.8.0.0: using template-haskell-2.8.0.0
Dependency transformers ==0.2.2.0: using transformers-0.2.2.0
Dependency uniplate ==1.6.10: using uniplate-1.6.10
Using Cabal-1.16.0.3 compiled by ghc-7.0
Using compiler: ghc-7.4.2
Using install prefix: /home/tamarin/.cabal
Binaries installed in: /home/tamarin/.cabal/bin
Libraries installed in: /home/tamarin/.cabal/lib/derive-2.5.11/ghc-7.4.2
Private binaries installed in: /home/tamarin/.cabal/libexec
Data files installed in: /home/tamarin/.cabal/share/derive-2.5.11
Documentation installed in: /home/tamarin/.cabal/share/doc/derive-2.5.11
Using alex version 2.3.5 found on system at: /usr/bin/alex
Using ar found on system at: /usr/bin/ar
No c2hs found
Using cpphs version 1.16 found on system at: /home/tamarin/.cabal/bin/cpphs
No ffihugs found
Using gcc version 4.6.1 found on system at: /usr/bin/gcc
Using ghc version 7.4.2 found on system at: /usr/local/bin/ghc
Using ghc-pkg version 7.4.2 found on system at: /usr/local/bin/ghc-pkg
No greencard found
Using haddock version 2.11.0 found on system at: /usr/local/bin/haddock
Using happy version 1.18.6 found on system at: /usr/bin/happy
No hmake found
Using hpc version 0.6 found on system at: /usr/local/bin/hpc
Using hsc2hs version 0.67 found on system at: /usr/local/bin/hsc2hs
No hscolour found
No hugs found
No jhc found
Using ld found on system at: /usr/bin/ld
No lhc found
No lhc-pkg found
No nhc98 found
Using pkg-config version 0.26 found on system at: /usr/bin/pkg-config
Using ranlib found on system at: /usr/bin/ranlib
Using strip found on system at: /usr/bin/strip
Using tar found on system at: /bin/tar
No uhc found
creating dist/build
creating dist/build/autogen
Building derive-2.5.11...
Preprocessing library derive-2.5.11...
Building library...
creating dist/build
/usr/local/bin/ghc --make -fbuilding-cabal-package -O -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -i. -idist/build/autogen -Idist/build/autogen -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h -package-name derive-2.5.11 -hide-all-packages -package-conf dist/package.conf.inplace -package-id base-4.5.1.0-8a237511fef48b8f180babb0282b28e3 -package-id bytestring-0.9.2.1-ac1c20630117630ba32abcac9cdbbce8 -package-id containers-0.4.2.1-59c8844d535e4a3bdd1569d60336e3b7 -package-id directory-1.1.0.2-ef4eca075618605e644c6184b111f96f -package-id filepath-1.3.0.0-954c43b4f109cbd4121f1231c14d5cff -package-id haskell-src-exts-1.13.5-3e91c3c2a4a723d046d79dc6b2b3a8bd -package-id pretty-1.1.1.0-867dcdeb02592f3d2a707618561c7b86 -package-id process-1.1.0.1-bd6d91995b2ae2680669549cb63f15b4 -package-id syb-0.3.7-a269c050536d4890f37a20513844e800 -package-id template-haskell-2.8.0.0-785b225a803e6279a067560929c36633 -package-id transformers-0.2.2.0-7f9cf1f6994d36648f58249fe35d1cf2 -package-id uniplate-1.6.10-e06ac94679c647f08eee64b44109aecc -XHaskell98 Data.DeriveMain Data.DeriveTH Data.DeriveDSL Data.Derive.All Data.Derive.DSL.Apply Data.Derive.DSL.Derive Data.Derive.DSL.DSL Data.Derive.DSL.HSE Data.Derive.DSL.SYB Data.Derive.Instance.Arities Data.Derive.Class.Arities Data.Derive.Class.Default Language.Haskell Language.Haskell.Convert Language.Haskell.TH.All Language.Haskell.TH.Compat Language.Haskell.TH.Data Language.Haskell.TH.ExpandSynonym Language.Haskell.TH.FixedPpr Language.Haskell.TH.Helper Language.Haskell.TH.Peephole Data.Derive.Arbitrary Data.Derive.ArbitraryOld Data.Derive.Arities Data.Derive.Binary Data.Derive.BinaryDefer Data.Derive.Bounded Data.Derive.Data Data.Derive.DataAbstract Data.Derive.Default Data.Derive.Enum Data.Derive.EnumCyclic Data.Derive.Eq Data.Derive.Fold Data.Derive.Foldable Data.Derive.From Data.Derive.Functor Data.Derive.Has Data.Derive.Is Data.Derive.JSON Data.Derive.LazySet Data.Derive.Lens Data.Derive.Monoid Data.Derive.NFData Data.Derive.Ord Data.Derive.Read Data.Derive.Ref Data.Derive.Serial Data.Derive.Serialize Data.Derive.Set Data.Derive.Show Data.Derive.Traversable Data.Derive.Typeable Data.Derive.UniplateDirect Data.Derive.UniplateTypeable Data.Derive.Update Data.Derive.Internal.Derivation Data.Derive.Internal.Instance Data.Derive.Internal.Traversal Derive.Main Derive.Derivation Derive.Flags Derive.Generate Derive.Test Derive.Utils
[ 1 of 65] Compiling Language.Haskell.TH.Compat ( Language/Haskell/TH/Compat.hs, dist/build/Language/Haskell/TH/Compat.o )
[ 2 of 65] Compiling Language.Haskell.TH.Data ( Language/Haskell/TH/Data.hs, dist/build/Language/Haskell/TH/Data.o )
[ 3 of 65] Compiling Language.Haskell.TH.ExpandSynonym ( Language/Haskell/TH/ExpandSynonym.hs, dist/build/Language/Haskell/TH/ExpandSynonym.o )
[ 4 of 65] Compiling Language.Haskell.TH.FixedPpr ( Language/Haskell/TH/FixedPpr.hs, dist/build/Language/Haskell/TH/FixedPpr.o )
Language/Haskell/TH/FixedPpr.hs:404:9:
Not in scope: data constructor `StarK'
Perhaps you meant `StarT' (imported from Language.Haskell.TH.Syntax)
Language/Haskell/TH/FixedPpr.hs:405:10:
Not in scope: data constructor `ArrowK'
Perhaps you meant `ArrowT' (imported from Language.Haskell.TH.Syntax)
Failed to install derive-2.5.11
World file is already up to date.
cabal: Error: some packages failed to install:
derive-2.5.11 failed during the building phase. The exception was:
ExitFailure 1
Which seems to me like a weird compilation error
As for installing shakespeare-css
./cabal -v install shakespeare-css
I get
Reading available packages...
Choosing modular solver.
Resolving dependencies...
Ready to install shakespeare-css-1.0.2
Waiting for install task to finish...
Extracting
/home/tamarin/.cabal/packages/hackage.haskell.org/shakespeare-css/1.0.2/shakespeare-css-1.0.2.tar.gz
to /tmp/shakespeare-css-1.0.2-2963...
Updating shakespeare-css.cabal with the latest revision from the index.
Configuring shakespeare-css-1.0.2...
Dependency base ==4.5.1.0: using base-4.5.1.0
Dependency parsec ==3.1.3: using parsec-3.1.3
Dependency process ==1.1.0.1: using process-1.1.0.1
Dependency shakespeare ==1.0.3: using shakespeare-1.0.3
Dependency template-haskell ==2.8.0.0: using template-haskell-2.8.0.0
Dependency text ==0.11.2.3: using text-0.11.2.3
Dependency transformers ==0.2.2.0: using transformers-0.2.2.0
Using Cabal-1.16.0.3 compiled by ghc-7.0
Using compiler: ghc-7.4.2
Using install prefix: /home/tamarin/.cabal
Binaries installed in: /home/tamarin/.cabal/bin
Libraries installed in:
/home/tamarin/.cabal/lib/shakespeare-css-1.0.2/ghc-7.4.2
Private binaries installed in: /home/tamarin/.cabal/libexec
Data files installed in: /home/tamarin/.cabal/share/shakespeare-css-1.0.2
Documentation installed in:
/home/tamarin/.cabal/share/doc/shakespeare-css-1.0.2
Using alex version 2.3.5 found on system at: /usr/bin/alex
Using ar found on system at: /usr/bin/ar
No c2hs found
Using cpphs version 1.16 found on system at: /home/tamarin/.cabal/bin/cpphs
No ffihugs found
Using gcc version 4.6.1 found on system at: /usr/bin/gcc
Using ghc version 7.4.2 found on system at: /usr/local/bin/ghc
Using ghc-pkg version 7.4.2 found on system at: /usr/local/bin/ghc-pkg
No greencard found
Using haddock version 2.11.0 found on system at: /usr/local/bin/haddock
Using happy version 1.18.6 found on system at: /usr/bin/happy
No hmake found
Using hpc version 0.6 found on system at: /usr/local/bin/hpc
Using hsc2hs version 0.67 found on system at: /usr/local/bin/hsc2hs
No hscolour found
No hugs found
No jhc found
Using ld found on system at: /usr/bin/ld
No lhc found
No lhc-pkg found
No nhc98 found
Using pkg-config version 0.26 found on system at: /usr/bin/pkg-config
Using ranlib found on system at: /usr/bin/ranlib
Using strip found on system at: /usr/bin/strip
Using tar found on system at: /bin/tar
No uhc found
creating dist/build
creating dist/build/autogen
Building shakespeare-css-1.0.2...
Preprocessing library shakespeare-css-1.0.2...
Building library...
creating dist/build
/usr/local/bin/ghc --make -fbuilding-cabal-package -O -odir dist/build -hidir dist/build -stubdir dist/build -i -idist/build -i. -idist/build/autogen -Idist/build/autogen -Idist/build -optP-DGHC_7_4 -optP-include -optPdist/build/autogen/cabal_macros.h -package-name shakespeare-css-1.0.2 -hide-all-packages -package-conf dist/package.conf.inplace -package-id base-4.5.1.0-8a237511fef48b8f180babb0282b28e3 -package-id parsec-3.1.3-f18640e50f9a9d34865e30e42bb377e6 -package-id process-1.1.0.1-bd6d91995b2ae2680669549cb63f15b4 -package-id shakespeare-1.0.3-a36c3be30cdeba4668fd1e4115e40bde -package-id template-haskell-2.8.0.0-785b225a803e6279a067560929c36633 -package-id text-0.11.2.3-7427aa3daf930bd36d392386f0ef5048 -package-id transformers-0.2.2.0-7f9cf1f6994d36648f58249fe35d1cf2 -XHaskell98 Text.Cassius Text.Lucius Text.MkSizeType Text.Css Text.IndentToBrace Text.CssCommon -Wall
[1 of 6] Compiling Text.MkSizeType ( Text/MkSizeType.hs, dist/build/Text/MkSizeType.o )
[2 of 6] Compiling Text.IndentToBrace ( Text/IndentToBrace.hs, dist/build/Text/IndentToBrace.o )
[3 of 6] Compiling Text.Css ( Text/Css.hs, dist/build/Text/Css.o )
[4 of 6] Compiling Text.CssCommon ( Text/CssCommon.hs, dist/build/Text/CssCommon.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package bytestring-0.9.2.1 ... linking ... done.
Loading package transformers-0.2.2.0 ... linking ... done.
Loading package mtl-2.0.1.0 ... linking ... done.
Loading package array-0.4.0.0 ... linking ... done.
Loading package deepseq-1.3.0.0 ... linking ... done.
Loading package text-0.11.2.3 ... linking ... done.
Loading package parsec-3.1.3 ... linking ... done.
Loading package filepath-1.3.0.0 ... linking ... done.
Loading package old-locale-1.0.0.4 ... linking ... done.
Loading package old-time-1.1.0.0 ... linking ... done.
Loading package unix-2.5.1.1 ... linking ... done.
Loading package directory-1.1.0.2 ... linking ... done.
Loading package process-1.1.0.1 ... linking ... done.
Loading package containers-0.4.2.1 ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package shakespeare-1.0.3 ... linking ... done.
Text/CssCommon.hs:159:1:Failed to install shakespeare-css-1.0.2
World file is already up to date.
cabal: Error: some packages failed to install:
shakespeare-css-1.0.2 failed during the building phase. The exception was:
ExitFailure 11
What is the problem here?
I have a package installed via cabal: Data.Vector
But when I attempt to compile a program that has import Data.Vector in it:
Drews-MacBook-Pro:Blokus-AI drewgross$ ghc --make -O2 -prof -auto-all playGame
Grid.hs:28:8:
Could not find module `Data.Vector'
Perhaps you meant
Data.Tensor (from Tensor-1.0.0.1)
Data.Functor (from base)
Use -v to see a list of the files searched for.
Drews-MacBook-Pro:Blokus-AI drewgross$
The command I used to install was:
cabal install -p --reinstall --force-reinstalls vector
I've done other various thing in my attempt to get my program to compile, but nothing has worked. I'd really like to just delete everything, go back to square one and download the package again. How can I do that?
Edit: further investigation shows that there might be 2 versions of Data.Vector: 0.10.0.1 and 0.9.1, maybe they are conflicting somehow?
Edit: ghc-pkg check lists no errors, but gives me a ton of warnings that look like this:
Warning: haddock-interfaces: /Users/drewgross/.cabal/share/doc/haskell-lexer-1.0/html/haskell-lexer.haddock doesn't exist or isn't a file
Edit: GCHi also doesn't find it
λ> import Data.Vector
<no location info>:
Could not find module `Data.Vector'
Perhaps you meant Data.Functor (from base)
λ>
Edit: ghc-pkg list vector:
Drews-MacBook-Pro:Blokus-AI drewgross$ ghc-pkg list vector
/Library/Frameworks/GHC.framework/Versions/7.4.2-x86_64/usr/lib/ghc-7.4.2/package.conf.d
/Users/drewgross/.ghc/x86_64-darwin-7.4.2/package.conf.d
vector-0.10.0.1
Drews-MacBook-Pro:Blokus-AI drewgross$
and building with -v flag:
Drews-MacBook-Pro:Blokus-AI drewgross$ ghc --make -O2 -prof -auto-all -v playGame
Glasgow Haskell Compiler, Version 7.4.2, stage 2 booted by GHC version 7.4.2
Using binary package database: /usr/local/Cellar/ghc/7.4.2/lib/ghc-7.4.2/package.conf.d/package.cache
Using binary package database: /Users/drewgross/.ghc/x86_64-darwin-7.4.2/package.conf.d/package.cache
package Cabal-1.16.0.3-e689d8e77b2f476229954cd43b1737bd is unusable due to missing or recursive dependencies:
base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd directory-1.1.0.2-72e928d14fc50f31f7e6404839a15691 unix-2.5.1.1-29636eb78541401e8e00393ef5df097e
package Tensor-1.0.0.1-a8f1a59665c3ebc4867678a14fe1460f is unusable due to missing or recursive dependencies:
base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd
package binary-0.5.1.1-e62c39c3aba8093e9b9655a4a8d2bce9 is unusable due to missing or recursive dependencies:
base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd bytestring-0.10.0.1-9b03e69060669eabf0b20e150305c7be
package bmp-1.2.3.2-c7572ec2bbb802bfd93fed0953c61d5d is unusable due to missing or recursive dependencies:
base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd binary-0.5.1.1-e62c39c3aba8093e9b9655a4a8d2bce9 bytestring-0.10.0.1-9b03e69060669eabf0b20e150305c7be
package bytestring-0.10.0.1-9b03e69060669eabf0b20e150305c7be is unusable due to missing or recursive dependencies:
base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd
package ghc-paths-0.1.0.9-4e6c624a3431a4fa7630e4fb77be4c83 is unusable due to missing or recursive dependencies:
base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd
package haskell-lexer-1.0-8fea1c35b626a2de761522690a88c063 is unusable due to missing or recursive dependencies:
base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd
package primitive-0.4.1-0007d441db5f4ce1ffd66bd3816c2d4e is unusable due to missing or recursive dependencies:
base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd
package split-0.2.1.1-03ec5738edb34f2e8967d25637b9392f is unusable due to missing or recursive dependencies:
base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd
package vector-0.10.0.1-3450daae3d9f2092020075d05481123c is unusable due to missing or recursive dependencies:
base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd primitive-0.5.0.1-15cdc8c11a54a78809b647af0c2975b3
wired-in package ghc-prim mapped to ghc-prim-0.2.0.0-7d3c2c69a5e8257a04b2c679c40e2fa7
wired-in package integer-gmp mapped to integer-gmp-0.4.0.0-af3a28fdc4138858e0c7c5ecc2a64f43
wired-in package base mapped to base-4.5.1.0-47f48c3ae7f8256a66a23e9dfe22eefc
wired-in package rts mapped to builtin_rts
wired-in package template-haskell mapped to template-haskell-2.7.0.0-e109822dcbed82c43f9fa60194eb64b5
wired-in package dph-seq not found.
wired-in package dph-par not found.
Hsc static flags: -fscc-profiling -static
*** Chasing dependencies:
Chasing modules from: *playGame.hs
Grid.hs:28:8:
Could not find module `Data.Vector'
Perhaps you meant Data.Functor (from base)
Locations searched:
Data/Vector.hs
Data/Vector.lhs
*** Deleting temp files:
Deleting:
*** Deleting temp dirs:
Deleting:
Drews-MacBook-Pro:Blokus-AI drewgross$
This is what shell uses:
Drews-MacBook-Pro:Blokus-AI drewgross$ which ghc
/usr/bin/ghc
I did cabal install -v lens and obviously there was a ton of output but I think this is the relevant part:
Registering lens-3.7.0.2...
/usr/bin/ghc-pkg update - --global --user
Updating world file...
Drews-MacBook-Pro:Blokus-AI drewgross$
Which seems to indicate that they are using the same version. I can post more of the output of a cabal install if its relevant.
Edit: more ghc output from cabal install -v
Building lens-3.7.0.2...
Preprocessing library lens-3.7.0.2...
Building library...
creating dist/build
/usr/bin/ghc --make -package-name lens-3.7.0.2 -hide-all-packages -fbuilding-cabal-package -i -idist/build -isrc -idist/build/autogen -Idist/build/autogen -Idist/build -optP-DTRUSTWORTHY=1 -optP-DDEFAULT_SIGNATURES=1 -optP-include -optPdist/build/autogen/cabal_macros.h -odir dist/build -hidir dist/build -stubdir dist/build -package-id array-0.4.0.0-0b6c5ca7e879a14d110ca4c001dd9297 -package-id base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd -package-id bytestring-0.9.2.1-0044644a71adfe5e950e6c6f6ca13065 -package-id comonad-3.0.0.2-6ef27fce8536ebdf9c364307a0915f63 -package-id comonad-transformers-3.0-a6df581636b1c9b514cfa6560f17d6a3 -package-id comonads-fd-3.0-b906ed7898871c5d2427052e2eefa62e -package-id containers-0.4.2.1-75f143aa39a3e77a1ce2300025bdd8ce -package-id filepath-1.3.0.0-f998e5510c76a98913f57b14b4f16c57 -package-id ghc-prim-0.2.0.0-7d3c2c69a5e8257a04b2c679c40e2fa7 -package-id hashable-1.1.2.5-14291f3b4e96b5599759ce7daa2bd37c -package-id mtl-2.1.2-02e701f9b1590ee88a0b5b0bd5d93a29 -package-id parallel-3.2.0.3-4cdd6067624f867b253b98d6d9fb9f52 -package-id semigroups-0.8.4.1-4d3a86b037504e6000a0354510588745 -package-id split-0.2.1.1-03ec5738edb34f2e8967d25637b9392f -package-id template-haskell-2.7.0.0-29110cc89a711d6ab3e7ee0e0a8ee949 -package-id text-0.11.2.3-473d9a1761b27c7315f2ef4569d93c3c -package-id transformers-0.3.0.0-8e66ecc7d4dae2b07b2b5406908c70e4 -package-id unordered-containers-0.2.2.1-d70d5ccb1df11dbbbaac89571b1ee46d -package-id vector-0.10.0.1-3450daae3d9f2092020075d05481123c -O -Wall -fwarn-tabs -O2 -fdicts-cheap -funbox-strict-fields -XHaskell98 Control.Lens.TH Language.Haskell.TH.Lens Control.Exception.Lens Control.Lens Control.Lens.Action Control.Lens.Classes Control.Lens.Combinators Control.Lens.Fold Control.Lens.Getter Control.Lens.Indexed Control.Lens.IndexedGetter Control.Lens.IndexedFold Control.Lens.IndexedLens Control.Lens.IndexedSetter Control.Lens.IndexedTraversal Control.Lens.Internal Control.Lens.Internal.Zipper Control.Lens.Iso Control.Lens.Loupe Control.Lens.Plated Control.Lens.Prism Control.Lens.Representable Control.Lens.Setter Control.Lens.Simple Control.Lens.Traversal Control.Lens.Tuple Control.Lens.Type Control.Lens.WithIndex Control.Lens.Wrapped Control.Lens.Zipper Control.Lens.Zoom Data.Bits.Lens Data.ByteString.Lens Data.ByteString.Strict.Lens Data.ByteString.Lazy.Lens Data.Complex.Lens Data.Data.Lens Data.Dynamic.Lens Data.HashSet.Lens Data.IntSet.Lens Data.List.Lens Data.List.Split.Lens Data.Sequence.Lens Data.Set.Lens Data.Text.Lens Data.Text.Strict.Lens Data.Text.Lazy.Lens Data.Tree.Lens Data.Typeable.Lens Data.Vector.Lens Data.Vector.Generic.Lens GHC.Generics.Lens Data.Array.Lens System.FilePath.Lens Control.Parallel.Strategies.Lens Control.Seq.Lens Control.Lens.Internal.Combinators
[ 1 of 57] Compiling Control.Lens.Classes ( src/Control/Lens/Classes.hs, dist/build/Control/Lens/Classes.o )
[ 2 of 57] Compiling Control.Lens.Internal ( src/Control/Lens/Internal.hs, dist/build/Control/Lens/Internal.o )
[ 3 of 57] Compiling Control.Lens.Internal.Combinators ( src/Control/Lens/Internal/Combinators.hs, dist/build/Control/Lens/Internal/Combinators.o )
[ 4 of 57] Compiling Control.Lens.Indexed ( src/Control/Lens/Indexed.hs, dist/build/Control/Lens/Indexed.o )
[ 5 of 57] Compiling Control.Lens.IndexedGetter ( src/Control/Lens/IndexedGetter.hs, dist/build/Control/Lens/IndexedGetter.o )
[ 6 of 57] Compiling Control.Lens.Action ( src/Control/Lens/Action.hs, dist/build/Control/Lens/Action.o )
[ 7 of 57] Compiling Control.Lens.Setter ( src/Control/Lens/Setter.hs, dist/build/Control/Lens/Setter.o )
Edit: ghc-pkg dump
Drews-MacBook-Pro:Blokus-AI drewgross$ ghc-pkg dump | grep "id: base"
id: base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd
Your package database is badly broken. The ghc -v output lists ten unusable packages due to missing or recursive dependencies, among them vector:
package vector-0.10.0.1-3450daae3d9f2092020075d05481123c is unusable due to missing or recursive dependencies:
base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd primitive-0.5.0.1-15cdc8c11a54a78809b647af0c2975b3
One thing all the broken packages have in common is the missing(?) dependency
base-4.5.1.0-81d626fb996bc7e140a3fd4481b338cd
where the
wired-in package base mapped to base-4.5.1.0-47f48c3ae7f8256a66a23e9dfe22eefc
used base has a different hash.
I'm not sure how this came about, as far as I'm aware, it's impossible to reinstall base, but it looks like you have two exemplars of ghc-7.4.2, and they step on each other's toes.
ghc-pkg list uses
/Library/Frameworks/GHC.framework/Versions/7.4.2-x86_64/usr/lib/ghc-7.4.2/package.conf.d
for the global package database, while the compilation uses
Using binary package database: /usr/local/Cellar/ghc/7.4.2/lib/ghc-7.4.2/package.conf.d/package.cache
Now, it might be that at least one of the two is a symlink and they're both pointing to the same place - then your package.cache is out of sync - but
Glasgow Haskell Compiler, Version 7.4.2, stage 2 booted by GHC version 7.4.2
a GHC booted by the same version seems unusual.
Can you ascertain whether you have indeed two ghc-7.4.2 and the command line uses a different one from the one cabal uses? which ghc tells you which one the shell uses, and cabal install -v some-package outputs the command line cabal uses, including the whole path to the used GHC.
You can list your installed packages with ghc-pkg list. For example (apparently I need to update),
$ ghc-pkg list | grep vector
vector-0.9.1
vector-algorithms-0.5.4
vector-algorithms-0.5.4.2
vector-space-0.8.0
vector-strategies-0.3
You can unregister them using ghc-pkg unregister. Ex,
$ ghc-pkg unregister vector-0.9.1
And then a cabal update && cabal install vector should grab the latest version from hackage.
I had a similar problem with another module after I installed the Haskell Platform over an existing (homebrewed) ghc install [Mac OS Mavericks 10.9.+]. I uninstalled the previous ghc with homebrew
brew uninstall ghc
and re-ran the Haskell Platform installer (.pkg on Mac). I then had to
sudo ghc-pkg recache
to resolve the out-of-date warning upon
ghc-pkg list
This resolved the problem in my case.
You might want to add the package to your .cabal file
I've run into the same error for two unrelated packages now, missingpy and monadiccp.
> cabal install -p -v monadiccp
(after some output)
Creating dist/build (and its parents)
/usr/local/haskell/bin/ghc --make -package-name monadiccp-0.7.0 -hide-all-packages -fbuilding-cabal-package -i -idist/build -i. -idist/build/autogen -Idist/build/autogen -Idist/build -Ilib -optP-include -optPdist/build/autogen/cabal_macros.h -odir dist/build -hidir dist/build -stubdir dist/build -package-id Monatron-0.3.1-360ddfdcf06bcd34f1ed9c1f1c375202 -package-id base-4.3.1.0-1554f26e1cc1c87f47464e927dddbd20 -package-id containers-0.4.0.0-8781485edb2ac0db733a9f9c72e27945 -package-id haskell98-1.1.0.1-0a04bcdb24934b6be516a3abfc033021 -package-id mtl-2.0.1.0-91f62d81c946aa60137dcc008e554a3a -package-id pretty-1.0.1.2-6970e62db724fea03caad23f58dd8f86 -package-id random-1.0.0.3-9024b40453c28359a37c49ce4e776f6e -O -XHaskell98 Data.Expr.Sugar Control.CP.SearchTree Control.CP.Transformers Control.CP.ComposableTransformers Control.CP.Solver Control.CP.PriorityQueue Control.CP.Queue Control.CP.FD.Interface Control.CP.FD.OvertonFD.OvertonFD Control.CP.FD.OvertonFD.Sugar Control.CP.EnumTerm Control.CP.FD.Solvers Control.CP.FD.Gecode.CodegenSolver Control.CP.FD.Model Control.CP.FD.Example Data.Expr.Data Data.Expr.Util Data.Linear Control.CP.FD.Gecode.Common Control.CP.FD.OvertonFD.Domain Control.CP.FD.SimpleFD Control.CP.FD.Graph Control.CP.FD.Decompose Control.CP.FD.FD Control.CP.Debug Control.Mixin.Mixin Control.CP.SearchSpec.Language Control.CP.SearchSpec.Generator Language.CPP.Syntax.AST Language.CPP.Pretty
<command line>: cannot satisfy -package-id random-1.0.0.3-9024b40453c28359a37c49ce4e776f6e:
random-1.0.0.3-9024b40453c28359a37c49ce4e776f6e is shadowed by package random-1.0.0.3-15ae8b1458485ee9647f74174e442c33
(use -v for more information)
World file is already up to date.
For missingpy, ghc will work if the -package-id random... is changed to the correct version, but I don't know how to install it after that.
Any workarounds would be much appreciated. I deleted all of ~/.cabal and ~/.ghc, but no luck.
additional info
ghc info is here, [ http://pastebin.com/jk40VPgw ]. This is my SuSE machine, where I built ghc 7.0.4 from source using ghc 6.12, as well as the latest Haskell Platform. (which was made for ghc 7.0.3, but I think that's okay).
also tried this on another machine [ http://pastebin.com/Digntv4K ]. that one had the Haskell Platform installed via system packages I think.
Have you tried cabal-dev? It's probably best if you start from a clean system, install only the Haskell Platform, and then use cabal-dev to sandbox each codebase you're using.