Creating a Haskell program based on iconv under windows

I have a project depending on iconv because I need to work with the cp1251 code page. Below is a minimal implementation of a problematic project. I installed iconv from here and successfully installed the haskell "iconv" package like this

cabal install iconv --extra-include-dirs="C:\GnuWin32\include" --extra-lib-dirs="C:\GnuWin32\lib" 

The iconv package icon is installed correctly, but the project, depending on this, could not be linked, that's what happens.

 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> 

Why iconv is installed and connected, but iconvsmpl cannot be connected. How to create it under Windows? Is there any other way to work with foreign encodings under Windows for Haskell?

It is highly desirable to have an executable for windows. Creating a package and working on Linux.

Haskell-Platform Version - 2013.2.0.0

+6
source share
1 answer

When installing on Windows, you need to modify the iconv .cabal file. Remove the conditional check so that the extra-libraries field is always applied. Update the include-dirs and extra-lib-dirs fields as follows:

 include-dirs: cbits, "c:\\GnuWin32\\include" extra-lib-dirs: "c:\\GnuWin32\\lib" 
+2
source

Source: https://habr.com/ru/post/954008/


All Articles