tl; dr:似乎Network.HTTP
和Data.Aeson
彼此不兼容。我将如何开始解决这个问题?
长版:我想我尽可能缩小了范围。我从一个新的cabal沙箱开始,现在得到一个运行时链接器致命错误。
这是我的代码:
-- test.hs
import Network.HTTP (simpleHTTP, getRequest, getResponseBody, postRequestWithBody)
import Data.Aeson
main = print "hi"
以下是我从第一个命令中得到错误的方法:
$ cabal --version
cabal-install version 1.20.0.3
$ cabal sandbox init
...
$ cabal install aeson
...
$ cabal repl
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :load test.hs
[1 of 1] Compiling Main ( test.hs, interpreted )
Ok, modules loaded: Main.
*Main> main
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package primitive-0.5.0.1 ... linking ... done.
Loading package vector-0.10.0.1 ... linking ... done.
Loading package bytestring-0.10.0.2 ... linking ... done.
Loading package transformers-0.3.0.0 ... linking ... done.
Loading package mtl-2.1.2 ... linking ... done.
Loading package text-0.11.3.1 ... linking ... done.
Loading package parsec-3.1.3 ... linking ... done.
Loading package old-locale-1.0.0.5 ... linking ... done.
Loading package time-1.4.0.1 ... linking ... done.
Loading package unix-2.6.0.1 ... linking ... done.
Loading package network-2.4.1.2 ... linking ... done.
Loading package old-time-1.1.0.1 ... linking ... done.
Loading package HTTP-4000.2.8 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package bytestring-0.10.4.0 ...
GHCi runtime linker: fatal error: I found a duplicate definition for symbol
_fps_count
whilst processing object file
/Users/tapwater/p/haskell/stellar/.cabal-sandbox/lib/x86_64-osx-ghc-7.6.3/bytestring-0.10.4.0/libHSbytestring-0.10.4.0.a
This could be caused by:
* Loading two different object files which export the same symbol
* Specifying the same object file twice on the GHCi command line
* An incorrect `package.conf' entry, causing some object to be
loaded twice.
GHCi cannot safely continue in this situation. Exiting now. Sorry.
如果我注释掉任何一个import语句,一切正常。
我(希望)做错了吗?或者这两个库完全不兼容?
答案 0 :(得分:1)
这最终成为解决方案:
$ cabal install http
我猜这是因为cabal沙箱解决了这个问题。我想我需要为任何带有像这样的冲突的haskell平台附带的库做这个吗?我觉得我还在做错事。