Open dcharkes opened 8 years ago
Issue is the OCaml version, I was using 4.03.0
.
Workaround:
opam switch 4.01.0
opam install ocaml-top
Installed OCaml and OPAM via Homebrew today: ocaml: stable 4.02.3 (bottled) opam: stable 1.2.2 (bottled) encountered same problem. Workaround worked for me. Thx @dcharkes
However, I could not get Core to load. It does not look like ocaml-top reads the .ocamlinit file. By explicitly adding at the prompt:
I can then open Core.Std
Also, I am able to get ocaml-top to launch with a operational ocaml process under 4.02.3 by making sure my path is /Users/$USER/.opam/4.02.3/bin:$PATH instead of /Users/$USER/.opam/system/bin:$PATH (which is what my path was when I was originally having the problem described by @dcharkes above).
I got it to work with 4.02.1as well. So, it looks like it's a 4.03.0 specific problem.
@mpodell to load a module I passed an argument to the ocaml toplevel: ocaml-top --- -I ~/.opam/4.02.3/lib/adapton/
.
Your solution
#use "topfind";;
#require "adapton";;
open Adapton;;
also works, but you can not use #use
and #require
if you want to compile the code (stackoverflow).
This problem also exists with 4.02.3 Debian. The error is "correct" in the sense that .opam/system/bin/ocaml
is indeed not bytecode executable. Not sure why this should block ocaml-top from using it, though.
Sorry for replying so late. By default, ocaml-top
will try to run ocamlrun ocaml
-- which will only work with a bytecode version of the ocaml
exec. Distributions apparently moved to have ocaml
as a custom binary rather than pure bytecode, which break this.
Workaround: use ocaml-top -ocaml ocaml
The reason for originally running through ocamlrun
has to do with Windows support, which makes process control very hard. When calling ocaml
directly, there would be a new process spawned for ocamlrun
, and, processes being non-hierarchichal, we would lose the handle on the child ocaml process. That took me a while to figure out at the time. There wasn't at the moment a reason to do differently on other OSes, but we could now discriminate to run through ocamlrun or not.
Opening the editor gives me the following editor:
Running
/Users/myusername/.opam/system/bin/ocaml
in the terminal gives me a working OCaml REPL.Why can the editor not use the ocaml executable?