Undefined symbol in a Hackage package `double-conversion`
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.
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.
精彩评论