我如何要求 ocamlopt 链接到 glibc 2.5?
有没有办法让 ocamlopt 链接到 glibc 2.5,以便我可以在只有该版本库的机器上运行生成的二进制文件?
如果可以的话,我的机器上是否需要安装额外的软件包?我的机器没有 glibc 2.5。有一个包吗?
提前致谢。
Is there a way to ask ocamlopt to link against glibc 2.5 such that I can run the resulting binary on machines that have only that that version of the library?
If this were possible, are there additional packages I would have to install on my machine? My machine does not have glibc 2.5. Is there a package for that?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用以下 ocamlopt 标志来指定编译和链接的标志:
只要您知道如何要求 C 编译器以您想要的方式进行链接,您就可以使用这些标志来执行此操作。事实上,我建议按这个顺序解决问题。首先让它使用(简单的)C 程序,然后使用 ocamlopt。
是的,您需要安装链接器才能完成其工作的库。本质上,您希望您的系统看起来像目标系统(您希望代码运行的系统)。有关如何在系统上安装该库的建议,我建议在专门针对该系统的论坛中询问。
You can use the following ocamlopt flags to specify flags for compiling and linking:
As long as you know how to ask your C compiler to link in the way you want, you can use these flags to do it. In fact, I'd suggest solving the problem in this order. Get it working with a (trivial) C program first, then work with ocamlopt next.
Yes, you'll need to have the library installed for the linker to do its thing. In essence, you'll want your system to look like the target system (the one where you want your code to run). For suggestions on how to install the library on your system, I'd suggest asking in a forum dedicated to that system.
根据我的经验,最好使用基于 glibc-2.5 的系统获取 chroot 或 vm 并在那里编译可分发的二进制文件。
From my experience, it is better to get chroot or vm with glibc-2.5 based system and compile distributable binary there.