caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Kakadu <kakadu.hafanana@gmail.com>
To: "Kovács Roland" <zen3ger@gmail.com>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Beginner - Cannot set up Core and Batteries
Date: Wed, 10 Aug 2016 15:13:52 +0300	[thread overview]
Message-ID: <CAGmVoG0exxmY3eErKU0ubMWsVj820xuvU2iwcOKA4mCgssqTbA@mail.gmail.com> (raw)
In-Reply-To: <e4cfcdca-49ee-7185-b4c0-903aca6b02ae@gmail.com>

Roland,

Please use  button `Reply to all` instead of `Reply`.
You don't need to change distro, you need just to spend some time for
configuration.  For example, you can put
eval `opam config env`
to your ~/.bashrc and opam will be should configured well on every new tterminal

Btw, I managed to load core to toplevel. Look what I have typed
manually and put this in your ~/.ocamlinit file. N.B. `-no-init`
switch forbids toplevel `ocaml` to read ~/.ocamlinit. After that I
think that both `ocaml` and `utop` will work.

Happy hacking,
Kakadu

$ ocaml -noinit
        OCaml version 4.02.3


# #use "topfind";;
- : unit = ()
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

- : unit = ()
# #thread;;
/home/kakadu/.opam/4.02.3/lib/ocaml/threads: added to search path
/home/kakadu/.opam/4.02.3/lib/ocaml/unix.cma: loaded
/home/kakadu/.opam/4.02.3/lib/ocaml/threads/threads.cma: loaded
# #require "core.top";;
/home/kakadu/.opam/4.02.3/lib/ocaml/bigarray.cma: loaded
/home/kakadu/.opam/4.02.3/lib/bin_prot: added to search path
/home/kakadu/.opam/4.02.3/lib/bin_prot/bin_prot.cma: loaded
/home/kakadu/.opam/4.02.3/lib/custom_printf: added to search path
/home/kakadu/.opam/4.02.3/lib/custom_printf/custom_printf.cma: loaded
/home/kakadu/.opam/4.02.3/lib/variantslib: added to search path
/home/kakadu/.opam/4.02.3/lib/variantslib/variantslib.cma: loaded
/home/kakadu/.opam/4.02.3/lib/sexplib: added to search path
/home/kakadu/.opam/4.02.3/lib/sexplib/sexplib.cma: loaded
/home/kakadu/.opam/4.02.3/lib/enumerate: added to search path
/home/kakadu/.opam/4.02.3/lib/fieldslib: added to search path
/home/kakadu/.opam/4.02.3/lib/fieldslib/fieldslib.cma: loaded
/home/kakadu/.opam/4.02.3/lib/pa_bench: added to search path
/home/kakadu/.opam/4.02.3/lib/pa_bench/pa_bench_lib.cma: loaded
/home/kakadu/.opam/4.02.3/lib/pa_ounit: added to search path
/home/kakadu/.opam/4.02.3/lib/pa_ounit/pa_ounit_lib.cma: loaded
/home/kakadu/.opam/4.02.3/lib/pa_test: added to search path
/home/kakadu/.opam/4.02.3/lib/pa_test/pa_test_lib.cma: loaded
/home/kakadu/.opam/4.02.3/lib/typerep_lib: added to search path
/home/kakadu/.opam/4.02.3/lib/typerep_lib/typerep_lib.cma: loaded
/home/kakadu/.opam/4.02.3/lib/core_kernel: added to search path
/home/kakadu/.opam/4.02.3/lib/core_kernel/core_kernel.cma: loaded
/home/kakadu/.opam/4.02.3/lib/sexplib_unix: added to search path
/home/kakadu/.opam/4.02.3/lib/sexplib_unix/sexplib_unix.cma: loaded
/home/kakadu/.opam/4.02.3/lib/pa_structural_sexp: added to search path
/home/kakadu/.opam/4.02.3/lib/pa_structural_sexp/pa_structural_sexp_lib.cma:
loaded
/home/kakadu/.opam/4.02.3/lib/core: added to search path
/home/kakadu/.opam/4.02.3/lib/core/core.cma: loaded
/home/kakadu/.opam/4.02.3/lib/core/core_top.cma: loaded
/home/kakadu/.opam/4.02.3/lib/core/core_top.cma: loaded
# open Core.Std;;
#

On Wed, Aug 10, 2016 at 2:36 PM, Kovács Roland <zen3ger@gmail.com> wrote:
> I've removed the utop installed by apt, then did `opam install core
> batteries utop` and `eval $(opam config env)`.
>
> The given errors might be a bug, as now neither utop and ocaml throws an
> error when I type `open Core.Std;;` (it's even shown in the suggestions in
> utop).
>
> But now in every terminal session I have to do `eval $(opam config env)`
> before I can start using utop.
>
> Is there a different Linux distro which supports OCaml well, so it's much
> simpler to set up? I don't mind distro hopping.
>
> Roland
>
> -------------------------------------------------------------------------------------------
>
> My .ocamlinit now is :
>
> $ cat .ocamlinit
> #use "topfind";;
> #thread;;
> #require "core.std";;
> #require "core.syntax";;
> #require "batteries";;
>
> let () =
>   try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
>   with Not_found -> ()
> ;;
> -------------------------------------------------------------------------------------------
>
> Utop still imports camlp4, and can't find core.std
>
> $ utop
> ────┬──────────────────────────────────────────────────┬────────
>         │ Welcome to utop version 1.19.2 (using OCaml version 4.02.3)!│
> └──────────────────────────────────────────────────┘
> 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
>
> No such package: core.std
>
> Type #utop_help for help about using utop.
>
> -------------------------------------------------------------------------------------------
>
> ocaml can't find core.std and loads camlp4 too...
>
> $ ocaml
>         OCaml version 4.02.3
>
> 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/zen3ger/.opam/4.02.3/lib/ocaml/threads: added to search path
> /home/zen3ger/.opam/4.02.3/lib/ocaml/unix.cma: loaded
> /home/zen3ger/.opam/4.02.3/lib/ocaml/threads/threads.cma: loaded
> No such package: core.std
> /home/zen3ger/.opam/4.02.3/lib/core: added to search path
> /home/zen3ger/.opam/4.02.3/lib/ocaml/nums.cma: loaded
> /home/zen3ger/.opam/4.02.3/lib/num-top: added to search path
> /home/zen3ger/.opam/4.02.3/lib/num-top/num_top.cma: loaded
> /home/zen3ger/.opam/4.02.3/lib/num: added to search path
> /home/zen3ger/.opam/4.02.3/lib/ocaml/bigarray.cma: loaded
> /home/zen3ger/.opam/4.02.3/lib/ocaml/str.cma: loaded
> /home/zen3ger/.opam/4.02.3/lib/bytes: added to search path
> /home/zen3ger/.opam/4.02.3/lib/batteries: added to search path
> /home/zen3ger/.opam/4.02.3/lib/batteries/batteries.cma: loaded
> /home/zen3ger/.opam/4.02.3/lib/batteries/batteriesConfig.cmo: loaded
> /home/zen3ger/.opam/4.02.3/lib/batteries/batteriesHelp.cmo: loaded
> /home/zen3ger/.opam/4.02.3/lib/batteries/batteriesPrint.cmo: loaded
> /home/zen3ger/.opam/4.02.3/lib/batteries/batteriesThread.cma: loaded
> /home/zen3ger/.opam/4.02.3/lib/batteries/batteriesThread.cma: loaded
>
>
>
> 2016-08-10 12:53 keltezéssel, Kakadu írta:
>>
>> It seems that you have done `opam switch` and now some packages are
>> not installed. (I.e. opam doesn't look for packages installled in
>> /usr/lib anymore.) So, toplevel gives you an error about unknown
>> topfind.
>>
>> It's likely  that `opam install core batteries utop` will fix that.
>>
>> But it is a little bit strange that utop still prints the same. It is
>> likely that you have a little bit dirty environment. You can try to
>> reopen terminal and try again and see that result differs. Don't
>> forget to do `eval $(opam config env)` at the beginnning!
>>
>> Kakadu
>>
>> On Wed, Aug 10, 2016 at 1:48 PM, Kovács Roland <zen3ger@gmail.com> wrote:
>>>
>>> Hi!
>>>
>>> Thans for the tip!
>>>
>>> I've tried and utop still prints exactly the same, and it still imports
>>> camlp4, while ocaml prints another error now:
>>>
>>> $ ocaml
>>>          OCaml version 4.02.3
>>>
>>> Cannot find file topfind.
>>> Unknown directive `thread'.
>>>
>>> Roland
>>>
>>>
>>> 2016-08-10 12:19 keltezéssel, Kakadu írta:
>>>>
>>>> Can you try the same without line about `camlp4` in your ~/.ocamlinit
>>>> file? It is very likely that you will not need it at all because
>>>> modern versions of libraries doesn't require it anymore.
>>>>
>>>> Also, I can recommend you to compile ocaml locally using `opam switch
>>>> 4.02.3 && eval $(opam config env)` command.
>>>>
>>>> kakadu
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On Wed, Aug 10, 2016 at 8:52 AM, Kovács Roland <zen3ger@gmail.com>
>>>> wrote:
>>>>>
>>>>> Hello Everyone!
>>>>>
>>>>> I'm completely new to OCaml, but I've read that it's a good practice to
>>>>> start by having both Batteries and the Core module installed.
>>>>> I'm using Ubuntu 16.04, and installed ocaml, opam, utop from the
>>>>> official
>>>>> PPAs as it seemed that the one provided for Ubuntu (avsm/ppa) is not
>>>>> working
>>>>> for 16.04!
>>>>>
>>>>> After installation I did opam init, and all the setups it asked me to
>>>>> do.
>>>>> In
>>>>> my .ocamlinit file I have what I've found as a fix for the error
>>>>> 'unbound
>>>>> module'.
>>>>> For one time utop found the modules, but since then it gives me an
>>>>> error.
>>>>>
>>>>>
>>>>> Cheers,
>>>>> Roland
>>>>> --------------------------------------------------------------------
>>>>> Judging by the output of opam, the packages should be installed
>>>>> correctly
>>>>> :
>>>>>
>>>>> $ opam list
>>>>> # Installed packages for system:
>>>>> base-bigarray            base  Bigarray library distributed with the
>>>>> OCaml
>>>>> compi
>>>>> base-bytes               base  Bytes library distributed with the OCaml
>>>>> compiler
>>>>> base-ocamlbuild          base  OCamlbuild binary and libraries
>>>>> distributed
>>>>> with
>>>>> base-threads             base  Threads library distributed with the
>>>>> OCaml
>>>>> compil
>>>>> base-unix                base  Unix library distributed with the OCaml
>>>>> compiler
>>>>> batteries               2.5.2  a community-maintained standard library
>>>>> extension
>>>>> bin_prot            113.33.03  A binary protocol generator
>>>>> cmdliner                0.9.8  Declarative definition of command line
>>>>> interfaces
>>>>> conf-m4                     1  Virtual package relying on m4
>>>>> core                113.33.03  Industrial strength alternative to
>>>>> OCaml's
>>>>> standa
>>>>> core_kernel         113.33.03  Industrial strength alternative to
>>>>> OCaml's
>>>>> standa
>>>>> cppo                    1.3.2  Equivalent of the C preprocessor for
>>>>> OCaml
>>>>> progra
>>>>> depext                  1.0.1  Query and install external dependencies
>>>>> of
>>>>> OPAM p
>>>>> fieldslib           113.33.03  Syntax extension to define first class
>>>>> values
>>>>> rep
>>>>> js-build-tools      113.33.04  Collection of tools to help building
>>>>> Jane
>>>>> Street
>>>>> ocamlbuild                  0  Build system distributed with the OCaml
>>>>> compiler
>>>>> ocamlfind               1.6.2  A library manager for OCaml
>>>>> ppx_assert          113.33.03  Assert-like extension nodes that raise
>>>>> useful
>>>>> err
>>>>> ppx_bench           113.33.03  Syntax extension for writing in-line
>>>>> benchmarks i
>>>>> ppx_bin_prot        113.33.03  Generation of bin_prot readers and
>>>>> writers
>>>>> from t
>>>>> ppx_compare         113.33.03  Generation of comparison functions from
>>>>> types
>>>>> ppx_core            113.33.03  Standard library for ppx rewriters
>>>>> ppx_custom_printf   113.33.03  Printf-style format-strings for
>>>>> user-defined
>>>>> stri
>>>>> ppx_deriving              4.0  Type-driven code generation for OCaml
>>>>>>
>>>>>> =4.02
>>>>>
>>>>> ppx_driver          113.33.03  Feature-full driver for OCaml AST
>>>>> transformers
>>>>> ppx_enumerate       113.33.03  Generate a list containing all values of
>>>>> a
>>>>> finite
>>>>> ppx_expect          113.33.03  Cram like framework for OCaml
>>>>> ppx_fail            113.33.03  Add location to calls to failwiths
>>>>> ppx_fields_conv     113.33.03  Generation of accessor and iteration
>>>>> functions fo
>>>>> ppx_here            113.33.03  Expands [%here] into its location
>>>>> ppx_inline_test     113.33.03  Syntax extension for writing in-line
>>>>> tests
>>>>> in
>>>>> oca
>>>>> ppx_jane            113.33.03  Standard Jane Street ppx rewriters
>>>>> ppx_let             113.33.03  Monadic let-bindings
>>>>> ppx_optcomp         113.33.03  Optional compilation for OCaml
>>>>> ppx_pipebang        113.33.03  A ppx rewriter that inlines reverse
>>>>> application o
>>>>> ppx_sexp_conv       113.33.03  Generation of S-expression conversion
>>>>> functions f
>>>>> ppx_sexp_message    113.33.03  A ppx rewriter for easy construction of
>>>>> s-express
>>>>> ppx_sexp_value      113.33.03  A ppx rewriter that simplifies building
>>>>> s-express
>>>>> ppx_tools          5.0+4.02.0  Tools for authors of ppx rewriters and
>>>>> other
>>>>> synt
>>>>> ppx_type_conv       113.33.03  Support Library for type-driven code
>>>>> generators
>>>>> ppx_typerep_conv    113.33.03  Generation of runtime types from type
>>>>> declaration
>>>>> ppx_variants_conv   113.33.03  Generation of accessor and iteration
>>>>> functions fo
>>>>> re                      1.6.1  RE is a regular expression library for
>>>>> OCaml
>>>>> result                    1.2  Compatibility Result module
>>>>> sexplib             113.33.03  Library for serializing OCaml values to
>>>>> and
>>>>> from
>>>>> typerep             113.33.03  typerep is a library for runtime types.
>>>>> variantslib         113.33.03  Part of Jane Street's Core library
>>>>>
>>>>>
>>>>> --------------------------------------------------------------------
>>>>> My .ocmalinit :
>>>>>
>>>>> #use "topfind";;
>>>>> #thread;;
>>>>> #camlp4o;;
>>>>> #require "core.std";;
>>>>> #require "core.syntax";;
>>>>> #require "batteries";;
>>>>>
>>>>> let () =
>>>>>     try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH")
>>>>>     with Not_found -> ()
>>>>> ;;
>>>>>
>>>>> --------------------------------------------------------------------
>>>>> What ocaml prints :
>>>>>
>>>>> $ ocaml
>>>>>                          OCaml version 4.02.3
>>>>> 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
>>>>>
>>>>> /usr/lib/ocaml/threads: added to search path
>>>>> /usr/lib/ocaml/unix.cma: loaded
>>>>> /usr/lib/ocaml/threads/threads.cma: loaded
>>>>> /usr/lib/ocaml/dynlink.cma: loaded
>>>>> /usr/lib/ocaml/camlp4: added to search path
>>>>> /usr/lib/ocaml/camlp4/camlp4o.cma: loaded
>>>>> No such package: core.std
>>>>> /home/zen3ger/.opam/system/lib/core: added to search path
>>>>> /usr/lib/ocaml/nums.cma: loaded
>>>>> /home/zen3ger/.opam/system/lib/num-top: added to search path
>>>>> /home/zen3ger/.opam/system/lib/num-top/num_top.cma: loaded
>>>>>       Camlp4 Parsing version 4.02.3
>>>>>
>>>>> /home/zen3ger/.opam/system/lib/num: added to search path
>>>>> /usr/lib/ocaml/bigarray.cma: loaded
>>>>> /usr/lib/ocaml/str.cma: loaded
>>>>> /home/zen3ger/.opam/system/lib/bytes: added to search path
>>>>> /home/zen3ger/.opam/system/lib/batteries: added to search path
>>>>> /home/zen3ger/.opam/system/lib/batteries/batteries.cma: loaded
>>>>> /home/zen3ger/.opam/system/lib/batteries/batteriesConfig.cmo: loaded
>>>>> /home/zen3ger/.opam/system/lib/batteries/batteriesHelp.cmo: loaded
>>>>> /home/zen3ger/.opam/system/lib/batteries/batteriesPrint.cmo: loaded
>>>>> /home/zen3ger/.opam/system/lib/batteries/batteriesThread.cma: loaded
>>>>> /home/zen3ger/.opam/system/lib/batteries/batteriesThread.cma: loaded
>>>>>
>>>>>
>>>>> --------------------------------------------------------------------
>>>>> What utop prints :
>>>>>
>>>>> 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
>>>>>
>>>>> No such package: core.std
>>>>> No such package: core.syntax
>>>>> No such package: batteries
>>>>>
>

      parent reply	other threads:[~2016-08-10 12:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-10  5:52 Kovács Roland
2016-08-10 10:19 ` Kakadu
     [not found]   ` <591153db-3b69-cacc-35cc-83096ca2a145@gmail.com>
2016-08-10 10:53     ` Kakadu
     [not found]       ` <e4cfcdca-49ee-7185-b4c0-903aca6b02ae@gmail.com>
2016-08-10 12:13         ` Kakadu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGmVoG0exxmY3eErKU0ubMWsVj820xuvU2iwcOKA4mCgssqTbA@mail.gmail.com \
    --to=kakadu.hafanana@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=zen3ger@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).