链接 c++ Windows 上的 Haskell-Platform 的 dll 输出“未定义的引用”
我是一名 Haskell 爱好者,并且在 Windows 上编译我的小 Haskell 程序时遇到了困难。我的程序使用 iconv 包,该包又使用用 c/c++ 编写的外部库。为了使事情正常工作,我有:
- 运行 GNU-Iconv 安装程序并添加其“bin”文件夹, 在哪里 “libiconv-2.dll”和“libiconv2.dll”位于
PATH
多变的。 - 提取并复制“LibIconv开发人员文件”到“mingw”文件夹 Haskell 平台位置。
- 然后“cabal install iconv”编译,我就有了 cabal 包 安装。
现在,当我尝试在 Leksah 中构建模块时,我从“GHC”收到以下消息:
Building norms-parser-0.0.1...
Linking dist\build\norms-parser\norms-parser.exe ...
C:\Documents and Settings\kdv\Application Data\cabal\iconv-0.4.1.0\ghc-7.0.4/libHSiconv-0.4.1.0.a(hsiconv.o):hsiconv.c:(.text+0x7): undefined reference to `_imp__libiconv_open'
C:\Documents and Settings\kdv\Application Data\cabal\iconv-0.4.1.0\ghc-7.0.4/libHSiconv-0.4.1.0.a(hsiconv.o):hsiconv.c:(.text+0x17): undefined reference to `_imp__libiconv'
C:\Documents and Settings\kdv\Application Data\cabal\iconv-0.4.1.0\ghc-7.0.4/libHSiconv-0.4.1.0.a(hsiconv.o):hsiconv.c:(.text+0x27): undefined reference to `_imp__libiconv_close'
collect2: ld returned 1 exit status
对于“GHCi”,我也面临一个问题:
ghc.exe: unable to load package `iconv-0.4.1.0'
ghc.exe: C:\Documents and Settings\kdv\Application Data\cabal\iconv-0.4.1.0\ghc- 7.0.4\HSiconv-0.4.1.0.o: unknown symbol `__imp__libiconv_open'
我认为可能的解决方案是正确设置 c/c++ 头文件到“mingw”文件夹并将 PATH 变量设置为“lib”文件,但我对此知之甚少,因此任何帮助将不胜感激。
I am a Haskell enthusiast and have got stuck upon compiling my little Haskell program on Windows. My program uses the iconv package, which in turn uses the foreign library written in c/c++. To make things work I have :
- Run GNU-Iconv setup and added its 'bin' folder, where
'libiconv-2.dll' and 'libiconv2.dll' are located, to thePATH
variable. - Extracted and copied 'LibIconv developer files' to the 'mingw' folder of
Haskell Platform location. - Then 'cabal install iconv' compiles and I have the cabal package
installed.
Now, when I try to build my module in Leksah, I get the following message from 'GHC':
Building norms-parser-0.0.1...
Linking dist\build\norms-parser\norms-parser.exe ...
C:\Documents and Settings\kdv\Application Data\cabal\iconv-0.4.1.0\ghc-7.0.4/libHSiconv-0.4.1.0.a(hsiconv.o):hsiconv.c:(.text+0x7): undefined reference to `_imp__libiconv_open'
C:\Documents and Settings\kdv\Application Data\cabal\iconv-0.4.1.0\ghc-7.0.4/libHSiconv-0.4.1.0.a(hsiconv.o):hsiconv.c:(.text+0x17): undefined reference to `_imp__libiconv'
C:\Documents and Settings\kdv\Application Data\cabal\iconv-0.4.1.0\ghc-7.0.4/libHSiconv-0.4.1.0.a(hsiconv.o):hsiconv.c:(.text+0x27): undefined reference to `_imp__libiconv_close'
collect2: ld returned 1 exit status
With 'GHCi',I face an issue too:
ghc.exe: unable to load package `iconv-0.4.1.0'
ghc.exe: C:\Documents and Settings\kdv\Application Data\cabal\iconv-0.4.1.0\ghc- 7.0.4\HSiconv-0.4.1.0.o: unknown symbol `__imp__libiconv_open'
I think the probable solution is in having the right setup of c/c++ header files to 'mingw' folder and setting PATH variables to 'lib' files, but I have little knowledge about it, so any help will be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Windows 上安装 libiconv 有点棘手。
编辑 iconv.cabal文件,因此包含
include-dirs
和extra-lib-dirs
的行看起来像注意到 Windows 路径中的双破折号,并将其编辑到您的 Haskell Platform 路径。
if os(darwin) || os(freebsd)
,将其更改为if os(darwin) ||操作系统(freebsd)|| os(windows)
cabal install
命令Installing libiconv is a little tricky on Windows.
Edit iconv.cabal file, so lines with
include-dirs
andextra-lib-dirs
will looks likenotice the double dashes in windows path, and edit it to your path of Haskell Platform.
if os(darwin) || os(freebsd)
, change it toif os(darwin) || os(freebsd) || os(windows)
cabal install
command from iconv pachage dir