
Hello. How do I make ghc use my installation of MinGW on Windows? I have ghc-7.0.1 installed and the latest MinGW packages. I want ghc to automatically find libraries installed by the MinGW installer. Currently I am getting the error with my application: Linking Gui.exe ... C:\Program Files\Haskell\iconv-0.4.1.0\ghc-7.0.1/libHSiconv-0.4.1.0.a(hsiconv.o):hsiconv.c:(.text+0x8): undefined reference to `libiconv_open' where libiconv has been installed with the command mingw-get install mingw32-libiconv and the library is available at c:/devel/MinGW/lib/ Romildo

Is pkg-config available for MSys? It might help matters if it is - I think Cabal has direct support for pkg-config. Otherwise point Cabal to the location of the .a file with --extra-lib-dirs. You will also have to point to the headers with --extra-include-dirs. If you are compiling with GHC straight rather than using a Cabal file, I think it will need a -l (lower L) flag for the lib and -I (upper i) for headers.

On Sat, 12 Feb 2011 16:12:22 +0100, José Romildo Malaquias
Hello.
How do I make ghc use my installation of MinGW on Windows? I have ghc-7.0.1 installed and the latest MinGW packages. I want ghc to automatically find libraries installed by the MinGW installer.
Currently I am getting the error with my application:
Linking Gui.exe ... C:\Program Files\Haskell\iconv-0.4.1.0\ghc-7.0.1/libHSiconv-0.4.1.0.a(hsiconv.o):hsiconv.c:(.text+0x8): undefined reference to `libiconv_open'
where libiconv has been installed with the command
mingw-get install mingw32-libiconv
and the library is available at c:/devel/MinGW/lib/
You have to define some environment variables, see: http://www.haskell.org/haskellwiki/Windows#Tools_for_compilation Regards, Henk-Jan van Tuyl -- http://Van.Tuyl.eu/ http://members.chello.nl/hjgtuyl/tourdemonad.html --

On Sat, Feb 12, 2011 at 01:12:22PM -0200, José Romildo Malaquias wrote:
Hello.
How do I make ghc use my installation of MinGW on Windows? I have ghc-7.0.1 installed and the latest MinGW packages. I want ghc to automatically find libraries installed by the MinGW installer.
Currently I am getting the error with my application:
Linking Gui.exe ... C:\Program Files\Haskell\iconv-0.4.1.0\ghc-7.0.1/libHSiconv-0.4.1.0.a(hsiconv.o):hsiconv.c:(.text+0x8): undefined reference to `libiconv_open'
where libiconv has been installed with the command
mingw-get install mingw32-libiconv
and the library is available at c:/devel/MinGW/lib/
Looking at iconv.cabal from the iconv package, I found this: if os(darwin) || os(freebsd) -- on many systems the iconv api is part of the standard C library -- but on some others we have to link to an external libiconv: extra-libraries: iconv So the problem is that the extra library iconv is not been considered for the windows os. Changing the line above to consider the windows os solves the problem: if os(darwin) || os(freebsd) || os(windows) -- on many systems the iconv api is part of the standard C library -- but on some others we have to link to an external libiconv: extra-libraries: iconv Therefore the mantainer of the iconv package should fix this issue. Romildo
participants (3)
-
Henk-Jan van Tuyl
-
José Romildo Malaquias
-
Stephen Tetley