Hackage软件包中的未定义符号“双重转换” [英] Undefined symbol in a Hackage package `double-conversion`

查看:99
本文介绍了Hackage软件包中的未定义符号“双重转换”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从Hackage构建双重转换包。它建立好,但ghci无法加载它。抱怨是:

 加载包double-conversion-0.2.0.0 ...链接...< interactive>:
/home/me/.cabal/lib/double-conversion-0.2.0.0/ghc-7.0.4/HSdouble-conversion-0.2.0.0.o:
未知符号`_ZNK17double_conversion6Double5valueEv'

nm 输出显示符号为

  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

这是文件中唯一弱符号,的确如此,据我所知,在整个GHC编译软件包的世界里。

有问题的函数显然是FFI,用C ++编写, code>双转换/ SRC / double.h 。它不是唯一的内联函数,但只有这个函数被标记为弱。



作为一种临时措施,我已经将函数移出了行,并且包现在负载。但是那里显然存在一些问题。为什么这个功能很弱?为什么其他功能不是? ghc应该抱怨软弱的符号吗?系统数据:Gentoo Linux,gcc-ghc,gcc,gcc,gcc,gcc,gcc, 4.4.5,ghc-7.0.4,cabal-1.10.2.0。

解决方案

相关:不能在与libstdc ++链接的库中使用ghci 这看起来像一个Gentoo(或可能GCC 4.4) - 特定的问题 - 有问题的 .o 文件在我的系统中不包含任何弱符号(我在Ubuntu上测试过使用GCC 4.5.2和GHC 7.0.3 / 7.0.4的Natty)。我建议你在GHC Trac上提交一张票。顺便说一句,我可以重现#5289。


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.

这篇关于Hackage软件包中的未定义符号“双重转换”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆