How do I get text-icu working on Windows?

余生颓废 提交于 2021-02-17 17:59:50

问题


I was able to cabal install text-icu without errors. (I used --extra-lib-dirs and --extra-include-dirs to point to the lib and include directories in the binary distribution of icu4c.)

I was also able to build the following simple program that uses text-icu, by doing ghc --make icu.hs:

-- icu.hs
import Data.Text.ICU
main = print $ Locale "tr-TR"

No errors or warnings in either of these steps. But when I try to run the compiled program, icu.exe, I get no output at all. I expected to get a line with Locale "tr-TR", but instead I get nothing -- not even an error or warning. This remains the case if I try

main = do
  print $ Locale "tr-TR"
  print "Done"

so using the text-icu stuff seems to cause the program to silently fail. echo $? yields False.

Does anyone have text-icu up and running on Windows? Can you tell me what I'm doing wrong?


回答1:


Stack includes a copy of msys2 on Windows, which contains the pacman package manager, so we can run:

stack exec -- pacman -Sy mingw64/mingw-w64-x86_64-icu
stack build text-icu



回答2:


I managed it by doing:

  • Download the binaries from http://site.icu-project.org/download/56#TOC-ICU4C-Download, specifically http://download.icu-project.org/files/icu4c/56.1/icu4c-56_1-Win32-msvc10.zip.
  • Extract the contents of icu/bin into the directory C:\bin which is on my %PATH%. Extract the contents of icu into the directory C:\bin\icu.
  • Use Stack to run stack ghci text-icu --extra-lib-dirs=c:\bin --extra-include-dirs=c:\bin\icu\include.
  • In GHCi, run import Data.Text.ICU.Normalize, then :set -XOverloadedStrings, then normalize None "test".
  • For each dll that is reported as cannot be found, e.g. icuuc.dll, take the C:\bin\icuuc56.dll and make a copy at C:\bin\icuuc.dll. For me, there were three relevant dlls.

After all that, I can normalise a string in ghci.




回答3:


This is how windows reacts to a missing static dependency. When the operating system starts a process it looks for static dependencies. If one is missing, then program is not started.

Use depends.exe to find out what import is missing. That could be a missing dll or one that is the wrong version.

Depends is available with 1. Visual Studio 2. The Microsoft Platform SDK 3. Other microsoft packages 4. http://www.dependencywalker.com

It pretty indispensable when tracking down what is happening in this case.




回答4:


you should check if there are some DLL missing with cygcheck.check the path and the windows enviroment variables too with it is right. Or try to reinstall following the haskell procedure.

http://www.haskell.org/haskellwiki/Windows#Tools_for_compilation

good luck



来源:https://stackoverflow.com/questions/16127710/how-do-i-get-text-icu-working-on-windows

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!