5
votes

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
What error do you get if you try to install text-format? Maybe Yesod tries to use double-conversion from Template Haskell?Mikhail Glushenkov
Have you tried using the overlay?alternative
@monadic: I am actually using the overlay, only after it failed I tried local cabal install. The error message is the same. @Mikhail Glushenkov: I actually can install text-format, but not yesod. The error message is the same.n. 1.8e9-where's-my-share m.
I experienced the same issue with ghc-7.6.3 on Ubuntu-10.04 when I was trying to build package which uses double-conversion with cabal. Ghci failed too. To my surprise, simple ghc --make worked for me.Dmitry Vyal

1 Answers

1
votes

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.