简体   繁体   中英

Unbound module Core

Under OS X, OCaml works fine, but under Linux (Ubuntu 14.04 LTS), it returns the following error:

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

These lines should be highlighted:

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

Any ideas?


As required by Kakadu, here is my .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;;

The output of query core is:

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

Update:

Trying to install 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

As requested by @Stas, my env output:

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

This is obviously some environment problem. I've installed OPAM on the fresh new Ubuntu 14.04 , and everything is just fine.

See

航天员

First of all if you really don't need the Core library, then you can just remove this lines from your .ocamlinit file:

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

open Core.Std;;

Then everything will work fine.

The next problem is with installation. It looks like a serious problem with oasis package that is one of the most popular tool, used by many packages. So the problem may recur, and it is better to heal it. I would suggest you to try in order the following methods:

  1. Make sure, that your opam environment is properly activated. An rc script of your shell usually do this, but it is not hard to type,

     eval `opam config env` opam install core 
  2. Try to pin oasis to the latest version (maybe for some reason you got a very old oasis that doesn't work (this is still an issue in oasis package, that should be reported and fixed). After it is pinned you need to try to install core yet another time:

      opam pin add oasis 0.4.5 opam install core 
  3. If you failed on previous point, then try to install the latest (to Feb 2016) version of ocaml compiler

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM