2017-08-16 78 views
2

我有一些問題,建立我的OCaml的環境設置,和我下面這個頁面:OPAM和OCaml的安裝

https://github.com/realworldocaml/book/wiki/Installation-Instructions

不過,我有一些問題,我解決不了。我在macOS 10.12.5上使用zsh。

Brew安裝opam時沒有錯誤或警告。我相信我的問題是環境變量(??)不同步。這裏有一些輸出,當我運行一些建議的命令:

OPAM開關:

--  -- 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配置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安裝基:

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 

對於這個問題的目的,我展示了我的安裝基地的嘗試,但最終想安裝核心,utop,綠洲等...任何幫助,非常感謝!

編輯:當我應該使用反引號(`)時,我使用了撇號(')。我想,一個沒有經驗的shell用戶的證據......

+0

您是否嘗試先運行「opam update」和「opam upgrade」? – soupault

+0

是的,只是試過這些並再次運行eval。仍然有像以前一樣的問題 –

回答

3

如果你有困難就找到了你應該使用反引號(發現許多鍵盤按鍵1的左側)當你做

eval `opam config env` 

反引號,那麼你可以使用其他的shell語法

eval $(opam config env) 

注:此命令不會打印出任何東西,你看到的環境變量的值的事實表明,我們在調用它錯了(這個變量應該是由殼看到)。

+0

哇,我感到很傻。這似乎解決了我所有的問題。非常感謝! –