构建独立的 OCaml 程序

发布于 2024-10-20 13:20:59 字数 509 浏览 9 评论 0原文

当我试图理解如何在 OCaml 中生成不需要任何太具体的东西(例如安装任何 OCaml 构建工具)的二进制文件时,我变得很疯狂。

我正在使用 OMake,在我的机器上工作时一切看起来都足够酷,而且链接库也

OCAMLPACKS[] = str unix batteries

工作得很好,但是如果我尝试分发可执行文件,它会给我以下错误:

Fatal error: exception Sys_error("/usr/godi/share/camomile/database/general_category.mar: No such file or directory")

是的,我正在使用 GODI,但我没有看到这个错误的任何明显原因,有人能启发我吗?另外,如果您有关于构建独立应用程序的任何技巧,请告诉我(我已经与 GODI 争论,GODI 仅在 x64 版本中编译了 everylib,现在我无法生成 x86 可执行文件)

提前致谢

I'm getting crazy while trying to understand how to produce a binary in OCaml that doesn't need anything too specific (eg. having anything as OCaml build tools installed).

I'm using OMake and everything seems enough cool while working on my machine, also linking libs with

OCAMLPACKS[] = str unix batteries

works quite well, but if I try to distribute the executable it gives me the following error:

Fatal error: exception Sys_error("/usr/godi/share/camomile/database/general_category.mar: No such file or directory")

yes I'm using GODI but I don't see any apparent reason for this error, can anyone enlighten me? In addition, if you have any tricks regarding building stand-alone applications please tell me (I'm already arguing with GODI that compiled everylib just in its x64 version and now I'm unable to produce x86 executables)

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小梨窩很甜 2024-10-27 13:20:59

camomile 库需要运行时配置。有关如何设置的信息,请参阅 README.txt
特别是,它需要运行时文件(您看到的缺少的 .mar)才能正常工作。

The camomile library requires runtime configuration. See README.txt for informations about how to set it up.
In particular, it requires runtime files (the missing .mar you see) to correctly work.

顾铮苏瑾 2024-10-27 13:20:59

我不使用 OMake、电池、GODI 和 Camomile。但从我看来,问题似乎来自这样一个事实:您链接到电池,我猜电池必须在内部使用甘菊,而甘菊依赖存储在文件系统中的数据来提供其某些服务。如果最终主机上不存在该数据,则加载失败。

请注意,使用 OCaml 传送纯静态可执行文件相当简单。但为此,您需要考虑使用哪些库(例如,如果您使用camomille,则必须附带支持文件)。

I don't use OMake, neither batteries, neither GODI nor Camomile. But from what I see the problem seems to come from the fact that you link against Batteries which I guess must use Camomile internally and Camomile relies on data stored in the file system to provide some of its service. It fails to load if that data is not present on the final host.

Note that shipping purely static excutables is something that is fairly simple to do with OCaml. But for that you need to consider which libraries you use (e.g. if you use camomille you will have to ship the support files with).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文