OCaml 安装,未找到二进制文件

发布于 2024-10-01 16:27:49 字数 382 浏览 4 评论 0原文

我正在尝试在远程 UNIX 服务器上安装并运行 Objective-caml。

我已成功构建并安装了 ocaml 包中包含的所有文件。但是,当尝试使用它时,例如:

[~]# ocamllex

给出:

-bash: /home1/PATHTOMYHOME/local/bin/ocamllex: /usr/local/bin/ocamlrun: bad interpreter: No such file or directory

有什么方法可以告诉它在其他地方查找ocamlrun吗?正确的目录位于 $PATH 变量中(ocamlrun 有效)。

I am attempting to install and run objective-caml on a remote unix server.

I have successfully built and installed all files included in the ocaml package. However, when attempting to use it, eg:

[~]# ocamllex

gives:

-bash: /home1/PATHTOMYHOME/local/bin/ocamllex: /usr/local/bin/ocamlrun: bad interpreter: No such file or directory

Is there any way to tell it to look somewhere else for ocamlrun? The correct directory is in the $PATH variable (ocamlrun works).

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

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

发布评论

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

评论(2

红衣飘飘貌似仙 2024-10-08 16:27:49

您可以将字节码文件的名称传递给 ocamlrun

/correct/path/to/ocamlrun /home1/PATHTOMYHOME/local/bin/ocamllex

或者,它可能只需要编辑字节码文件的第一行:有一个 #!以及那里的硬编码路径。文件的其余部分虽然是字节码,但如果您的编辑器不弄乱它,就有机会...

作为第三种解决方案,使用本机编译版本 ocamllex.opt:它确实不依赖ocamlrun

You can pass the name of the bytecode file to ocamlrun:

/correct/path/to/ocamlrun /home1/PATHTOMYHOME/local/bin/ocamllex

Alternately, it may just work to edit the first line of the bytecode file: there is a #! and a hardcoded path there. The rest of the file is bytecode though, but if your editor does not mess with it, there is a chance...

As a third solution, use the native-compiled version ocamllex.opt: it does not rely on ocamlrun.

删除会话 2024-10-08 16:27:49

在 Unix 系统上,Ocaml 字节码可执行文件以 shebang 行开头,该行给出了字节码解释器 (ocamlrun)。您的可执行文件似乎以 #!/usr/local/bin/ocamlrun 开头。将其更改为 /home1/PATHTOMYHOME/local/bin/ocamlrun

如果您希望在 $PATH 中查找 ocamlrun,请将 shebang 行更改为 #!/usr/bin/env ocamlrun

这是一种更改当前目录中字节码可执行文件的路径,同时保持其他文件不变的方法。检查替换工作后,删除 *.orig 文件。

perl -i.orig -pe 's~^#!.*/ocamlrun.*~#!/usr/bin/env ocamlrun~ if $.==1; close ARGV if eof' *

我建议您使用 ./configure -prefix /home1/PATHTOMYHOME/local 编译 OCaml。这样所有程序都会自动在正确的目录中查找。

On unix systems, Ocaml bytecode executables begin with a shebang line that gives the path to the bytecode interpreter (ocamlrun). It seems that your executables start with #!/usr/local/bin/ocamlrun. Change this to /home1/PATHTOMYHOME/local/bin/ocamlrun.

If you want ocamlrun to be looked up in the $PATH, change the shebang line to #!/usr/bin/env ocamlrun.

Here's a way to change the path to the bytecode executables in the current directories, leaving other files intact. Remove the *.orig files once you've checked the replacement works.

perl -i.orig -pe 's~^#!.*/ocamlrun.*~#!/usr/bin/env ocamlrun~ if $.==1; close ARGV if eof' *

I suggest that you compile OCaml with ./configure -prefix /home1/PATHTOMYHOME/local. That way all programs will look in the right directories automatically.

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