Giter Site home page Giter Site logo

core's People

Contributors

aalekseyev avatar acatton avatar amirmc avatar avsm avatar bmillwood avatar d-kalinichenko avatar dkalinichenko-js avatar dra27 avatar enitihas avatar gregory-nisbet avatar jeremiedimino avatar jmiven avatar lpw25 avatar na4zagin3 avatar public-release avatar rneswold avatar sinic avatar staronj avatar trefis avatar xclerc avatar ysulsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

core's Issues

Core_top is missing a pretty printer

The current Core release (112.35.00) reports the following error in the toplevel when "core" is required:

/Users/mmottl/.opam/4.02.2/lib/core/core_top.cma: loaded
Unbound value String_id.pp.

symbol not found: _mkostemp

The error is below. Notably, the same code works fine when build with base or core_kernel. This happens on any source file with the latest release.

$ ocamlbuild play.byte -pkg core
+ /Users/yminsky/.opam/4.03.0/bin/ocamlc.opt -I /Users/yminsky/.opam/4.03.0/lib/base -I /Users/yminsky/.opam/4.03.0/lib/bin_prot -I /Users/yminsky/.opam/4.03.0/lib/core -I /Users/yminsky/.opam/4.03.0/lib/core_kernel -I /Users/yminsky/.opam/4.03.0/lib/fieldslib -I /Users/yminsky/.opam/4.03.0/lib/num -I /Users/yminsky/.opam/4.03.0/lib/ocaml -I /Users/yminsky/.opam/4.03.0/lib/ppx_assert -I /Users/yminsky/.opam/4.03.0/lib/ppx_bench -I /Users/yminsky/.opam/4.03.0/lib/ppx_expect -I /Users/yminsky/.opam/4.03.0/lib/ppx_hash -I /Users/yminsky/.opam/4.03.0/lib/ppx_inline_test -I /Users/yminsky/.opam/4.03.0/lib/sexplib -I /Users/yminsky/.opam/4.03.0/lib/typerep -I /Users/yminsky/.opam/4.03.0/lib/variantslib unix.cma bigarray.cma caml.cma base0.cma shadow_stdlib.cma base.cma fieldslib.cma sexplib.cma variantslib.cma bin_shape_lib.cma bin_prot.cma nums.cma ppx_assert_lib.cma ppx_bench_lib.cma ppx_hash_lib.cma inline_test_config.cma ppx_inline_test_lib.cma typerep_lib.cma core_kernel.cma expect_test_common.cma expect_test_config.cma expect_test_collector.cma sexplib_unix.cma core.cma play.cmo -o play.byte
File "_none_", line 1:
Error: Error on dynamically loaded library: /Users/yminsky/.opam/4.03.0/lib/stublibs/dllcore_stubs.so: dlopen(/Users/yminsky/.opam/4.03.0/lib/stublibs/dllcore_stubs.so, 138): Symbol not found: _mkostemp
  Referenced from: /Users/yminsky/.opam/4.03.0/lib/stublibs/dllcore_stubs.so
  Expected in: flat namespace
 in /Users/yminsky/.opam/4.03.0/lib/stublibs/dllcore_stubs.so
Command exited with code 2.
Hint: Recursive traversal of subdirectories was not enabled for this build,
  as the working directory does not look like an ocamlbuild project (no
  '_tags' or 'myocamlbuild.ml' file). If you have modules in subdirectories,
  you should add the option "-r" or create an empty '_tags' file.

  To enable recursive traversal for some subdirectories only, you can use the
  following '_tags' file:

  true: -traverse
  <dir1> or <dir2>: traverse

Compilation unsuccessful after building 3 targets (1 cached) in 00:00:00.

Prettier error for Command.Spec.file failure

(Related to #11 - making a note as I run through the Command chapter in Real World OCaml -- I'll send a patch later if noone else gets to it first).

A simple MD5 command defines a Command.Spec.file arg:

open Core.Std

let do_hash file () =
  In_channel.with_file file ~f:(
    fun ic ->
      let open Cryptokit in
      hash_channel (Hash.md5 ()) ic
      |> transform_string (Hexa.encode ())
      |> print_endline
  )

(* part 1 *)
let command =
  Command.basic
    ~summary:"Generate an MD5 hash of the input data"
    ~readme:(fun () -> "More detailed information")
    Command.Spec.(empty +> anon ("filename" %: file))
    do_hash

let () =
  Command.run ~version:"1.0" ~build_info:"RWO" command

The failure exception for the file not existing is rather raw, and could benefit from a more human-readable error message.

$ ./basic_md5_as_filename.native foo
Fatal error: exception Sys_error("foo: No such file or directory")
Raised by primitive operation at file "pervasives.ml", line 292, characters 20-46
Called from file "lib/in_channel.ml", line 19, characters 46-65
Called from file "lib/command.ml", line 1356, characters 4-54

Error: Unbound module Core.Std.Key

I would like to create a map defined in Core using the of_alist function in the Key.Map module, according to the advice at https://ocaml.janestreet.com/ocaml-core/latest/doc/core/Map.html. However, I've encountered such an error message both in the toplevel and in the ocamlbuild.

Error: Unbound module Core.Std.Key

At the same time, Map and Map.Poly work perfectly for me. It seems that the issue is related only to the Key module. I've installed Core and Core_extended along with other Jane Street's packages using opam.

Cheers,
Zhiyuan

Latest bleeding edge doesn't build on macos

Looks like the current tip is busted...

#=== ERROR while installing core.114.08+30 ====================================#
# opam-version 1.2.2
# os           darwin
# command      make
# path         /Users/yminsky/.opam/4.03.0+bleeding/build/core.114.08+30
# compiler     4.03.0
# exit-code    2
# env-file     /Users/yminsky/.opam/4.03.0+bleeding/build/core.114.08+30/core-387-0f1b61.env
# stdout-file  /Users/yminsky/.opam/4.03.0+bleeding/build/core.114.08+30/core-387-0f1b61.out
# stderr-file  /Users/yminsky/.opam/4.03.0+bleeding/build/core.114.08+30/core-387-0f1b61.err
### stdout ###
# [...]
# ./setup.exe -build
# ocamlfind ocamlopt -package unix -package ocamlbuild -linkpkg -package js-build-tools.ocamlbuild_goodies -package ppx_driver.ocamlbuild myocamlbuild.ml /Users/yminsky/.opam/4.03.0+bleeding/lib/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
# rm -f
# /Users/yminsky/.opam/4.03.0+bleeding/bin/ocamlfind ocamlc -g -thread -I src -package core_kernel -package variantslib -package typerep -package threads -package sexplib.unix -package sexplib -package ppx_inline_test.runtime-lib -package ppx_hash.runtime-lib -package ppx_expect.collector -package ppx_bench.runtime-lib -package ppx_assert.runtime-lib -package fieldslib -package core_kernel -package bin_prot -predicates custom_ppx -c src/bigstring_stubs.c
# + /Users/yminsky/.opam/4.03.0+bleeding/bin/ocamlfind ocamlc -g -thread -I src -package core_kernel -package variantslib -package typerep -package threads -package sexplib.unix -package sexplib -package ppx_inline_test.runtime-lib -package ppx_hash.runtime-lib -package ppx_expect.collector -package ppx_bench.runtime-lib -package ppx_assert.runtime-lib -package fieldslib -package core_kernel -package bin_prot -predicates custom_ppx -c src/bigstring_stubs.c
# src/bigstring_stubs.c:48:10: fatal error: 'unix_utils.h' file not found
# #include "unix_utils.h"
#          ^
#1 error generated.
# Command exited with code 2.
### stderr ###
# W: No replace section found in file Makefile
# W: Cannot find source file matching module 'core_top' in library core_top
# W: Cannot find source file matching module 'core' in library core
# E: Failure("Command ''/Users/yminsky/.opam/4.03.0+bleeding/bin/ocamlbuild' src/libcore_stubs.a src/dllcore_stubs.so src/core.cma src/core.cmxa src/core.a src/core.cmxs top/core_top.cma top/core_top.cmxa top/core_top.a top/core_top.cmxs -use-ocamlfind -plugin-tags 'package(js-build-tools.ocamlbuild_goodies), package(ppx_driver.ocamlbuild)' -tag debug' terminated with error code 10")
# make: *** [build] Error 1

build requires bash

This isn't available by default on OpenBSD, so would be good to use /bin/sh if possible.


==== ERROR [while installing core.109.13.00] ====
# opam-version    0.9.6 (latest-21-gddf25e2)
# os              bsd
# command         gmake
# path            /home/avsm/.opam/system/build/core.109.13.00
# exit-code       2
# env-file        /home/avsm/.opam/system/build/core.109.13.00/core-ebe0e0.env
# stdout-file     /home/avsm/.opam/system/build/core.109.13.00/core-ebe0e0.out
# stderr-file     /home/avsm/.opam/system/build/core.109.13.00/core-ebe0e0.err
### stdout ###
ocamlopt.opt -o setup.exe setup.ml || ocamlopt -o setup.exe setup.ml || ocamlc -o setup.exe setup.ml
rm -f setup.cmx setup.cmi setup.o setup.obj setup.cmo
./setup.exe -configure 
### stderr ###
env: bash: No such file or directory
E: Failure("Command 'lib/detect.sh' terminated with error code 127")
gmake: *** [setup.data] Error 1

Time module issue (or documentation issue, not sure).

The documentation for the Time module says:
to_string_trimmed t Same as to_string, but removes trailing seconds and milliseconds if they are 0

to_sec_string t Same as to_string, but without milliseconds

However, these appear to require a Zone.t argument - which 'to_string' does not.

Example:
let now = Time.now()
print_string (((Time.to_sec_string now) Time.Zone.local)^"\n") works
print_string ((Time.to_sec_string now)^"\n") causes "This expression has type zone:Core.Time.Zone.t -> string but an expression was expected of type string"

Build failure when trying to install core using opam

I am trying to install core using "opam install core" but I get this odd error:

=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
[ERROR] The compilation of core failed at "make".
Processing  1/1: [core: ocamlfind remove]
#=== ERROR while installing core.112.06.02 ====================================#
# opam-version 1.2.1
# os           darwin
# command      make
# path         /Users/shankar/.opam/system/build/core.112.06.02
# compiler     system (4.02.1)
# exit-code    2
# env-file     /Users/shankar/.opam/system/build/core.112.06.02/core-77700-e7966f.env
# stdout-file  /Users/shankar/.opam/system/build/core.112.06.02/core-77700-e7966f.out
# stderr-file  /Users/shankar/.opam/system/build/core.112.06.02/core-77700-e7966f.err
### stdout ###
# lib/unix_stubs.c:1396:49: warning: passing 'gid_t [16]' to parameter of type 'int *' converts between pointers to integer types with different sign [-Wpointer-sign]
# [...]
#                                                 ^~~~~~
# /usr/include/unistd.h:648:43: note: passing argument to parameter here
# int      getgrouplist(const char *, int, int *, int *);
#                                               ^
# lib/unix_stubs.c:1691:2: warning: "_POSIX_PRIORITY_SCHEDULING not present; sched_setscheduler undefined" [-W#warnings]
# #warning "_POSIX_PRIORITY_SCHEDULING not present; sched_setscheduler undefined"
#  ^
#8 warnings and 7 errors generated.
# Command exited with code 2.
### stderr ###
# [...]
# #  warning "cpp test --defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0-- was false"
#    ^
# config/test.c:56:4: warning: "Feature FDATASYNC will not be available" [-W#warnings]
# #  warning "Feature FDATASYNC will not be available"
#    ^
#12 warnings generated.
# config/discover.sh: line 61: cc: command not found
# W: Cannot find source file matching module 'core' in library core
# E: Failure("Command ''/usr/local/bin/ocamlbuild' lib/libcore_stubs.a lib/dllcore_stubs.so lib/core.cma lib/core.cmxa lib/core.a lib/core.cmxs top/core_top.cma top/core_top.cmxa top/core_top.a top/core_top.cmxs -use-ocamlfind -tag debug' terminated with error code 10")
# make: *** [build] Error 1

=-=- Error report -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The following actions failed
  ∗  install core 112.06.02

I am currently using gcc version 4.9.2 (Homebrew gcc49 4.9.2_1) on OS X 10.10.2.

Thank you!

Iobuf stubs fail to compile on OpenBSD

Not looked deeper yet; just creating report as part of OCamlPro/opam-repository#1029 triage report on 4.01.0RC2.

+ ocamlfind ocamlc -I lib -package core_kernel -c lib/iobuf_stubs.c
In file included from lib/unix_utils.h:6,
                 from lib/iobuf_stubs.c:4:
/usr/include/sys/uio.h:90: error: expected declaration specifiers or '...' before 'off_t'
/usr/include/sys/uio.h:91: error: expected declaration specifiers or '...' before 'off_t'

Command doesn't allow specification of an "end of flags" marker

Some programs take option like arguments (i.e. options starting with --) as data. In other option processing libraries, -- can be used to explicitly mark the end of options to be processed.

While we can workaround this by manually splitting the argument list before passing it to Command.run, it would be great to see support for this in Command.

Cannot open Core.Std within utop

In terminal, I can verify that I have installed core using OPAM:

:~/.opam/packages$ ls
base-bigarray bitcoin cryptokit lwt pa_test variantslib
base-bytes camlp4 custom_printf ocamlbuild pipebang yojson
base-no-ppx camomile easy-format ocamlfind react zed
base-threads comparelib enumerate omake sexplib
base-unix core fieldslib ounit type_conv
biniou core_kernel herelib pa_bench typerep
bin_prot cppo lambda-term pa_ounit utop

However, when I try to open Core.Std in utop, I get:

utop # open Core.Std;;
Error: Unbound module Core

Am I doing something wrong? I have restarted utop and my terminal several times, and nothing helps.

Flags.Make's initialization crashes *all* programs

With Core 109.15.00 I cannot run any program:

$ cat ttt.ml
open Core.Std

let () = printf "bouh\n"

$ ocamlfind ocamlopt -package core -thread -linkpkg ttt.ml -o ttt
$ ./ttt 
("Flag.Make got flags with no bits set" ((0 cloexec)))
Fatal error: exception Info.Exn(_)
Raised at file "lib/error.ml", line 7, characters 21-29
Called from file "lib/flags.ml", line 46, characters 6-96

$ opam list --installed | grep core
core                     109.15.00  Industrial strength alternative to OCaml's standard library
core_extended            109.15.00  Extra components that are not as closely vetted or as stable as Core

I gess it comes from some Linux_ext non-available things (it's on a Redhat 5, which is relatively old).

Time.to_string default format

Would it be possible to set the default string_and_sexp_format to `Write_new_read_both?

It looks like a Jane-St-internal backwards compatibility fix :)
Serializing timestamps without time zone is bad practice.

It requires to call write_new_string_and_sexp_formats__read_both () in every piece of new code, and even while knowing it, it's easy to forget.

On the physical equality of records

Reading the code in type_equal.ml, I saw this comment on how it was ok to use physical equality on records to check identity.
I think there is a misunderstanding here: this statement is only true for records with mutable fields. If a record has no mutable field, in theory the compiler is allowed to deconstruct and reconstruct it for optimization, breaking physical equality. The fact it doesn't do it currently shouldn't be seen as a guarantee for the future.

In this specific case, accessing the uid field seems to be the right solution anyway, so I wonder why Obj.magic is used in the first place.

Command auto-completion script fails on Mac

Previous versions of Core used to generate

COMPREPLY=($("${COMP_WORDS[@]}"))

in the autocompletion script from Command. This worked fine on Mac.

Now, this is done:

if type readarray > /dev/null
then readarray -t COMPREPLY < <("${COMP_WORDS[@]}")
else IFS="
" read -d "�" -A COMPREPLY < <("${COMP_WORDS[@]}")

Unfortunately there is no readarray on Mac. Thus we fall over to the else case, which just doesn't parse in bash.

Tuple2.mapn

Tuple2 provides map1 and map2, which apply the provided function to the first or the second element. However there's no convenient way to map the same function to both elements, provided they're of same type. Batteries include mapn for this purpose, could we have something similar in Core?

Unix.mkdir_p fails on MacOSX

On MacOSX, mkdir_p does not work:

# Unix.mkdir_p ~perm:0o777 "/tmp/bbb/";;
Exception:
Unix.Unix_error (Core.Std.Unix.EISDIR, "mkdir", "((dirname /) (perm 0o777))"). 

It's because of a matching on the exception:

On Ubuntu:

# Unix.mkdir ~perm:0o775 "/";;
Exception:
Unix.Unix_error (Core.Std.Unix.EEXIST, "mkdir", "((dirname /) (perm 0o775))").

But on MacOSX the exception is different:

# Unix.mkdir ~perm:0o775 "/";;
Exception:
Unix.Unix_error (Core.Std.Unix.EISDIR, "mkdir", "((dirname /) (perm 0o775))"). 

So, that's why Unix.mkdir_p fails on MacOSX
(Core_unix.ml:1152):

let mkdir_p ?perm dirname =
  let mkdir_if_missing ?perm dir =
    try
      mkdir ?perm dir
    with
    | Unix_error (EEXIST, _, _) -> ()
    | e -> raise e
  in

PS: Yes, man 2 mkdir on MacOSX does not document the EISDIR, so maybe it's a MacOSX bug … a work-around in Core would be nice though.

core-109.60.00 fails to build on OpenBSD 5.4

As a workaround, I added || defined(__OpenBSD__) to the macro conditional on line 1565 of lib/unix_stubs.c (since I don't need multicast functionality right now) and compiling succeeded.

$ gmake
./setup.exe -build 
W: Cannot find source file matching module 'core' in library core
Finished, 0 targets (0 cached) in 00:00:00.
+ ocamlfind ocamlc -I lib -package core_kernel -c lib/unix_stubs.c
lib/unix_stubs.c:680:2: warning: #warning "_POSIX_SYNCHRONIZED_IO undefined or <= 0; aliasing unix_fda
tasync to unix_fsync"
lib/unix_stubs.c:952:2: warning: #warning "posix timers not present; clock functions undefined"
lib/unix_stubs.c: In function 'core_unix_mcast_modify':
lib/unix_stubs.c:1568: error: storage size of 'mreq_source' isn't known
lib/unix_stubs.c:1577: error: 'IP_ADD_SOURCE_MEMBERSHIP' undeclared (first use in this function)
lib/unix_stubs.c:1577: error: (Each undeclared identifier is reported only once
lib/unix_stubs.c:1577: error: for each function it appears in.)
lib/unix_stubs.c:1695:2: warning: #warning "_POSIX_PRIORITY_SCHEDULING not present; sched_setscheduler
 undefined"
Command exited with code 2.
Compilation unsuccessful after building 23 targets (22 cached) in 00:00:00.
E: Failure("Command ''/usr/local/bin/ocamlbuild' lib/libcore_stubs.a lib/dllcore_stubs.so lib/core.cma
 lib/core.cmxa lib/core.a lib/core.cmxs top/core_top.cma top/core_top.cmxa top/core_top.a top/core_top
.cmxs -use-ocamlfind -tag debug' terminated with error code 10")
gmake: *** [build] Error 1

*of_string exceptions not homogeneous

Some of_string functions fail with Failure _ and others with Invalid_argument _ (and they are often not documented because of the include Stringable):

# Int.of_string "lksjfd";;
Exception: Failure "Int.of_string: \"lksjfd\"".
# Float.of_string "lkjfds";;
Exception: Invalid_argument "Float.of_string lkjfds".

PS: Wouldn't the “perfect” Stringable be:

module type S = sig
  type t

  val of_string_exn : string -> t
  val of_string: string -> t option
  val to_string : t -> string
end

Override the Command help flags

When writing command line arguments in a style that uses -- prefixes, the built in help options still use -. To achieve a uniform style for switches, it would be useful to override the option name for the built-in help option (e.g. to --help), or possibly to remove the built-in options completely.

Core 109.53 doesn't built on up-to-date OS X 10.9

Here's the result from installing via OPAM.

=-=-= Installing core.109.53.00 =-=-=
Building core.109.53.00:
  ocaml setup.ml -configure --prefix /Users/yminsky/.opam/4.01.0
  make
  make install
[ERROR] The compilation of core.109.53.00 failed.
Removing core.109.53.00.
  ocamlfind remove core


===== ERROR while installing core.109.53.00 =====
# opam-version 1.1.0
# os           darwin
# command      make
# path         /Users/yminsky/.opam/4.01.0/build/core.109.53.00
# compiler     4.01.0
# exit-code    2
# env-file     /Users/yminsky/.opam/4.01.0/build/core.109.53.00/core-54228-5f1023.env
# stdout-file  /Users/yminsky/.opam/4.01.0/build/core.109.53.00/core-54228-5f1023.out
# stderr-file  /Users/yminsky/.opam/4.01.0/build/core.109.53.00/core-54228-5f1023.err
### stdout ###
# ...[truncated]
# ocamlfind ocamlc -c -g -ppopt -Ilib/ -package variantslib.syntax -package variantslib -package unix -package threads -package sexplib.syntax -package sexplib -package res -package pa_test.syntax -package pa_test -package pa_pipebang -package pa_ounit.syntax -package pa_ounit -package herelib.syntax -package herelib -package fieldslib.syntax -package fieldslib -package core_kernel -package comparelib.syntax -package camlp4.macro -package bin_prot.syntax -package bin_prot -package bigarray -syntax camlp4o -thread -I lib -o lib/iobuf_tests.cmo lib/iobuf_tests.ml
# ocamlfind ocamlc -c -g -ppopt -Ilib/ -package variantslib.syntax -package variantslib -package unix -package threads -package sexplib.syntax -package sexplib -package res -package pa_test.syntax -package pa_test -package pa_pipebang -package pa_ounit.syntax -package pa_ounit -package herelib.syntax -package herelib -package fieldslib.syntax -package fieldslib -package core_kernel -package comparelib.syntax -package camlp4.macro -package bin_prot.syntax -package bin_prot -package bigarray -syntax camlp4o -thread -I lib -o lib/linux_ext.cmo lib/linux_ext.ml
# + ocamlfind ocamlc -c -g -ppopt -Ilib/ -package variantslib.syntax -package variantslib -package unix -package threads -package sexplib.syntax -package sexplib -package res -package pa_test.syntax -package pa_test -package pa_pipebang -package pa_ounit.syntax -package pa_ounit -package herelib.syntax -package herelib -package fieldslib.syntax -package fieldslib -package core_kernel -package comparelib.syntax -package camlp4.macro -package bin_prot.syntax -package bin_prot -package bigarray -syntax camlp4o -thread -I lib -o lib/linux_ext.cmo lib/linux_ext.ml
# File "lib/linux_ext.ml", line 1:
# Error: The implementation lib/linux_ext.ml
#        does not match the interface lib/linux_ext.cmi:
#        ...
#        In module Epoll:
#        The field `close' is required but not provided
# Command exited with code 2.
### stderr ###
# ...[truncated]
# int main () { return recvmmsg(0, 0, 0, 0, 0); }
#                      ^
#1 warning generated.
# Undefined symbols for architecture x86_64:
#   "_recvmmsg", referenced from:
#       _main in test_recvmmsg-mxGC1N.o
# ld: symbol(s) not found for architecture x86_64
# clang: error: linker command failed with exit code 1 (use -v to see invocation)
# E: Failure("Command ''/Users/yminsky/.opam/4.01.0/bin/ocamlbuild' lib/libcore_stubs.a lib/dllcore_stubs.so lib/core.cma lib/core.cmxa lib/core.a lib/core.cmxs top/core_top.cma top/core_top.cmxa top/core_top.a top/core_top.cmxs -tag debug' terminated with error code 10")
# make: *** [build] Error 1

'opam install core' failed.

Debian 32 bit opam upgrade failure

I get this error.

Command exited with code 2.
E: Failure("Command ''/usr/bin/ocamlbuild' lib/libcore_stubs.a lib/dllcore_stubs.so lib/core.cma lib/core.cmxa lib/core.a lib/core.cmxs top/core_top.cma top/core_top.cmxa top/core_top.a top/core_top.cmxs -use-ocamlfind -tag debug' terminated with error code 10")
make: *** [build] Error 1
[ERROR] The compilation of core.111.11.00 failed.
Removing core.111.11.00.
  ocamlfind remove core
ocamlfind: [WARNING] No such directory: /home/flogic/.opam/system/lib/core

[ERROR] Due to some errors while processing core.111.11.00, the following actions will NOT proceed:
 - recompile textutils.111.06.00
 - recompile re2.111.08.00
 - recompile core_bench.109.58.01
 - upgrade async_kernel.111.08.00 to 111.11.00

Which as far as I can tell is caused by this one.

File "lib/time_internal.ml", line 9, characters 25-35:
Integer literal exceeds the range of representable integers of type int
Preprocessing error on file lib/time_internal.ml
Error while running external preprocessor

Error when requiring core or async at toplevel

When I'm running either ocaml or utop with the .ocamlinit shown in the Installation hints, I'm getting the following error:

Exception:
Zone.Invalid_file_format "/etc/localtime - version (3) is invalid".
File ".ocamlinit", line 1:
Error: Reference to undefined global `Core'

My .ocamlinit file:

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

(* Added by Me *)
#use "topfind"
#thread
#require "dynlink"
#camlp4o
#require "bin_prot.syntax"
#require "sexplib.syntax"
#require "variantslib.syntax"
#require "fieldslib.syntax"
#require "comparelib.syntax"
#require "core"
#require "async"
#require "core_extended"
#require "core.top"
open Core.Std

I do not get the error if I remove lines requiring "core", "async", "core_extended", "core.top", and the open, of course.
I am running OCaml 4.02.3 (Core is at version 113.00.00) on an Arch Linux machine.

EDIT:
I'm pretty sure this is what's giving me the error:

let read_header ic =
  let buf = String.create 4 in
  really_input ic buf 0 4;
  if buf <> "TZif" then
    raise (Invalid_file_format "magic characters TZif not present");
  let version =
    match input_char ic with
      | '\000' -> `V1
      | '2' -> `V2
      | bad_version ->
        raise (Invalid_file_format (sprintf "version (%c) is invalid" bad_version))

I checked my /etc/localtime, and indeed, the header is TZif3. I'm not sure where to continue from here.

Core's Unix is inconsistent with Async's Unix

Core's Unix module differs from Async's Unix module in a couple of ways that seem easily fixable.

  • Async defines File_kind.t, as where Core continues to use the standard library's file_kind.
  • Async's Stats module provides atime, mtime, and ctime as Time.t values. Core provides these as floats, and includes the comment "The floats below are really Time.t or Time.Span.t, but Time depends on Unix, so the fix isn't so trivial." I don't understand firstly why any would be Time.Span.t; maybe that's just a typo. More interestingly, why is the fix not trivial? In Async, the float is being converted to a Time.t simply by calling Time.of_float, so I don't see the complication. Is it a circular dependency issue? AFAICT, Time.of_float is defined ultimately in Timer_internal, so there shouldn't be any circularity.

I'm willing to give it a try and submit pull requests if these changes were likely to be accepted. Thanks.

Command Groups with different types

Can anyone see explain what is going wrong here ?
If I change the type of min-time argument so they are both the same type. everything works but I can't have different types in different groups ?

open Core.Std

let common =
    Command.Spec.(
      empty
      +> flag "-nodes" (required int) 
        ~doc:"int Number of nodes to simulate" )

let realtime =
  Command.basic
    ~summary:"Realtime Simulator for Raft's Leader Election"
  Command.Spec.(
    empty
     ++ common
     +> flag "-time-min" (optional float)
        ~doc:"int The minimum timeout used"
      )
    (fun nodes time_min () -> ()) 

let discrete =
  Command.basic
    ~summary:"Discrete Event Simulator for Raft's Leader Election"
  Command.Spec.(
    empty
     ++ common
(* this is the line which is causing the problem *)
     +> flag "-time-min" (optional int)
        ~doc:"int The minimum timeout used"
      )
    (fun nodes time_min  () -> ()) 


let () =  
  ["realtime",realtime;"discrete",discrete]
  |> Command.group ~summary:"Discrete Event Simulator & Realtime Simulator for
  Raft's Leader Election"
  |> Command.run

$ corebuild test.byte

File "test.ml", line 26, characters 8-83:
Error: This expression has type int option param
but an expression was expected of type float option param
Type int is not compatible with type float
Command exited with code 2.

opam upgrade core.109.40.00 failed on Ubuntu13.04 64bits

File "lib/core_unix.mli", line 293, characters 5-886:
Error: This variant or record definition does not match that of type
Unix.open_flag
The field O_CLOEXEC is only present in this definition.

OCaml version 4.02.0+dev0-2013-06-13

freebsd x32 build failures

I'll cook up a patch for these later if noone else gets to it.

mv backtrace_stubs.o lib/backtrace_stubs.o
ocamlfind ocamlc -I lib -package core_kernel -c lib/bigstring_stubs.c
+ ocamlfind ocamlc -I lib -package core_kernel -c lib/bigstring_stubs.c
In file included from lib/bigstring_stubs.c:36:
lib/socketaddr.h:13: error: field 's_inet6' has incomplete type
lib/socketaddr.h:32: warning: 'struct in6_addr' declared inside parameter list
lib/socketaddr.h:32: warning: its scope is only this definition or declaration, which is probably not what you want
lib/bigstring_stubs.c:734:2: warning: #warning "MSG_NOSIGNAL not defined; bigstring_send{,msg}_noblocking_no_sigpipe not implemented"
lib/bigstring_stubs.c:735:2: warning: #warning "Try compiling on Linux?"
Command exited with code 2.
### stderr ###
...[truncated]
config/test.c:15:4: warning: #warning "cpp test --defined(LINUX_EXT)-- was false"
config/test.c:16:4: warning: #warning "Feature LINUX_EXT will not be availlable"
config/test.c:29:4: warning: #warning "cpp test --defined(RLIMIT_NICE)-- was false"
config/test.c:30:4: warning: #warning "Feature RLIMIT_NICE will not be availlable"
config/test.c:55:4: warning: #warning "cpp test --defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0-- was false"
config/test.c:56:4: warning: #warning "Feature FDATASYNC will not be availlable"
/tmp//ccGEko9z.o: In function `main':
test_recvmmsg.c:(.text+0x39): undefined reference to `recvmmsg'
E: Failure("Command ''/usr/home/avsm/src/git/avsm/worker/ocaml/4.01/bin/ocamlbuild' lib/libcore_stubs.a lib/dllcore_stubs.so lib/core.cma lib/core.cmxa lib/core.a lib/core.cmxs top/core_top.cma top/core_top.cmxa top/core_top.a top/core_top.cmxs -tag debug' terminated with error code 10")

Docs unavailable

I am not sure this bug should be filed here, but I couldn't come up with a better place.

Going to a URL like this one in docs doesn't load any API reference.

It seems that something is wrong in the server configuration.The console gives the following error:

XMLHttpRequest cannot load
https://ocaml.janestreet.com/ocaml-core/110.01.00/doc/async_unix/summary.html.
No 'Access-Control-Allow-Origin' header is present on 
the requested resource. Origin 'https://blogs.janestreet.com' 
is therefore not allowed access. 

Error: Unbound module Poly

I had built core-109.35 without problems, but upgrading to 109.38, I hit the error below. I used ocaml 4.00.1 for both.

ocamlfind ocamlc -c -package variantslib.syntax -package variantslib -package unix -package threads -package sexplib.syntax -package sexplib -package res -package pa_pipebang -package pa_ounit.syntax -package pa_ounit -package herelib.syntax -package herelib -package fieldslib.syntax -package fieldslib -package core_kernel -package comparelib.syntax -package bin_prot.syntax -package bin_prot -package bigarray -syntax camlp4o -thread -I lib -o lib/timing_wheel_unit_tests.cmo lib/timing_wheel_unit_tests.ml
+ ocamlfind ocamlc -c -package variantslib.syntax -package variantslib -package unix -package threads -package sexplib.syntax -package sexplib -package res -package pa_pipebang -package pa_ounit.syntax -package pa_ounit -package herelib.syntax -package herelib -package fieldslib.syntax -package fieldslib -package core_kernel -package comparelib.syntax -package bin_prot.syntax -package bin_prot -package bigarray -syntax camlp4o -thread -I lib -o lib/timing_wheel_unit_tests.cmo lib/timing_wheel_unit_tests.ml
File "lib/timing_wheel_unit_tests.ml", line 89, characters 16-26:
Error: Unbound module Poly
Command exited with code 2.
E: Failure("Command ''/usr/bin/ocamlbuild' lib/libcore_stubs.a lib/dllcore_stubs.so lib/core.cma lib/core.cmxa lib/core.a lib/core.cmxs top/core_top.cma top/core_top.cmxa top/core_top.a top/core_top.cmxs' terminated with error code 10")

NetBSD/x86-6.1.4 build error

I tried opam upgrade to upgrade my Async 112.24.00 installation to 112.35.00 and it failed. Here's some of the output from OPAM:

#=== ERROR while upgrading to core.112.35.00 ==================================#
# opam-version 1.2.0
# os           netbsd
# command      gmake
# path         /usr/local/opam/4.02.2/build/core.112.35.00
# compiler     4.02.2
# exit-code    2
# env-file     /usr/local/opam/4.02.2/build/core.112.35.00/core-20153-60c5c2.env
# stdout-file  /usr/local/opam/4.02.2/build/core.112.35.00/core-20153-60c5c2.out
# stderr-file  /usr/local/opam/4.02.2/build/core.112.35.00/core-20153-60c5c2.err

One problem appears here (this is a 32-bit system):

# File "src/iobuf.ml", line 624, characters 17-28:
# Integer literal exceeds the range of representable integers of type int

In the stderr section, this jumps out:

# config/test.c:63:4: warning: #warning "Feature THREAD_CPUTIME will not be available"
# config/test_recvmmsg.c: In function 'main':
# config/test_recvmmsg.c:6:1: warning: implicit declaration of function 'recvmmsg'
# /var/tmp//ccY4xAv2.o: In function `main':
# test_recvmmsg.c:(.text+0x3b): undefined reference to `recvmmsg'
# config/test_timerfd.c:1:25: fatal error: sys/timerfd.h: No such file or directory
# compilation terminated.
# W: Cannot find source file matching module 'core' in library core

v112.24.00 compiled and installed fine (although my code only uses a fraction of the functions in all the libraries that get pulled in for Async.)

Command notes

Some notes on using the Command module while writing an RWO chapter on it and noting some contrasts with Cmdliner. (these aren't necessarily feature requests, but I wanted to write it down somewhere)

  • There's no way to indicate the intended type of anonymous arguments? E.g.:
let add =
  Command.basic
    ~summary:"Add [days] to the [base] date and print day"
    Command.Spec.(
      empty
      +> anon ("base" %: date)
      +> anon ("days" %: int)
    )
  (fun base span () ->
    Date.add_days base span
    |> Date.to_string
    |> print_endline
  )

I can't indicate, except in the summary text directly, that base will be parsed as a date and days as an integer.

  • The error message from parsing a failed date is a little raw:
failed to parse base value "foo"
(Invalid_argument "Date.of_string (foo): (Failure \"invalid date: foo\")")
  • No man-page output as in Cmdliner.

Build failure with OCaml 4.02, Linux 3.16.3

On
Linux Hostname 3.16.3-1-ARCH #1 SMP PREEMPT Wed Sep 17 21:54:13 CEST 2014 x86_64 GNU/Linux

===== ERROR while installing core.111.28.00 =====
# opam-version 1.1.1
# os           linux
# command      make
# path         /home/sander/.opam/4.02.0+improved-errors/build/core.111.28.00
# compiler     4.02.0+improved-errors
# exit-code    2
# env-file     /home/sander/.opam/4.02.0+improved-errors/build/core.111.28.00/core-28307-5f1023.env
# stdout-file  /home/sander/.opam/4.02.0+improved-errors/build/core.111.28.00/core-28307-5f1023.out
# stderr-file  /home/sander/.opam/4.02.0+improved-errors/build/core.111.28.00/core-28307-5f1023.err
### stdout ###
# ...[truncated]
#      atime = caml_copy_double((double) buf->st_atime + (buf->st_atimensec / 1000000000.0f));
#                                                            ^
# lib/unix_stubs.c:447:59: error: ‘struct stat64’ has no member named ‘st_mtimensec’
#      mtime = caml_copy_double((double) buf->st_mtime + (buf->st_mtimensec / 1000000000.0f));
#                                                            ^
# lib/unix_stubs.c:448:59: error: ‘struct stat64’ has no member named ‘st_ctimensec’
#      ctime = caml_copy_double((double) buf->st_ctime + (buf->st_ctimensec / 1000000000.0f));
#                                                            ^
# Command exited with code 2.
# Makefile:21: recipe for target 'build' failed
### stderr ###
# ...[truncated]
# Warning 3: deprecated: String.set
# File "setup.ml", line 2500, characters 6-24:
# Warning 3: deprecated: Lazy.lazy_from_fun
# File "setup.ml", line 245, characters 8-26:
# Warning 3: deprecated: String.set
# File "setup.ml", line 2500, characters 6-24:
# Warning 3: deprecated: Lazy.lazy_from_fun
# W: Cannot find source file matching module 'core' in library core
# E: Failure("Command ''/home/sander/.opam/4.02.0+improved-errors/bin/ocamlbuild' lib/libcore_stubs.a lib/dllcore_stubs.so lib/core.cma lib/core.cmxa lib/core.a lib/core.cmxs top/core_top.cma top/core_top.cmxa top/core_top.a top/core_top.cmxs -use-ocamlfind -tag debug' terminated with error code 10")
# make: *** [build] Error 1

'opam install core' failed.

Compiled output not working in OSX

Hi there! I'm new to Ocaml and was trying to run a simple program detailed here https://realworldocaml.org/v1/en/html/a-guided-tour.html#a-complete-program. The program compiles without error but running ./sum.native immediately exits instead of waiting for user input.

I'm using Ocaml 4.03.0 which was installed through opam. I also installed core through opam. I'm using OSX El Capitan. Could the problem be with my installation of Ocaml or is this an issue with Core have some incompatibility with OSX?

core.112.17.00

With ocaml 4.02.1:

  • /home/berenger/.opam/4.01.0/bin/ocamlfind ocamlc -c -w +27 -annot -thread -g -annot -bin-annot -package batteries -package core -package dolog -package parmap -package str -o my_utils.cmo my_utils.ml
    File "my_utils.ml", line 21, characters 5-13:
    Error: Unbound module Core
    open Core.Std
    is the culprit line in the my_utils.ml file.

How can I fix it in order to compile?

Meta syntax package core.syntax does nothing

The core package define a meta syntax package:

package "syntax" (
 version = "109.32.00"
 description = "Metapackage for syntax extensions of the Core suite"
 requires = "sexplib.syntax fieldslib.syntax variantslib.syntax comparelib.syntax bin_prot.syntax custom_printf.syntax pa_pipebang herelib.syntax"
)

However using -package core.syntax doesn't activate the required syntax because it doesn't contains any archive(syntax,*)= . @gerdstolpmann gave a way for defining such syntax extension:

This is intentionally not possible, to allow the programmer to exactly
control which preprocessors are active (as the writer of the source code
I need to know which syntax is enabled). There is an easy workaround for
such meta packages, though: This package could define a null extension,
e.g.

package "syntax" (
version = "109.32.00"
description = "Metapackage for syntax extensions of the Core suite"
requires = "sexplib.syntax fieldslib.syntax variantslib.syntax
comparelib.syntax bin_prot.syntax custom_printf.syntax pa_pipebang
herelib.syntax"
archive(syntax,preprocessor) = "-ignore dummy"
)

or even

archive(syntax) = "defined"
archive(syntax,preprocessor) = ""
archive(syntax,toploop) = ""

because syntax extensions can be dependent on anything, including other
preprocessors.

Build failure on Raspberry Pi 2: lvalue required as left operand of assignment

I tried to install Core using Opam on Raspberry pi 2. opam install core fails with error:

# + /home/pi/.opam/4.02.1/bin/ocamlfind ocamlc -I lib -package core_kernel -c lib/linux_ext_stubs.c
# lib/linux_ext_stubs.c: In function ‘alloc_spec’:
# lib/linux_ext_stubs.c:527:27: error: lvalue required as left operand of assignment
#    Double_field(v_spec, 0) = spec->it_value.tv_sec + spec->it_value.tv_nsec / 1e9;
#                            ^
# lib/linux_ext_stubs.c:528:27: error: lvalue required as left operand of assignment
#    Double_field(v_spec, 1) = spec->it_interval.tv_sec + spec->it_interval.tv_nsec / 1e9;
#                            ^
# Command exited with code 2.
# Makefile:21: recipe for target 'build' failed

Stdout-file:

ocamlopt.opt -o setup.exe setup.ml || ocamlopt -o setup.exe setup.ml || ocamlc -o setup.exe setup.ml
rm -f setup.cmx setup.cmi setup.o setup.obj setup.cmo
./setup.exe -configure 

Configuration: 
ocamlfind: ........................................... /home/pi/.opam/4.02.1/bin/ocamlfind
ocamlc: .............................................. /home/pi/.opam/4.02.1/bin/ocamlc.opt
ocamlopt: ............................................ /home/pi/.opam/4.02.1/bin/ocamlopt.opt
ocamlbuild: .......................................... /home/pi/.opam/4.02.1/bin/ocamlbuild
Package name: ........................................ core
Package version: ..................................... 112.24.00
os_type: ............................................. Unix
system: .............................................. linux_eabihf
architecture: ........................................ arm
ccomp_type: .......................................... cc
ocaml_version: ....................................... 4.02.1
standard_library_default: ............................ /home/pi/.opam/4.02.1/lib/ocaml
standard_library: .................................... /home/pi/.opam/4.02.1/lib/ocaml
standard_runtime: .................................... /home/pi/.opam/4.02.1/bin/ocamlrun
bytecomp_c_compiler: ................................. gcc -fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC
native_c_compiler: ................................... gcc -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT
model: ............................................... default
ext_obj: ............................................. .o
ext_asm: ............................................. .s
ext_lib: ............................................. .a
ext_dll: ............................................. .so
default_executable_name: ............................. a.out
systhread_supported: ................................. true
Install architecture-independent files dir: .......... /home/pi/.opam/4.02.1
Install architecture-dependent files in dir: ......... $prefix
User executables: .................................... $exec_prefix/bin
System admin executables: ............................ $exec_prefix/sbin
Program executables: ................................. $exec_prefix/libexec
Read-only single-machine data: ....................... $prefix/etc
Modifiable architecture-independent data: ............ $prefix/com
Modifiable single-machine data: ...................... $prefix/var
Object code libraries: ............................... $exec_prefix/lib
Read-only arch-independent data root: ................ $prefix/share
Read-only architecture-independent data: ............. $datarootdir
Info documentation: .................................. $datarootdir/info
Locale-dependent data: ............................... $datarootdir/locale
Man documentation: ................................... $datarootdir/man
Documentation root: .................................. $datarootdir/doc/$pkg_name
HTML documentation: .................................. $docdir
DVI documentation: ................................... $docdir
PDF documentation: ................................... $docdir
PS documentation: .................................... $docdir
findlib_version: ..................................... 1.5.5
is_native: ........................................... true
suffix_program: ...................................... 
Remove a file.: ...................................... rm -f
Remove a directory.: ................................. rm -rf
Turn ocaml debug flag on: ............................ true
Turn ocaml profile flag on: .......................... false
Compiler support generation of .cmxs.: ............... true
OCamlbuild additional flags: ......................... 
Enable linux specific extensions: .................... true
Enable POSIX timers: ................................. true
Linux RT Library: .................................... true
Create documentations: ............................... true
Compile tests executable and library and run them: ... false
camlp4o: ............................................. /home/pi/.opam/4.02.1/bin/camlp4o
pkg_bigarray: ........................................ /home/pi/.opam/4.02.1/lib/ocaml
pkg_bin_prot: ........................................ /home/pi/.opam/4.02.1/lib/bin_prot
pkg_bin_prot_syntax: ................................. /home/pi/.opam/4.02.1/lib/bin_prot
pkg_comparelib_syntax: ............................... /home/pi/.opam/4.02.1/lib/comparelib
pkg_core_kernel: ..................................... /home/pi/.opam/4.02.1/lib/core_kernel
pkg_custom_printf: ................................... /home/pi/.opam/4.02.1/lib/custom_printf
pkg_custom_printf_syntax: ............................ /home/pi/.opam/4.02.1/lib/custom_printf
pkg_enumerate_syntax: ................................ /home/pi/.opam/4.02.1/lib/enumerate
pkg_fieldslib: ....................................... /home/pi/.opam/4.02.1/lib/fieldslib
pkg_fieldslib_syntax: ................................ /home/pi/.opam/4.02.1/lib/fieldslib
pkg_herelib: ......................................... /home/pi/.opam/4.02.1/lib/herelib
pkg_herelib_syntax: .................................. /home/pi/.opam/4.02.1/lib/herelib
pkg_pa_bench: ........................................ /home/pi/.opam/4.02.1/lib/pa_bench
pkg_pa_bench_syntax: ................................. /home/pi/.opam/4.02.1/lib/pa_bench
pkg_pa_ounit: ........................................ /home/pi/.opam/4.02.1/lib/pa_ounit
pkg_pa_ounit_syntax: ................................. /home/pi/.opam/4.02.1/lib/pa_ounit
pkg_pa_pipebang: ..................................... /home/pi/.opam/4.02.1/lib/pa_pipebang
pkg_pa_test: ......................................... /home/pi/.opam/4.02.1/lib/pa_test
pkg_pa_test_syntax: .................................. /home/pi/.opam/4.02.1/lib/pa_test
pkg_sexplib: ......................................... /home/pi/.opam/4.02.1/lib/sexplib
pkg_sexplib_syntax: .................................. /home/pi/.opam/4.02.1/lib/sexplib
pkg_sexplib_unix: .................................... /home/pi/.opam/4.02.1/lib/sexplib_unix
pkg_typerep_lib: ..................................... /home/pi/.opam/4.02.1/lib/typerep_lib
pkg_typerep_lib_syntax: .............................. /home/pi/.opam/4.02.1/lib/typerep_lib
pkg_unix: ............................................ /home/pi/.opam/4.02.1/lib/ocaml
pkg_variantslib: ..................................... /home/pi/.opam/4.02.1/lib/variantslib
pkg_variantslib_syntax: .............................. /home/pi/.opam/4.02.1/lib/variantslib
pkg_threads: ......................................... /home/pi/.opam/4.02.1/lib/ocaml
pkg_compiler_libs: ................................... /home/pi/.opam/4.02.1/lib/ocaml/compiler-libs

./setup.exe -build 
ocamlfind ocamlopt unix.cmxa -I /home/pi/.opam/4.02.1/lib/ocaml/ocamlbuild /home/pi/.opam/4.02.1/lib/ocaml/ocamlbuild/ocamlbuildlib.cmxa -linkpkg myocamlbuild.ml /home/pi/.opam/4.02.1/lib/ocaml/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
/home/pi/.opam/4.02.1/bin/ocamlfind ocamlc -I lib -package core_kernel -c lib/bigstring_stubs.c
mv bigstring_stubs.o lib/bigstring_stubs.o
/home/pi/.opam/4.02.1/bin/ocamlfind ocamlc -I lib -package core_kernel -c lib/crc_stubs.c
mv crc_stubs.o lib/crc_stubs.o
/home/pi/.opam/4.02.1/bin/ocamlfind ocamlc -I lib -package core_kernel -c lib/iobuf_stubs.c
mv iobuf_stubs.o lib/iobuf_stubs.o
/home/pi/.opam/4.02.1/bin/ocamlfind ocamlc -I lib -package core_kernel -c lib/linux_ext_stubs.c
+ /home/pi/.opam/4.02.1/bin/ocamlfind ocamlc -I lib -package core_kernel -c lib/linux_ext_stubs.c
lib/linux_ext_stubs.c: In function ‘alloc_spec’:
lib/linux_ext_stubs.c:527:27: error: lvalue required as left operand of assignment
   Double_field(v_spec, 0) = spec->it_value.tv_sec + spec->it_value.tv_nsec / 1e9;
                           ^
lib/linux_ext_stubs.c:528:27: error: lvalue required as left operand of assignment
   Double_field(v_spec, 1) = spec->it_interval.tv_sec + spec->it_interval.tv_nsec / 1e9;
                           ^
Command exited with code 2.
Makefile:21: recipe for target 'build' failed

Stderr-file:

W: Cannot find source file matching module 'core' in library core
E: Failure("Command ''/home/pi/.opam/4.02.1/bin/ocamlbuild' lib/libcore_stubs.a lib/dllcore_stubs.so lib/core.cma lib/core.cmxa lib/core.a lib/core.cmxs top/core_top.cma top/core_top.cmxa top/core_top.a top/core_top.cmxs -use-ocamlfind -tag debug' terminated with error code 10")
make: *** [build] Error 1

Env-file:

PATH=/home/pi/.opam/4.02.1/bin:/home/pi/sw/opam/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
OCAML_TOPLEVEL_PATH=/home/pi/.opam/4.02.1/lib/toplevel
PERL5LIB=/home/pi/.opam/4.02.1/lib/perl5:
MANPATH=:/home/pi/.opam/4.02.1/man
OPAMSWITCH=4.02.1
CAML_LD_LIBRARY_PATH=/home/pi/.opam/4.02.1/lib/stublibs
XDG_SESSION_ID=c18
TERM=xterm
SHELL=/bin/bash
MAKEFLAGS=
SSH_CLIENT=192.168.0.11 48865 22
SSH_TTY=/dev/pts/0
USER=pi
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.axa=00;36:*.oga=00;36:*.spx=00;36:*.xspf=00;36:
MAKELEVEL=
MAIL=/var/mail/pi
PWD=/home/pi
LANG=en_GB.UTF-8
SHLVL=1
HOME=/home/pi
LOGNAME=pi
SSH_CONNECTION=192.168.0.11 48865 192.168.0.12 22
XDG_RUNTIME_DIR=/run/user/1000
_=/home/pi/sw/opam/bin/opam
OPAM_PACKAGE_VERSION=112.24.01
OPAM_PACKAGE_NAME=core
MAKELEVEL=
MAKEFLAGS=

Ubuntu 32 bit install failure

install failure in my machine. so I use vagrant to install a clean vm, and get the same error.

I am learning ocaml, so this is not critical to me, just to submit a error report. Thanks.
ubuntu is 12.04 LTS

vagrant init hashicorp/precise32
=-=-= Installing core.111.11.00 =-=-=
default    Downloading https://opam.ocaml.org/archives/core.111.11.00+opam.tar.gz
Downloading https://opam.ocaml.org/archives/core.111.11.00+opam.tar.gz
Building core.111.11.00:
  ocaml setup.ml -configure --prefix /home/vagrant/.opam/system
  make
  make install
[ERROR] The compilation of core.111.11.00 failed.
Removing core.111.11.00.
  ocamlfind remove core


===== ERROR while installing core.111.11.00 =====
# opam-version 1.1.1
# os           linux
# command      make
# path         /home/vagrant/.opam/system/build/core.111.11.00
# compiler     system (4.01.0)
# exit-code    2
# env-file     /home/vagrant/.opam/system/build/core.111.11.00/core-23058-8b8a2d.env
# stdout-file  /home/vagrant/.opam/system/build/core.111.11.00/core-23058-8b8a2d.out
# stderr-file  /home/vagrant/.opam/system/build/core.111.11.00/core-23058-8b8a2d.err
### stdout ###
# ...[truncated]
# /home/vagrant/.opam/system/bin/ocamlfind ocamlc -c -g -syntax camlp4o -thread -package variantslib.syntax -package variantslib -package unix -package threads -package sexplib_unix -package sexplib.syntax -package sexplib -package pa_test.syntax -package pa_test -package pa_pipebang -package pa_ounit.syntax -package pa_ounit -package pa_bench.syntax -package pa_bench -package herelib.syntax -package herelib -package fieldslib.syntax -package fieldslib -package enumerate.syntax -package core_kernel -package comparelib.syntax -package bin_prot.syntax -package bin_prot -package bigarray -ppopt -pa-ounit-lib -ppopt core -I lib -o lib/span.cmi lib/span.mli
# /home/vagrant/.opam/system/bin/ocamlfind ocamldep -ppopt -Ilib/ -syntax camlp4o -package variantslib.syntax -package variantslib -package unix -package threads -package sexplib_unix -package sexplib.syntax -package sexplib -package pa_test.syntax -package pa_test -package pa_pipebang -package pa_ounit.syntax -package pa_ounit -package pa_bench.syntax -package pa_bench -package herelib.syntax -package herelib -package fieldslib.syntax -package fieldslib -package enumerate.syntax -package core_kernel -package comparelib.syntax -package bin_prot.syntax -package bin_prot -package bigarray -package camlp4.macro -ppopt -pa-ounit-lib -ppopt core -modules lib/time_internal.ml > lib/time_internal.ml.depends
# + /home/vagrant/.opam/system/bin/ocamlfind ocamldep -ppopt -Ilib/ -syntax camlp4o -package variantslib.syntax -package variantslib -package unix -package threads -package sexplib_unix -package sexplib.syntax -package sexplib -package pa_test.syntax -package pa_test -package pa_pipebang -package pa_ounit.syntax -package pa_ounit -package pa_bench.syntax -package pa_bench -package herelib.syntax -package herelib -package fieldslib.syntax -package fieldslib -package enumerate.syntax -package core_kernel -package comparelib.syntax -package bin_prot.syntax -package bin_prot -package bigarray -package camlp4.macro -ppopt -pa-ounit-lib -ppopt core -modules lib/time_internal.ml > lib/time_internal.ml.depends
# File "lib/time_internal.ml", line 9, characters 25-35:
# Integer literal exceeds the range of representable integers of type int
# Preprocessing error on file lib/time_internal.ml
# Error while running external preprocessor
# Command line: camlp4 '-I' '/usr/lib/ocaml/camlp4' '-I' '/home/vagrant/.opam/system/lib/type_conv' '-I' '/home/vagrant/.opam/system/lib/variantslib' '-I' '/home/vagrant/.opam/system/lib/variantslib' '-I' '/usr/lib/ocaml' '-I' '/usr/lib/ocaml' '-I' '/home/vagrant/.opam/system/lib/sexplib' '-I' '/home/vagrant/.opam/system/lib/sexplib' '-I' '/home/vagrant/.opam/system/lib/comparelib' '-I' '/home/vagrant/.opam/system/lib/comparelib' '-I' '/home/vagrant/.opam/system/lib/pa_test' '-I' '/home/vagrant/.opam/system/lib/pa_pipebang' '-I' '/home/vagrant/.opam/system/lib/pa_ounit' '-I' '/home/vagrant/.opam/system/lib/oUnit' '-I' '/home/vagrant/.opam/system/lib/oUnit' '-I' '/home/vagrant/.opam/system/lib/pa_ounit' '-I' '/home/vagrant/.opam/system/lib/pa_bench' '-I' '/home/vagrant/.opam/system/lib/herelib' '-I' '/home/vagrant/.opam/system/lib/fieldslib' '-I' '/home/vagrant/.opam/system/lib/fieldslib' '-I' '/home/vagrant/.opam/system/lib/enumerate' '-I' '/home/vagrant/.opam/system/lib/bin_prot' '-I' '/home/vagrant/.opam/system/lib/bin_prot' '-I' '/usr/lib/ocaml/camlp4' '-parser' 'o' '-parser' 'op' '-printer' 'p' 'pa_type_conv.cma' 'variantslib.cma' 'pa_variants_conv.cma' 'unix.cma' 'bigarray.cma' 'sexplib.cma' 'pa_sexp_conv.cma' 'comparelib.cma' 'pa_compare.cma' 'pa_test_syntax.cma' 'pa_pipebang.cma' 'pa_ounit_syntax.cma' 'oUnitAdvanced.cma' 'oUnit.cma' 'pa_ounit_lib.cma' 'pa_bench_syntax.cma' 'pa_herelib.cma' 'fieldslib.cma' 'pa_fields_conv.cma' 'enumerate.cma' 'bin_prot.cma' 'pa_bin_prot.cma' '-parser' 'Camlp4MacroParser' '-Ilib/' '-pa-ounit-lib' 'core' 'lib/time_internal.ml' > /tmp/ocamlppca4a37
# 
# Command exited with code 2.
### stderr ###
# /bin/sh: 1: ocamlopt.opt: not found
# W: Cannot find source file matching module 'core' in library core
# E: Failure("Command ''/usr/bin/ocamlbuild' lib/libcore_stubs.a lib/dllcore_stubs.so lib/core.cma lib/core.cmxa lib/core.a lib/core.cmxs top/core_top.cma top/core_top.cmxa top/core_top.a top/core_top.cmxs -use-ocamlfind -tag debug' terminated with error code 10")
# make: *** [build] Error 1


The former state can be restored with opam switch import -f "/home/vagrant/.opam/system/backup/state-20140404173318.export"
'opam install core' failed.
vagrant@precise32:~$ 

80 chars wide

Many .mli files have documentation improperly wrapped at 80 chars. It would be nice if this was changed.

While doing that, some remaining O'Caml (e.g. in signal.mli) could be renamed OCaml.

Unbound value Time_ns.*

Hi,
When I load toplevel, there are a few errors, and they seem be caused by core_top. Here is the output snippet from running ocaml:

/home/xin/.opam/4.02.1/lib/core/core_top.cma: loaded
Unbound value Time_ns.Ofday.pp.
Unbound value Time_ns.pp.
Unbound value Time_ns.Option.pp.
Unbound value Time_ns.Span.Option.pp.
Unbound value Time_ns.Span.pp.

My .ocamlinit:

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

#use "topfind";;
#thread;;
#camlp4o;;
#require "batteries";;
#require "core.top";;
#require "core.syntax";;
open Core.Std

Thanks!

EDIT: installed-version: 112.06.01 [4.02.1]

Time.of_string should return a Result.t

Time.of_string currently raises an exception when it fails to parse the given string.

According to Core's coding style, there should be two versions of this function:

val of_string : string -> (t, string) Result.t (* or t Option.t *)
val of_string_exn : string -> t

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.