在GHCI中调试"重复的符号定义"错误

mar*_*iop 8 haskell ghci

我有一个ghci的问题,我需要一个如何调试它的建议.问题是,当我从导入的项目执行一个函数时,我有一个重复的定义错误,并且ghci退出,因为它无法继续:

> ghci -v0 --interactive -ignore-dot-ghci -isrc -idist/build/autogen tests/System/Console/Hawk/PreludeTests.hs -no-user-package-db -package-db /mnt/git/hawk/.cabal-sandbox/x86_64-linux-ghc-7.6.3-packages.conf.d
*System.Console.Hawk.PreludeTests> test [] "1" ""


GHCi runtime linker: fatal error: I found a duplicate definition for symbol
   __stginit_stringsearchzm0zi3zi6zi5_DataziByteStringziSearch
whilst processing object file
   /mnt/git/hawk/.cabal-sandbox/lib/x86_64-linux-ghc-7.6.3/stringsearch-0.3.6.5/libHSstringsearch-0.3.6.5.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.
Run Code Online (Sandbox Code Playgroud)

问题是我无法找到这种情况.该符号在我的cabal沙箱中是独一无二的:

> for f in `find .cabal-sandbox -type f -iname "*.a"`; do nm $f | grep '__stginit_stringsearchzm0zi3zi6zi5_DataziByteStringziSearch$'; done
0000000000000000 D __stginit_stringsearchzm0zi3zi6zi5_DataziByteStringziSearch
Run Code Online (Sandbox Code Playgroud)

所以可能这个stringsearch库有两次加载,但是ghci对它很模糊.

我想知道是否有一种方法可以调试这个,或者至少在ghci杀死之前获取更多关于错误的信息.我已经试图改变冗长但我仍然没有得到任何信息.

scl*_*clv 1

当您间接依赖两个导出相同符号的库的不同版本时,通常会发生这种情况。例如,如果您还有一个来自沙箱外部的库(例如在全局包数据库中),并且依赖于那里的字符串搜索,则可能会发生这种情况。

此外,为了获取更多调试信息,您应该传递一个指示更高详细程度的标志。