我有一个取决于iconv的项目,因为我需要使用cp1251代码页。 Here is问题项目的最小实现。我已经从here安装了iconv,并成功安装了haskell软件包“iconv”,如下所示
cabal install iconv --extra-include-dirs="C:\GnuWin32\include" --extra-lib-dirs="C:\GnuWin32\lib"
软件包iconv已正确安装,但是取决于它的项目链接失败,这是怎么回事。
c:\iconvsmpl>cabal configure --extra-include-dirs="C:\GnuWin32\include" --extra-
lib-dirs="C:\GnuWin32\lib"
Warning: The package list for 'hackage.haskell.org' is 16 days old.
Run 'cabal update' to get the latest list of available packages.
Resolving dependencies...
Configuring iconvsmpl-0.1.0.0...
Warning: The 'license-file' field refers to the file 'LICENSE' which does not
exist.
c:\iconvsmpl>cabal build
Building iconvsmpl-0.1.0.0...
Preprocessing executable 'iconvsmpl' for iconvsmpl-0.1.0.0...
[1 of 1] Compiling Main ( iconvsmpl.hs, dist\build\iconvsmpl\iconvsm
pl-tmp\Main.o )
Linking dist\build\iconvsmpl\iconvsmpl.exe ...
C:\Users\admin\AppData\Roaming\cabal\iconv-0.4.1.1\ghc-7.6.3/libHSiconv-0.4.1.1.
a(hsiconv.o):hsiconv.c:(.text+0x7): undefined reference to `_imp__libiconv_open'
C:\Users\admin\AppData\Roaming\cabal\iconv-0.4.1.1\ghc-7.6.3/libHSiconv-0.4.1.1.
a(hsiconv.o):hsiconv.c:(.text+0x17): undefined reference to `_imp__libiconv'
C:\Users\admin\AppData\Roaming\cabal\iconv-0.4.1.1\ghc-7.6.3/libHSiconv-0.4.1.1.
a(hsiconv.o):hsiconv.c:(.text+0x27): undefined reference to `_imp__libiconv_clos
e'
collect2: ld returned 1 exit status
c:\iconvsmpl>
为什么iconv已安装并链接,但iconvsmpl无法链接。如何在Windows下构建它?在Windows for Haskell下还有另一种使用外部编码的方法吗?
非常需要Windows可执行文件。软件包的构建和在Linux下的工作。
Haskell平台的版本为2013.2.0.0
最佳答案
在Windows上安装时,您需要修改iconv软件包的.cabal文件。删除条件检查,以便始终应用extra-libraries
字段。更新include-dirs
和extra-lib-dirs
字段,如下所示:
include-dirs: cbits, "c:\\GnuWin32\\include"
extra-lib-dirs: "c:\\GnuWin32\\lib"
关于windows - 根据Windows下的iconv构建Haskell程序,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18856039/