[Haskell-cafe] text-icu (and FFI in general) on Windows 64 bits
Yitzchak Gale
gale at sefer.org
Wed May 20 11:00:17 UTC 2015
On reddit, /u/awson (is that Kyra?) pointed out the
problem with linking against vanilla DLLs on 64-bit
Windows is caused by a recently-fixed bug in GNU
binutils:
http://www.gnu.org/software/binutils/
https://sourceware.org/bugzilla/show_bug.cgi?id=16598
If that is the only problem, this might be fixed in an
upcoming version of GHC.
-Yitz
On Tue, May 19, 2015 at 7:51 PM, Yitzchak Gale <gale at sefer.org> wrote:
> I was finally successful in getting text-icu to
> work on Windows 64 bits. This is probably
> an indication of what to expect in general
> for packages requiring FFI on Windows
> 64 bits.
>
> In the past, on 32 bits, the standard Windows
> binary distribution from the ICU site could be
> used together with msys/mingw, even though
> it was officially only for MSVC. This no longer
> seems to be the case for 64 bits. When I
> build text-icu in that way with a 64 bit GHC and
> the Windows 64-bit binary ICU distribution for
> MSVC, the resulting EXEs segfault as soon as
> any function from text-icu is called.
>
> There is no official ICU download for
> mingw-w64 binaries. But happily, the MSYS2
> project does provide a pre-built ICU binary
> distribution for mingw-w64. It tends to be quite
> up-to-date; the current version is ICU 55.1.
>
> Note, however, that I was *not* able to use the
> partial MSYS2 that comes with MinGHC, because
> pacman seems to be missing.
>
> So the solution is:
>
> 1. Download and install 64-bit MSYS2, following the
> instructions on the site:
>
> http://msys2.github.io
>
> 2. In the MSYS2 shell window, get the ICU package
> for mingw-w64:
>
> pacman -S mingw64/mingw-w64-x86_64-icu
>
> 3. Now you can build the Haskell text-icu library
> using this command:
>
> cabal install --extra-lib-dirs="c:\path\to\msys64\mingw64\lib"
> --extra-include-dirs="c:\path\to\msys64\mingw64\include" text-icu
>
> 4. Provide the following DLLs with your EXE that uses
> text-icu:
>
> libicudt55.dll
> libicuin55.dll
> libicuuc55.dll
> libgcc_s_seh-1.dll
> libstdc++-6.dll
>
> Get them from: c:\path\to\msys64\mingw64\bin
>
> This not only compiles, but EXEs produced using
> this library actually run without segfaulting.
>
> You can even compile native Windows EXEs from
> C using ICU this way, with the gcc that is put on your
> path by the Haskell Platform installer (and probably
> also MinGHC, but I didn't try that). Just include
> -L and -I options to gcc with the same paths as
> above, and make sure to specify -licuuc -licudt
> etc. as needed.
>
> -Yitz
More information about the Haskell-Cafe
mailing list