Execution error in using text-icu on windows

60 views
Skip to first unread message

S. H. Aegis

unread,
Mar 4, 2017, 11:35:11 AM3/4/17
to haskell-stack
Hi.

I worte some code. and fixed some errors with the help of good persons.
Now, this utility works properly in Stack environment.
This utility use text-icu and I coded this utility on windows. Of course, I want to work this utility on other windows OS.

I copied %stackPath%\.stack-work\install\~\bin\samCheceker-exe.exe to some other folder, and execution through CMD.
But I got error message that says "libicuuc57.dll dose not exist. so program can't start. please re-install the program."
I copied libicuuc57.dll, and so... as like programming newbees, but failed. "stack install" command was the same result.

With help of Francesco Ariis from (begi...@haskell.org), I steped forword.
But still got error message.

C:\Users\shaeg\Documents\Haskell\samChecker3> stack build  --ghc-options="-static -optl-static"
Warning: File listed in samChecker3.cabal file does not exist: README.md
samChecker3-0.1.0.0: unregistering (local file changes: app\Main.hs samChecker3.cabal src\Lib.hs test\Spec.hs)
samChecker3-0.1.0.0: configure (lib + exe)
Configuring samChecker3-0.1.0.0...
samChecker3-0.1.0.0: build (lib + exe)
Preprocessing library samChecker3-0.1.0.0...
[1 of 1] Compiling Lib              ( src\Lib.hs, .stack-work\dist\ca59d0ab\build\Lib.o )
Preprocessing executable 'samChecker3-exe' for samChecker3-0.1.0.0...
[1 of 1] Compiling Main             ( app\Main.hs, .stack-work\dist\ca59d0ab\build\samChecker3-exe\samChecker3-exe-tmp\Main.o )
Linking .stack-work\dist\ca59d0ab\build\samChecker3-exe\samChecker3-exe.exe ...
C:/Users/shaeg/AppData/Local/Programs/stack/x86_64-windows/ghc-8.0.2/mingw/bin/ld.exe: cannot find -licuuc
C:/Users/shaeg/AppData/Local/Programs/stack/x86_64-windows/ghc-8.0.2/mingw/bin/ld.exe: cannot find -licuin
C:/Users/shaeg/AppData/Local/Programs/stack/x86_64-windows/ghc-8.0.2/mingw/bin/ld.exe: cannot find -licudt
collect2.exe: error: ld returned 1 exit status
`gcc.exe' failed in phase `Linker'. (Exit code: 1)
Warning: File listed in samChecker3.cabal file does not exist: README.md

--  While building package samChecker3-0.1.0.0 using:
      C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_1.24.2.0_ghc-8.0.2.exe --builddir=.stack-work\dist\ca59d0ab build lib:samChecker3 exe:samChecker3-exe --ghc-options " -ddump-hi -ddump-to-file"
    Process exited with code: ExitFailure 1

[stack path] results
extra-include-dirs: C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include
extra-library-dirs: C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib

According to first error message(libicuuc57.dll dose not exist. so program can't start. please re-install the program.), I find the path for libicuuc57.dll, and re-set the extra-library-dirs.
C:\Users\shaeg\Documents\Haskell\samChecker3>stack build --extra-lib-dirs=C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\bin --ghc-options="-static -optl-static"
But got the same result.

libicuuc75.dll, libicuin57.dll etc files is located in C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\bin

How can I fix this error?
Thank you so much.

Sincerely, S. Chang.

------------------------------------------------
Here is my stack path.
C:\Users\shaeg\Documents\Haskell\samChecker3>stack path
stack-root: C:\sr
project-root: C:\Users\shaeg\Documents\Haskell\samChecker3
config-location: C:\Users\shaeg\Documents\Haskell\samChecker3\stack.yaml
bin-path: .;C:\sr\snapshots\7dd4ddea\bin;C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.2\bin;C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.2\mingw\bin;C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\bin;C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\usr\bin;C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\usr\local\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\IntelSGXPSW\bin\x64\Release\;C:\Program Files\Intel\IntelSGXPSW\bin\win32\Release\;c:\Program Files\Intel\WiFi\bin\;c:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Hewlett-Packard\SimplePass\;C:\Users\shaeg\AppData\Roaming\local\bin;C:\Users\shaeg\AppData\Local\Microsoft\WindowsApps
programs: C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows
compiler-exe: C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.2\bin\ghc.EXE
compiler-bin: C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.2\bin
local-bin: C:\Users\shaeg\AppData\Roaming\local\bin
extra-include-dirs: C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\include
extra-library-dirs: C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\msys2-20150512\mingw64\lib
snapshot-pkg-db: C:\sr\snapshots\7dd4ddea\pkgdb
local-pkg-db: C:\Users\shaeg\Documents\Haskell\samChecker3\.stack-work\install\02136e14\pkgdb
global-pkg-db: C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.2\lib\package.conf.d
ghc-package-path: C:\Users\shaeg\Documents\Haskell\samChecker3\.stack-work\install\02136e14\pkgdb;C:\sr\snapshots\7dd4ddea\pkgdb;C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.2\lib\package.conf.d
snapshot-install-root: C:\sr\snapshots\7dd4ddea
local-install-root: C:\Users\shaeg\Documents\Haskell\samChecker3\.stack-work\install\02136e14
snapshot-doc-root: C:\sr\snapshots\7dd4ddea\doc
local-doc-root: C:\Users\shaeg\Documents\Haskell\samChecker3\.stack-work\install\02136e14\doc
dist-dir: .stack-work\dist\ca59d0ab
local-hpc-root: C:\Users\shaeg\Documents\Haskell\samChecker3\.stack-work\install\02136e14\hpc
local-bin-path: C:\Users\shaeg\AppData\Roaming\local\bin
ghc-paths: C:\Users\shaeg\AppData\Local\Programs\stack\x86_64-windows

Harendra Kumar

unread,
Mar 4, 2017, 12:27:18 PM3/4/17
to S. H. Aegis, haskell-stack
Not answering your question but in case you are using the text-icu library only for normalization then you can try https://hackage.haskell.org/package/unicode-transforms instead which is a pure haskell library, so you will not have linking issues.

-harendra

--
You received this message because you are subscribed to the Google Groups "haskell-stack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stack+unsubscribe@googlegroups.com.
To post to this group, send email to haskel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/haskell-stack/a0331cea-ba06-453d-8186-1332d8f45f6e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

S. H. Aegis

unread,
Mar 5, 2017, 7:35:29 AM3/5/17
to haskell-stack
Thank you so much, Harendra Kumar.
I re-write my code, and it works!
But wired result comes out.
All of fuctions works good indivisually, but final result have a error. There is no error when using text-icu or iconv lib.
Why these results come out? I needs any suggestions.
Thank you.
Have a nice day~

Sincerely, S. Chang.

C:\Users\shaeg\Documents\Haskell\samChecker3>stack exec samChecker3-exe BoHom.dat RxDxData.csv
samChecker3-exe.EXE: Prelude.!!: index too large

RxDxData.csv
Name,codeNo,Dx,Blank
Naem2,codeNo2,Dx2,Blank2
...

BoHom.dat
series of numbers that encoded in EUC-KR (more than 1000 lines)

Main.hs
module Main where

import Lib
import System.Environment
--import System.FilePath.Windows
--import Data.Text.ICU.Convert       -- There is Codec.Text.IConv, too.
import qualified Data.Text         as T
import qualified Data.Text.IO      as TIO
import qualified Data.Text.Encoding      as TE
import qualified Data.ByteString.Char8   as BS
import qualified Data.ByteString.Lazy    as BL
--import Codec.Text.IConv
import Data.Text.Normalize

main :: IO ()
main = do
        args <- getArgs    -- 1st=SAM 2nd=csv
        byteSAM <- TIO.readFile $ (args !! 0)
        byteRxDxData <- TIO.readFile $ (args !! 1)
        TIO.putStrLn $ T.concat $ checkRxDxSAM (normalize NFKC byteSAM) (normalize NFKC byteRxDxData

Lib.hs
module Lib
--    ( readSAM
--    , readCSV
--    , checkRxDxSAM
--    ) where
      where

import Data.Text                 as T
import Data.Text.IO              as TIO
--import Data.Text.ICU.Convert
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy  as BL
import Text.Regex.TDFA
--import Data.Text.ICU             as I
import Prelude hiding (take, drop, map, lines)
--import Codec.Text.IConv
import Data.Text.Normalize        as TN

type RowSAM = Text
type SAM = [Text]
type Case = Text
type RowRxDx = Text
type RxDx = [Text]
type RxDxList = [[Text]]
type Rx = Text
type Dx = Text
type MediName = Text
type Message = Text
type ErrorMessage = Text
type Date = Text
type PtName = Text

checkRxDxSAM :: RowRxDx -> RowSAM -> [ErrorMessage]
checkRxDxSAM rxDx sam = [pickupError r s | r <- (makeTuple rxDx), s <- makeSamData sam]

makeSamData :: RowSAM -> SAM
makeSamData sam = splitIntoCase sam

makeTuple :: RowRxDx -> [(Rx, Dx, MediName)]
makeTuple rxDx = zip3 (makeRxList rxDx) (makeDxList rxDx) (makeMediNameList rxDx)

makeMediNameList :: RowRxDx -> [MediName]
makeMediNameList rxDx = fmap pickupMediName $ makeRxDxList rxDx

makeDxList :: RowRxDx -> [Dx]
makeDxList rxDx = fmap pickupDx $ makeRxDxList rxDx

makeRxList :: RowRxDx -> [Rx]
makeRxList rxDx = fmap pickupRx $ makeRxDxList rxDx

makeRxDxList :: RowRxDx -> RxDxList
makeRxDxList rowRxDx = fmap f (lines rowRxDx)
    where
        f :: Text -> [Text]
        f x = splitOn (pack ",") x

pickupError :: (Rx, Dx, Message) -> Case -> ErrorMessage
pickupError (rxCode, dxCode, errMsg) ptCase =
    case isErrorRxDx rxCode dxCode ptCase of
        --True  -> append (pickupCaseDate ptCase) $ append (pack " ") $ append (pickupPtName ptCase) $ append (pack " Omit ") $ append dxCode $ append (pack " for ") errMsg
        True  -> append (pickupCaseDate ptCase) $ append (pack " ") $ append (pickupPtName ptCase) $ append (pack " Omit ") $ append dxCode $ append (pack " for ") $ append errMsg (pack "\n")
        False -> T.empty

pickupMediName :: RxDx -> MediName
pickupMediName rxDx = rxDx !! 0

pickupDx :: RxDx -> Dx
pickupDx rxDx = rxDx !! 2

pickupRx :: RxDx -> Rx
pickupRx rxDx = rxDx !! 1

pickupPtName :: Case -> PtName
pickupPtName ptCase = take 3 $ drop 45 ptCase

pickupCaseDate :: Case -> Date
pickupCaseDate ptCase = take 8 $ drop (348 + 2) ptCase

isErrorRxDx :: Rx -> Dx -> Case -> Bool
isErrorRxDx rxCode dxCode ptCase =
    case isExistRx rxCode ptCase of
        True  -> if (isExistDx dxCode ptCase) then False else True
        False -> False

isExistDx :: Dx -> Case -> Bool
isExistDx dxCode ptCase = (unpack ptCase) =~ (unpack dxCode)
--isExistDx dxCode ptCase =
--    case (I.find (regex [] dxCode) ptCase) of
--        Just x  -> True
--        Nothing -> False

isExistRx :: Rx -> Case -> Bool
isExistRx rxCode ptCase = rxCode `isInfixOf` ptCase

splitIntoCase :: RowSAM -> SAM
splitIntoCase = splitOn $ pack "AH021


Harendra Kumar

unread,
Mar 5, 2017, 9:08:58 AM3/5/17
to S. H. Aegis, haskell-stack
Can you compare the normalized output using unicode-transforms and using text-icu, for both of your files? Let me know if you find a difference between the two. If it is different please raise an issue at https://github.com/harendra-kumar/unicode-transforms .

-harendra

--
You received this message because you are subscribed to the Google Groups "haskell-stack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stack+unsubscribe@googlegroups.com.
To post to this group, send email to haskel...@googlegroups.com.

S. H. Aegis

unread,
Mar 9, 2017, 9:03:17 AM3/9/17
to haskell-stack
Sorry for late reply.
I tested several times, and I fixed it. It is due to my stupid mistake. sorry about border you.
I re-write code and works fine.
Thank you so much. It is great package unicode-transforms!!!
Thank you so much, and have a nice day. =)

Sincerely, S. Chang.
-harendra

To unsubscribe from this group and stop receiving emails from it, send an email to haskell-stac...@googlegroups.com.

To post to this group, send email to haskel...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages