Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ocaml is not a bytecode executable file (OSX) #55

Open
dcharkes opened this issue Jun 9, 2016 · 7 comments
Open

ocaml is not a bytecode executable file (OSX) #55

dcharkes opened this issue Jun 9, 2016 · 7 comments

Comments

@dcharkes
Copy link

dcharkes commented Jun 9, 2016

Opening the editor gives me the following editor:

Fatal error: the file '/Users/myusername/.opam/system/bin/ocaml' is not a bytecode executable file
.
**********************************************

Error: ocaml process not operational.
Please check your installation and parameters
**********************************************

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?

@dcharkes
Copy link
Author

dcharkes commented Jun 9, 2016

Issue is the OCaml version, I was using 4.03.0.

Workaround:
opam switch 4.01.0
opam install ocaml-top

@mpodell
Copy link

mpodell commented Jun 13, 2016

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

@mpodell
Copy link

mpodell commented Jun 13, 2016

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:
#use "topfind";;
#camlp4o;;
#thread;;
#require "core";;
#require "core.top";;
#require "core.syntax";;

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).

@dcharkes
Copy link
Author

I got it to work with 4.02.1as well. So, it looks like it's a 4.03.0 specific problem.

@dcharkes
Copy link
Author

@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).

@infinity0
Copy link

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.

@AltGr
Copy link
Member

AltGr commented Oct 4, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants