在Windows上为Haskell构建GD库时出现错误

时间:2012-06-10 00:59:40

标签: c haskell mingw ld ffi

通过cabal在Windows上安装Haskell GD软件包(使用MinGW)时,我收到以下警告:

Warning: resolving _gdImagePtrDestroyIfNotNull by linking to _gdImagePtrDestroyIfNotNull@4
Warning: resolving _gdImageCopyRotated90 by linking to _gdImageCopyRotated@36
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups

请注意,这些正是gd-extras中定义的功能 然后,当实际编译使用gd的Haskell程序时,我得到以下错误:

Linking Main.exe ...
[...]\cabal\gd-3000.7.3\ghc-7.4.1/libHSgd-3000.7.3.a(Internal.o):fake:(.text+0x2211):undefined reference to 'gdImageCopyRotated90'
[...]\cabal\gd-3000.7.3\ghc-7.4.1/libHSgd-3000.7.3.a(Internal.o):fake:(.text+0x500a):undefined reference to 'gdImagePtrDestroyIfNotNull'
[...]
collect2: ld returned 1 exit status

我无法弄清楚如何解决这个问题 - 我已经花了很多时间来达到这一点,因为我还有很多问题试图让它发挥作用,但这似乎是最后的障碍。我已经尝试启用/禁用stdcall fixup,并且还更改了这些函数定义在哪个文件中(因为gd-extras似乎是一个潜在的问题),但是这并没有解决这些问题。
谢谢你的帮助。

1 个答案:

答案 0 :(得分:1)

您需要将显式链接器标志传递给ghc,指向库。 Haskell GD库是自动链接的,但除非你告诉ghc,否则dll也不会被链接。 stdcall-fixup错误在这里是一个红色的鲱鱼。

相关问题