OCaml 安装,未找到二进制文件
我正在尝试在远程 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将字节码文件的名称传递给
ocamlrun
:或者,它可能只需要编辑字节码文件的第一行:有一个 #!以及那里的硬编码路径。文件的其余部分虽然是字节码,但如果您的编辑器不弄乱它,就有机会...
作为第三种解决方案,使用本机编译版本
ocamllex.opt
:它确实不依赖ocamlrun
。You can pass the name of the bytecode file to
ocamlrun
: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 onocamlrun
.在 Unix 系统上,Ocaml 字节码可执行文件以 shebang 行开头,该行给出了字节码解释器 (
ocamlrun
)。您的可执行文件似乎以#!/usr/local/bin/ocamlrun
开头。将其更改为/home1/PATHTOMYHOME/local/bin/ocamlrun
。如果您希望在
$PATH
中查找ocamlrun
,请将 shebang 行更改为#!/usr/bin/env ocamlrun
。这是一种更改当前目录中字节码可执行文件的路径,同时保持其他文件不变的方法。检查替换工作后,删除
*.orig
文件。我建议您使用
./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.I suggest that you compile OCaml with
./configure -prefix /home1/PATHTOMYHOME/local
. That way all programs will look in the right directories automatically.