I'm having some problems setting up my OCaml environment set up, and am following this page:
https://github.com/realworldocaml/book/wiki/Installation-Instructions
However, I'm having some problems that I can't resolve. I'm on macOS 10.12.5 and am using zsh.
Brew installs opam with no errors or warnings. I believe my problems are with environment variables (??) not being in sync. Here are some outputs when I run some suggested commands:
opam switch:
-- -- 4.04.2 Official 4.04.2 release
-- -- 4.05.0 Official 4.05.0 release
system C system System compiler (4.05.0)
# 251 more patched or experimental compilers, use '--all' to show
[WARNING] The environment is not in sync with the current switch.
You should run: eval `opam config env`
eval 'opam config env':
CAML_LD_LIBRARY_PATH="/Users/Alex/.opam/system/lib/stublibs:/usr/local/lib/ocaml/stublibs"; export CAML_LD_LIBRARY_PATH;
OPAMUTF8MSGS="1"; export OPAMUTF8MSGS;
MANPATH="/Users/Alex/.opam/system/man:"; export MANPATH;
PERL5LIB="/Users/Alex/.opam/system/lib/perl5"; export PERL5LIB;
OCAML_TOPLEVEL_PATH="/Users/Alex/.opam/system/lib/toplevel"; export OCAML_TOPLEVEL_PATH;
PATH="/Users/Alex/.opam/system/bin:/usr/local/opt/opencv3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/MacGPG2/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS"; export PATH;
opam install base:
The following actions will be performed:
∗ install sexplib v0.9.2 [required by base]
∗ install base v0.9.3
===== ∗ 2 =====
Do you want to continue ? [Y/n] y
=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[base] Archive in cache
[sexplib] Archive in cache
=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ERROR] The compilation of sexplib failed at "jbuilder build -p sexplib -j 4".
#=== ERROR while installing sexplib.v0.9.2 ====================================#
# opam-version 1.2.2
# os darwin
# command jbuilder build -p sexplib -j 4
# path /Users/Alex/.opam/system/build/sexplib.v0.9.2
# compiler system (4.05.0)
# exit-code 127
# env-file /Users/Alex/.opam/system/build/sexplib.v0.9.2/sexplib-35995-e7966f.env
# stdout-file /Users/Alex/.opam/system/build/sexplib.v0.9.2/sexplib-35995-e7966f.out
# stderr-file /Users/Alex/.opam/system/build/sexplib.v0.9.2/sexplib-35995-e7966f.err
=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions were aborted
∗ install base v0.9.3
The following actions failed
∗ install sexplib v0.9.2
No changes have been performed
For the question's purpose I am showing my attempt at installing base, but would eventually like to install core, utop, oasis etc... Any help is greatly appreciated!
EDIT: I was using apostrophes (') when I should have been using backticks (`). Evidence of an inexperienced shell user I suppose...
You should use backticks (found to the left of the key 1
on many keyboards) when you're doing
eval `opam config env`
If you have trouble finding the backticks, then you can use an alternative shell syntax
eval $(opam config env)
Note: this command shouldn't print anything, the fact that you see the values of environment variables indicates that you're calling it wrong (this variables should be seen by the shell).