在堆栈外环境中执行错误,在Windows上使用text-icu

时间:2017-03-04 23:54:50

标签: windows haskell dll icu haskell-stack

我写了一些代码。并在好人的帮助下修正了一些错误。 现在,此实用程序(samChecker-exe.exe)在Stack环境中正常工作。 这个实用程序使用text-icu,我在windows上编写了这个实用程序。当然,我想在其他Windows操作系统上使用此实用程序。

我将%stackPath%.stack-work \ install \〜\ bin \ samCheceker-exe.exe复制到其他文件夹,并通过CMD执行。 但是我收到错误消息“libicuuc57.dll不存在。所以程序无法启动。请重新安装程序。” 我复制了libicuuc57.dll,所以...就像编程新手一样,但失败了。 “stack install”命令也是一样的结果。 (我在windows上安装了text-icu并安装了ICU lib。输入文件以“MS949”编码)

在Francesco Ariis的帮助下(beginners@haskell.org),我挺身而出。 但仍然收到错误消息。

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

[堆栈路径]结果

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

根据第一条错误消息(libicuuc57.dll不存在。所以程序无法启动。请重新安装程序。),我找到了libicuuc57.dll的路径,并重新设置了额外的库 - 显示目录。

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"

但得到了相同的结果。

libicuuc75.dll,libicuin57.dll等文件位于C:\ Users \ shaeg \ AppData \ Local \ Programs \ stack \ x86_64-windows \ msys2-20150512 \ mingw64 \ bin

有人说,这是Linker Acting。 我该如何解决这个错误? 非常感谢你。

此致,S。Chang。

这是我的堆栈路径。

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

1 个答案:

答案 0 :(得分:0)

我最近能够测试它并分享我的解决方案。

首先,我假设安装了libgcc_s_seh-1.dll libicudt57.dll libicuin57.dll libicuuc57.dll libstdc++-6.dll libwinpthread-1.dll包的最新msys2的环境。

动态链接

动态链接的可执行文件在堆栈的msys2 mingw64/bin路径下具有与text-icu的依赖关系。如果您已经构建了动态链接可执行文件,则将所有这些文件复制到同一目录将解决问题。

我的评论中的

Dependency walker可以帮助揭示所有这些依赖关系。

静态链接

目前text-icu-0.7.0.1包似乎不支持静态链接。所以我们应该自己修改它。如果您不知道如何将其放入本地包中,请注意this的第三个选项。

extra-libraries的.cabal文件 extra-libraries: sicuin sicuuc sicudt -- if os(mingw32) -- extra-libraries: icuin icudt -- else -- extra-libraries: icui18n icudata 部分修改为以下内容。

-pgmlC:\Users\[USERNAME]\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.2\mingw\bin\g++.exe

ghc-options附加到可执行文件的stack build cabal条目中。这是链接到ICU的C ++符号所必需的。

然后只做.partners_section_container { display: table; height: 65px; text-align: center; } .x-content-band { margin: 0 0 0.15em; padding: 40px 0; } .x-container.max.width.wpb_row { display: table-cell; vertical-align: middle; text-align: center; } .partner_logos { margin-bottom: 40px; display: table-cell; vertical-align: middle; text-align: center; } .partner_logo1 { padding: 15px; display: table-cell; vertical-align: middle; text-align: center; margin-left: auto; margin-right: auto; width: 14%; }