gpt4 book ai didi

haskell - 如何重新分发 wxHaskell 应用程序?

转载 作者:行者123 更新时间:2023-12-03 13:45:13 31 4
gpt4 key购买 nike

我正在使用 ghc 7.6.3。我从这里安装了 wxHaskell:https://github.com/wxHaskell/wxHaskell

它有效,示例程序编译并成功运行。

现在唯一的问题是我想在 mac OS X 上分发 wxHaskell 应用程序。我尝试使用 macosx-app 和 cabal-macosx ( https://github.com/michaelt/cabal-macosx ) 来制作“应用程序”文件。它在我的机器上运行良好,但无法在另一台计算机上运行。我收到以下错误:

Dyld Error Message: Library not loaded: /Users/user/.cabal/lib/wxc-0.90.1.0/ghc-7.6.3/libwxc.dylib.

我使用的是 OS X 10.8.4 (Mountain Lion),但我也有兴趣在 Windows 上编译应用程序并重新分发它们。

重新分发 wxHaskell 应用程序的最佳方式是什么?

安装程序.hs
-- Example Setup.hs for the wxHello app.

import Distribution.MacOSX
import Distribution.Simple

main :: IO ()
main = defaultMainWithHooks $ simpleUserHooks {
postBuild = appBundleBuildHook guiApps -- no-op if not MacOS X
}

guiApps :: [MacApp]
guiApps = [MacApp "WxHello"
(Just "resources/WxHello.icns")
Nothing -- Build a default Info.plist for the icon.
[] -- No other resources.
[] -- No other binaries.
ChaseWithDefaults -- Try changing to ChaseWithDefaults
]

wxHello.cabal:
Name:                   wxHello
Version: 0.1.0
Stability: Alpha
Synopsis: wxWidgets `Hello World' example for cabal-macosx
Description:
Example showing how to use cabal-macosx to build an application
bundle for a simple `Hello World' program using the wxWidgets GUI
toolkit.
Category: Data
License: BSD3
License-file: LICENSE
Copyright: Andy Gimblett <haskell@gimbo.org.uk>
Author: Andy Gimblett <haskell@gimbo.org.uk>
Maintainer: Andy Gimblett <haskell@gimbo.org.uk>
Build-Type: Custom
Cabal-Version: >=1.6

Executable WxHello
hs-source-dirs: src
Main-is: Main.hs
Build-Depends: base >= 3 && < 5, cabal-macosx, wx
ghc-options: -fwarn-tabs -threaded -Wall

以下是生成的包中的 dylib 文件:
WxHello.app $ find . | grep dylib
./Contents/Frameworks/Users/user/.cabal/lib/wxc-0.90.1.0/ghc-7.6.3/libwxc.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_baseu-2.9.5.0.0.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_baseu_net-2.9.5.0.0.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_baseu_xml-2.9.5.0.0.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_osx_cocoau_adv-2.9.5.0.0.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_osx_cocoau_aui-2.9.5.0.0.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_osx_cocoau_core-2.9.5.0.0.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_osx_cocoau_gl-2.9.5.0.0.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_osx_cocoau_html-2.9.5.0.0.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_osx_cocoau_propgrid-2.9.5.0.0.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_osx_cocoau_qa-2.9.5.0.0.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_osx_cocoau_ribbon-2.9.5.0.0.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_osx_cocoau_richtext-2.9.5.0.0.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_osx_cocoau_stc-2.9.5.0.0.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_osx_cocoau_webview-2.9.5.0.0.dylib
./Contents/Frameworks/Users/user/temp/wxWidgets-2.9.5/build-release/lib/libwx_osx_cocoau_xrc-2.9.5.0.0.dylib
./Contents/Frameworks/usr/lib/libc++abi.dylib
./Contents/Frameworks/usr/lib/libexpat.1.dylib
./Contents/Frameworks/usr/lib/libiconv.2.dylib
./Contents/Frameworks/usr/lib/libstdc++.6.dylib
./Contents/Frameworks/usr/lib/libz.1.dylib

最佳答案

我在 Windows 中使用 wxHaskell 制作的最后一个可再发行组件需要这些文件

  • mingwm10.dll
  • wxmws28u_gcc.dll

  • 与 .exe 位于同一文件夹中(不仅仅是我路径上的某个地方)。

    这是使用先前版本的 wxHaskell,它是针对先前版本的 wxWidgits 本身编译的,因此大概您需要 wx dll 中有 29 个而不是 28 个。

    我也用静态链接编译:
    ghc -static -optl-static -optl-mwindows Main -o Project.exe
    -optl-mwindows摆脱命令提示符窗口,否则它会出现在您的应用程序旁边。

    关于haskell - 如何重新分发 wxHaskell 应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18128262/

    31 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com