未绑定模块核心

时间:2016-02-11 14:48:18

标签: ocaml opam

在OS X下,OCaml工作正常,但在Linux(Ubuntu 14.04 LTS)下,它返回以下错误:

zsh-5.0% ocaml
        OCaml version 4.02.1

Findlib has been successfully loaded. Additional directives:
  #require "package";;      to load a package
  #list;;                   to list the available packages
  #camlp4o;;                to load camlp4 (standard syntax)
  #camlp4r;;                to load camlp4 (revised syntax)
  #predicates "p,q,...";;   to set these predicates
  Topfind.reset();;         to force that packages will be reloaded
  #thread;;                 to enable threads

/home/cacilhas/.opam/4.02.1/lib/ocaml/dynlink.cma: loaded
/home/cacilhas/.opam/4.02.1/lib/ocaml/camlp4: added to search path
/home/cacilhas/.opam/4.02.1/lib/ocaml/camlp4/camlp4o.cma: loaded
Cannot find file /home/cacilhas/.opam/4.02.1/lib/ocaml/camlp4/camlp4o.cma.
/home/cacilhas/.opam/4.02.1/lib/ocaml/threads: added to search path
/home/cacilhas/.opam/4.02.1/lib/ocaml/unix.cma: loaded
/home/cacilhas/.opam/4.02.1/lib/ocaml/threads/threads.cma: loaded
No such package: core.top
No such package: core.syntax
File ".ocamlinit", line 13, characters 5-13:
Error: Unbound module Core

这些行应突出显示:

No such package: core.top
No such package: core.syntax

有什么想法吗?

根据卡卡杜的要求,这是我的.ocamlinit

zsh-5.0% cat .ocamlinit 
(* Added by OPAM. *)
let () =
  try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
  with Not_found -> ()
;;

#use "topfind";;
#camlp4o;;
#thread;;
#require "core.top";;
#require "core.syntax";;

open Core.Std;;

query core的输出是:

zsh-5.0% ocamlfind query core
ocamlfind: Package `core' not found

更新

尝试安装core(OCaml 4.02.1):

zsh-5.0% opam install core          
The following actions will be performed:
  ∗  install ounit              2.0.0         [required by pa_ounit]
  ∗  install type_conv          112.01.02     [required by comparelib, bin_prot, pa_structural_sexp]
  ∗  install pipebang           110.01.00     [required by core]
  ∗  install herelib            112.35.00     [required by core]
  ∗  install variantslib        109.15.03     [required by core]
  ∗  install sexplib            112.35.00     [required by core]
  ∗  install pa_ounit           112.35.00     [required by core]
  ∗  install fieldslib          109.20.03     [required by core]
  ∗  install enumerate          111.08.00     [required by core]
  ∗  install comparelib         109.60.00     [required by core]
  ∗  install bin_prot           112.35.00     [required by core]
  ∗  install pa_structural_sexp 112.35.00     [required by core]
  ∗  install pa_bench           112.06.00     [required by core]
  ∗  install custom_printf      112.24.00     [required by core]
  ∗  install pa_test            112.24.00     [required by core]
  ∗  install typerep            112.35.00     [required by core_kernel]
  ∗  install core_kernel        112.35.00     [required by core]
  ∗  install core               112.35.01
===== ∗  18 =====
Do you want to continue ? [Y/n] y

=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[bin_prot] Archive in cache
[comparelib] Archive in cache
[core] Archive in cache
[core_kernel] Archive in cache
[custom_printf] Archive in cache
[enumerate] Archive in cache
[fieldslib] Archive in cache
[herelib] Archive in cache
[ounit] Archive in cache
[pa_bench] Archive in cache
[pa_ounit] Archive in cache
[pa_structural_sexp] Archive in cache
[pa_test] Archive in cache
[pipebang] Archive in cache
[sexplib] Archive in cache
[type_conv] Archive in cache
[typerep] Archive in cache
[variantslib] Archive in cache

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ERROR] The compilation of herelib failed at "make".
[ERROR] The compilation of pipebang failed at "make".
[ERROR] The compilation of type_conv failed at "make".
[ERROR] The compilation of ounit failed at "make build".
Processing 13/18: [ounit: ocamlfind remove]
#=== ERROR while installing herelib.112.35.00 =================================#
# opam-version 1.2.2
# os           linux
# command      make
# path         /home/cacilhas/.opam/4.02.1/build/herelib.112.35.00
# compiler     4.02.1
# exit-code    2
# env-file     /home/cacilhas/.opam/4.02.1/build/herelib.112.35.00/herelib-29247-e4db2f.env
# stdout-file  /home/cacilhas/.opam/4.02.1/build/herelib.112.35.00/herelib-29247-e4db2f.out
# stderr-file  /home/cacilhas/.opam/4.02.1/build/herelib.112.35.00/herelib-29247-e4db2f.err
### stdout ###
# [...]
# Compiler support generation of .cmxs.: ............... true
# OCamlbuild additional flags: ......................... 
# Create documentations: ............................... true
# Compile tests executable and library and run them: ... false
# camlp4o: ............................................. /home/cacilhas/.opam/4.02.1/bin/camlp4o
# pkg_camlp4_lib: ...................................... /home/cacilhas/.opam/4.02.1/lib/ocaml/camlp4
# pkg_camlp4_quotations: ............................... /home/cacilhas/.opam/4.02.1/lib/ocaml/camlp4
# pkg_camlp4_extend: ................................... /home/cacilhas/.opam/4.02.1/lib/ocaml/camlp4
# 
# ./setup.exe -build 
### stderr ###
# E: Invalid_argument("bool_of_string")
# make: ** [build] Erro 1


#=== ERROR while installing ounit.2.0.0 =======================================#
# opam-version 1.2.2
# os           linux
# command      make build
# path         /home/cacilhas/.opam/4.02.1/build/ounit.2.0.0
# compiler     4.02.1
# exit-code    2
# env-file     /home/cacilhas/.opam/4.02.1/build/ounit.2.0.0/ounit-29247-2dea01.env
# stdout-file  /home/cacilhas/.opam/4.02.1/build/ounit.2.0.0/ounit-29247-2dea01.out
# stderr-file  /home/cacilhas/.opam/4.02.1/build/ounit.2.0.0/ounit-29247-2dea01.err
### stdout ###
# [...]
# Turn ocaml profile flag on: .......................... /home/cacilhas/bin/profile
# Compiler support generation of .cmxs.: ............... true
# OCamlbuild additional flags: ......................... 
# Create documentations: ............................... true
# Compile tests executable and library and run them: ... false
# pkg_unix: ............................................ /home/cacilhas/.opam/4.02.1/lib/ocaml
# pkg_threads: ......................................... /home/cacilhas/.opam/4.02.1/lib/ocaml
# ocamldoc: ............................................ /home/cacilhas/.opam/4.02.1/bin/ocamldoc
# 
# ocaml setup.ml -build 
### stderr ###
# [...]
# Warning 3: deprecated: Lazy.lazy_from_fun
# Use Lazy.from_fun instead.
# File "/home/gildor/programmation/oasis/src/oasis/OASISString.ml", line 118, characters 8-26:
# Warning 3: deprecated: String.set
# Use Bytes.set instead.
# File "/home/gildor/programmation/oasis/src/oasis/OASISFindlib.ml", line 256, characters 6-24:
# Warning 3: deprecated: Lazy.lazy_from_fun
# Use Lazy.from_fun instead.
# E: Invalid_argument("bool_of_string")
# make: ** [build] Erro 1


#=== ERROR while installing pipebang.110.01.00 ================================#
# opam-version 1.2.2
# os           linux
# command      make
# path         /home/cacilhas/.opam/4.02.1/build/pipebang.110.01.00
# compiler     4.02.1
# exit-code    2
# env-file     /home/cacilhas/.opam/4.02.1/build/pipebang.110.01.00/pipebang-29247-ad6566.env
# stdout-file  /home/cacilhas/.opam/4.02.1/build/pipebang.110.01.00/pipebang-29247-ad6566.out
# stderr-file  /home/cacilhas/.opam/4.02.1/build/pipebang.110.01.00/pipebang-29247-ad6566.err
### stdout ###
# [...]
# Compiler support generation of .cmxs.: ............... true
# OCamlbuild additional flags: ......................... 
# Create documentations: ............................... true
# Compile tests executable and library and run them: ... false
# camlp4o: ............................................. /home/cacilhas/.opam/4.02.1/bin/camlp4o
# pkg_camlp4_extend: ................................... /home/cacilhas/.opam/4.02.1/lib/ocaml/camlp4
# pkg_camlp4_lib: ...................................... /home/cacilhas/.opam/4.02.1/lib/ocaml/camlp4
# pkg_camlp4_quotations: ............................... /home/cacilhas/.opam/4.02.1/lib/ocaml/camlp4
# 
# ./setup.exe -build 
### stderr ###
# File "setup.ml", line 232, characters 8-26:
# Warning 3: deprecated: String.set
# Use Bytes.set instead.
# File "setup.ml", line 2391, characters 6-24:
# Warning 3: deprecated: Lazy.lazy_from_fun
# Use Lazy.from_fun instead.
# E: Invalid_argument("bool_of_string")
# make: ** [build] Erro 1


#=== ERROR while installing type_conv.112.01.02 ===============================#
# opam-version 1.2.2
# os           linux
# command      make
# path         /home/cacilhas/.opam/4.02.1/build/type_conv.112.01.02
# compiler     4.02.1
# exit-code    2
# env-file     /home/cacilhas/.opam/4.02.1/build/type_conv.112.01.02/type_conv-29247-dc6e87.env
# stdout-file  /home/cacilhas/.opam/4.02.1/build/type_conv.112.01.02/type_conv-29247-dc6e87.out
# stderr-file  /home/cacilhas/.opam/4.02.1/build/type_conv.112.01.02/type_conv-29247-dc6e87.err
### stdout ###
# [...]
# Turn ocaml profile flag on: .......................... /home/cacilhas/bin/profile
# Compiler support generation of .cmxs.: ............... true
# OCamlbuild additional flags: ......................... 
# Create documentations: ............................... true
# Compile tests executable and library and run them: ... false
# camlp4o: ............................................. /home/cacilhas/.opam/4.02.1/bin/camlp4o
# pkg_camlp4_quotations: ............................... /home/cacilhas/.opam/4.02.1/lib/ocaml/camlp4
# pkg_camlp4_extend: ................................... /home/cacilhas/.opam/4.02.1/lib/ocaml/camlp4
# 
# ./setup.exe -build 
### stderr ###
# E: Invalid_argument("bool_of_string")
# make: ** [build] Erro 1



=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions were aborted
  ∗  install bin_prot           112.35.00
  ∗  install comparelib         109.60.00
  ∗  install core               112.35.01
  ∗  install core_kernel        112.35.00
  ∗  install custom_printf      112.24.00
  ∗  install enumerate          111.08.00
  ∗  install fieldslib          109.20.03
  ∗  install pa_bench           112.06.00
  ∗  install pa_ounit           112.35.00
  ∗  install pa_structural_sexp 112.35.00
  ∗  install pa_test            112.24.00
  ∗  install sexplib            112.35.00
  ∗  install typerep            112.35.00
  ∗  install variantslib        109.15.03
The following actions failed
  ∗  install herelib   112.35.00
  ∗  install ounit     2.0.0    
  ∗  install pipebang  110.01.00
  ∗  install type_conv 112.01.02
No changes have been performed

根据@Stas的要求,我的env输出:

XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_CONFIG_DIRS=/etc/xdg/xdg-i3:/etc/xdg
LANG=pt_BR.UTF-8
DISPLAY=:0
SHLVL=1
LOGNAME=cacilhas
LANGUAGE=pt_BR:pt:en
MANDATORY_PATH=/usr/share/gconf/i3.mandatory.path
GNOME_KEYRING_PID=1708
XDG_VTNR=7
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/cacilhas
XAUTHORITY=/home/cacilhas/.Xauthority
QT_QPA_PLATFORMTHEME=appmenu-qt5
GTK_IM_MODULE=ibus
COLORTERM=gnome-terminal
XDG_SESSION_ID=c2
PWD=/home/cacilhas
DESKTOP_SESSION=i3
DEFAULTS_PATH=/usr/share/gconf/i3.default.path
TEXTDOMAIN=im-config
GNOME_KEYRING_CONTROL=/run/user/1001/keyring-oJXb7Q
TEXTDOMAINDIR=/usr/share/locale/
GDMSESSION=i3
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-xXu7Nzcp17,guid=bce1c10abb5c9942bf5579d456bc7f20
VTE_VERSION=3409
CLUTTER_IM_MODULE=xim
XDG_DATA_DIRS=/usr/share/i3:/usr/local/share/:/usr/share/
QT4_IM_MODULE=xim
GDM_LANG=pt_BR
SHELL=/usr/bin/zsh
QT_IM_MODULE=ibus
WINDOWID=48234506
SSH_AGENT_PID=1784
GTK_MODULES=overlay-scrollbar
SSH_AUTH_SOCK=/tmp/ssh-7R2eNIzpUVN2/agent.1712
TERM=xterm
PATH=/home/cacilhas/.opam/4.02.1/bin:/home/cacilhas/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/cacilhas/bin:/opt/fstar/bin:/home/cacilhas/.cabal/bin:/home/cacilhas/bin/ioke-0.4/bin:/opt/nodejs/bin:/home/cacilhas/bin/idea-IC/bin:/opt/mongodb/bin:/opt/pypy3/bin:/opt/local/qt/5.5/gcc_64/bin:/opt/local/qt/Tools/QtCreator/bin:/opt/sage/bin
HOME=/home/cacilhas
XDG_SEAT=seat0
XMODIFIERS=@im=ibus
XDG_RUNTIME_DIR=/run/user/1001
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
USER=cacilhas
OLDPWD=/home/cacilhas
script=/home/cacilhas/bin/profile/xdg.zsh
AUTOENV_AUTH_FILE=/home/cacilhas/.autoenv_authorized
__array_offset=0
EDITOR=/usr/bin/gvim
FSTAR_HOME=/opt/fstar
GITSH=/home/cacilhas/bin/profile/git.sh
GIT_EDITOR=gvim -f
COMP_WORDBREAKS=:
__git_merge_strategies=
__git_all_commands=
__git_porcelain_commands=
__git_whitespacelist=nowarn warn error error-all fix
__git_diff_common_options=--stat --numstat --shortstat --summary
            --patch-with-stat --name-only --name-status --color
            --no-color --color-words --no-renames --check
            --full-index --binary --abbrev --diff-filter=
            --find-copies-harder
            --text --ignore-space-at-eol --ignore-space-change
            --ignore-all-space --exit-code --quiet --ext-diff
            --no-ext-diff
            --no-prefix --src-prefix= --dst-prefix=
            --inter-hunk-context=
            --patience
            --raw
            --dirstat --dirstat= --dirstat-by-file
            --dirstat-by-file= --cumulative

__git_mergetools_common=diffuse ecmerge emerge kdiff3 meld opendiff
            tkdiff vimdiff gvimdiff xxdiff araxis p4merge bc3

__git_fetch_options=
    --quiet --verbose --append --upload-pack --force --keep --depth=
    --tags --no-tags --all --prune --dry-run

__git_log_common_options=
    --not --all
    --branches --tags --remotes
    --first-parent --merges --no-merges
    --max-count=
    --max-age= --since= --after=
    --min-age= --until= --before=
    --min-parents= --max-parents=
    --no-min-parents --no-max-parents

__git_log_gitk_options=
    --dense --sparse --full-history
    --simplify-merges --simplify-by-decoration
    --left-right --notes --no-notes

__git_log_shortlog_options=
    --author= --committer= --grep=
    --all-match

__git_log_pretty_formats=oneline short medium full fuller email raw format:
__git_log_date_formats=relative iso8601 rfc2822 short local default raw
__git_merge_options=
    --no-commit --no-stat --log --no-log --squash --strategy
    --commit --stat --no-squash --ff --no-ff --ff-only --edit --no-edit

__git_send_email_confirm_options=always never auto cc compose
__git_send_email_suppresscc_options=author self cc bodycc sob cccmd body all
IOKE_HOME=/home/cacilhas/bin/ioke-0.4
NODE_HOME=/opt/nodejs
_JAVA_OPTIONS=-Dawt.useSystemAAFontSettings=gasp -Dswing.aatext=true -Dsun.java2d.xrander=true
JAVA_FONTS=/usr/share/fonts/truetype
JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre
LUA_PATH=/usr/share/lua/jit/?.lua;/usr/share/lua/jit/?.lc;/usr/share/lua/jit/?/init.lua;/usr/share/lua/jit/?/init.lc;/usr/share/luajit-2.0.2/?.lua
LUA_CPATH=/usr/lib/lua/jit/l?.so;/usr/lib/lua/jit/?.so;/usr/lib/lua/jit/?/l?.so
MANPATH=:/home/cacilhas/.opam/4.02.1/man:/usr/share/man:/usr/local/man:/usr/local/share/man
NVM_DIR=/home/cacilhas/.nvm
NVM_CD_FLAGS=-q
NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist
NVM_IOJS_ORG_MIRROR=https://iojs.org/dist
NVM_IOJS_ORG_VERSION_LISTING=https://iojs.org/dist/index.tab
VERSION=
NVM_RC_VERSION=
OCAML_TOPLEVEL_PATH=/home/cacilhas/.opam/4.02.1/lib/toplevel
PERL5LIB=/home/cacilhas/.opam/4.02.1/lib/perl5:
CAML_LD_LIBRARY_PATH=/home/cacilhas/.opam/4.02.1/lib/stublibs
PHANTOMJS=/usr/bin/phantomjs
pgconnect=psql -h dumbo.oraculo.sieve.com.br -U matching -d matching -W
profile=/home/cacilhas/bin/profile
LOCALSZ=524288
TRAILSZ=131072
GLOBALSZ=1048576
ZVERSION=5.0
PROMPT=
%E%{[01;34m%}────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────%{[00m%}
%{[33m%}[%w, 20%D %T] %{[00m%}
%E%{%(0?.[32m⚕.[31m☣)%} %{[00m%}%{[01;32m%}%n@%m%{[01;33m%}%{[01;36m%}%~%{[00m%}
%E%{[33m%}zsh-5.0%{[01;33m%}%# %{[00m%}
PIP_DOWNLOAD_CACHE=/home/cacilhas/.pip/download-cache
QT_HOME=/opt/local/qt
RLWRAP_HOME=/home/cacilhas/.local/share/rlwrap
ZSH_HIGHLIGHT_VERSION=0.4.1-dev
ZSH_HIGHLIGHT_REVISION=HEAD
GREP_OPTIONS=--colour=auto
GREP_COLOR=1;32
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=/home/cacilhas/.history
BROWSER=opera
_=/usr/bin/env

2 个答案:

答案 0 :(得分:2)

这显然是一些环境问题。我已经在新的Ubuntu 14.04上安装了OPAM,一切都很好。

asciicast

答案 1 :(得分:0)

首先,如果你真的不需要核心库,那么你可以从.ocamlinit文件中删除这一行:

#camlp4o;;
#thread;;
#require "core.top";;
#require "core.syntax";;

open Core.Std;;

然后一切都会正常。

下一个问题是安装。它看起来像oasis包的一个严重问题,它是许多软件包使用的最流行的工具之一。所以这个问题可能会再次发生,最好能够治愈它。我建议你尝试以下方法:

  1. 确保您的opam环境已正确激活。你的shell的rc脚本通常会这样做,但是输入并不难,

    eval `opam config env`
    opam install core
    
  2. 尝试将oasis固定到最新版本(可能由于某种原因,您有一个不起作用的旧版oasis(这仍然是oasis中的一个问题包,应该报告和修复)。固定后,你需要尝试再次安装核心:

     opam pin add oasis 0.4.5
     opam install core
    
  3. 如果您在上一点失败,请尝试安装ocaml编译器的最新版本(至2016年2月)

     opam init --comp 4.02.3
     eval `opam config env`
     opam install core