Undefined symbol in a Hackage package `double-conversion`

大憨熊 提交于 2019-12-23 10:26:11

问题


I'm trying to build the double-conversion package from Hackage. It builds OK but ghci can't load it. The complaint is:

Loading package double-conversion-0.2.0.0 ... linking ... <interactive>: 
/home/me/.cabal/lib/double-conversion-0.2.0.0/ghc-7.0.4/HSdouble-conversion-0.2.0.0.o: 
unknown symbol `_ZNK17double_conversion6Double5valueEv'

The nm output shows that the symbol is weak:

nm /home/me/.cabal/lib/double-conversion-0.2.0.0/ghc-7.0.4/HSdouble-conversion-0.2.0.0.o \
    | grep _ZNK17double_conversion6Double5valueEv
00000000 W _ZNK17double_conversion6Double5valueEv

This is the only weak symbol in the file, and indeed, as far as I can tell, in the entire world of GHC-compiled packages.

The problematic function is apparently a FFI one, written in C++ and defined inline in double-conversion/src/double.h. It's not the only inline function there, but only this one gets labelled weak.

As a stopgap measure I have moved the function out-of-line, and the package now loads. But there's obviously some problem somewhere in there. Why this function is weak? Why other functions are not? Should ghc complain at weak symbols? Should I file a bug, and if so, who should get it (double-conversion, gcc, ghc, someone else?)

System data: Gentoo Linux, gcc-4.4.5, ghc-7.0.4, cabal-1.10.2.0.


回答1:


This ticket on GHC Trac looks relevant: Can't use ghci with a library linked against libstdc++. This looks like a Gentoo (or possibly GCC 4.4)-specific problem - the .o file in question doesn't contain any weak symbols on my system (I tested on Ubuntu Natty with GCC 4.5.2 & GHC 7.0.3/7.0.4). I suggest you file a ticket on GHC Trac. Incidentally, I can reproduce #5289.



来源:https://stackoverflow.com/questions/6634373/undefined-symbol-in-a-hackage-package-double-conversion

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