Bytestring linking in ghc

谁都会走 提交于 2019-12-07 00:31:52

问题


Consider the following simple code:

import Crypto.Hash.SHA1 (hashlazy)
import qualified Data.ByteString as BS
main = return ()

I installed cabal install --global bytestring and then I obtain (on a newly installed Ubuntu 12.04 machine using ghc 7.4.1):

GHCi runtime linker: fatal error: I found a duplicate definition for symbol
   fps_minimum
whilst processing object file
   /usr/local/lib/bytestring-0.10.0.1/ghc-7.4.1/HSbytestring-0.10.0.1.o
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.

What can I do with that?


回答1:


This is a diamond dependency issue. You have a version of cryptohash built against one version of bytestring, but the rest of the GHC system built against another. Thus when the packages are linked together, two slightly different versions of bytestring are linked.

Normally this is ok, as long as the bytestring types are compatible.

However, bytestring includes a small C library for some utilities. C libraries have non-unique symbols, that prevent duplicate linking, hence your error.

You need to ensure cryptohash is built against the same version of bytestring.



来源:https://stackoverflow.com/questions/13258259/bytestring-linking-in-ghc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!