在其他机器上运行wxHaskell
我已经编译了使用wxHaskell库的haskell程序,现在我想知道如何让它在其他没有安装wxHaskell的机器上运行。当然,我可以看到错误,我可以复制输出中写入的 dll 并将它们复制到该机器,但是什么是专业解决方案,我可以编写任何安装程序或类似的东西吗?
谢谢你的帮助
I've compiled haskell program which uses wxHaskell library, now I would like to know how to make it run on other machines which doesn't have wxHaskell installed. Of course I can see errors and I can copy dlls written in output and copy them to that machine but what is professioal sollution, can I write any installer or something like that?
thanks for help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您将需要完全静态链接您的可执行文件。如何执行此操作因系统而异,但通常涉及将 -static 标志传递给 GHC,并将 -optl-static 传递给链接器。
You will need to fully statically link your executable. How to do this varies from system to system, but in general involves passing the -static flag to GHC, and -optl-static to your linker.
如果您使用最近的 cabalized wxHaskell 实现,这非常容易,因为几乎所有内容都是静态链接的。
我使用 InnoSetup,它是开源的,并且运行良好。我的脚本至少需要以下内容:
除 DefaultDirName 之外的所有路径都是开发计算机上的路径。
关键项目是您的 wxWidgets DLL(可能是多个 DLL,具体取决于您构建 wxWidgets 的方式 - 我推荐并使用整体选项,它创建单个 DLL,wxmsw28u_gcc_custom.dll)和您的应用程序二进制文件。
如果您要链接到任何其他库,您也将需要它们。 Windows 上的许多第 3 方库都需要 msvcrt.dll,这就是我提到它的原因。
If you use the recent cabalized wxHaskell implementations, it's pretty easy, since almost everything is statically linked.
I use InnoSetup, which is Open Source, and works very well. My script needs at least the following:
All of the paths except DefaultDirName are paths on your development machine.
The key items are your wxWidgets DLL (may be multiple DLLs, depending on how you built wxWidgets - I recommend and use the monolithic option, which creates a single DLL, wxmsw28u_gcc_custom.dll) and your application binary.
If you are linking to any other libraries, you will need them as well. Many 3rd party libraries on Windows require msvcrt.dll, which is why I've mentioned it.