Reputation: 2902
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).
Upvotes: 6
Views: 1355
Reputation: 107759
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.
Upvotes: 2
Reputation: 80276
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
.
Upvotes: 2