└─$ opam install core
The following actions will be performed:
- install core.111.28.00
=== 1 to install ===
=-=- Synchronizing package archives -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
=-=- Installing packages =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Building core.111.28.00:
ocaml setup.ml -configure --prefix /home/snyp/.opam/system
make
make install
[ERROR] The compilation of core.111.28.00 failed.
Removing core.111.28.00.
ocamlfind remove core
#=== ERROR while installing core.111.28.00 ====================================#
# opam-version 1.2.0 (1a1e5af82336879c585dfad4d71a01873f9c51fe)
# os linux
# command make
# path /home/snyp/.opam/system/build/core.111.28.00
# compiler system (4.02.0)
# exit-code 2
# env-file /home/snyp/.opam/system/build/core.111.28.00/core-24399-c61e7b.env
# stdout-file /home/snyp/.opam/system/build/core.111.28.00/core-24399-c61e7b.out
# stderr-file /home/snyp/.opam/system/build/core.111.28.00/core-24399-c61e7b.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 ''/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
$ uname -a
Linux tincan 3.10.55-1-lts310-ck #1 SMP PREEMPT Sat Sep 20 19:45:12 IST 2014 x86_64 GNU/Linux
$ pacman -Q ocaml
ocaml 4.02.0-1
atime = caml_copy_double((double) buf->st_atime + (buf->st_atim.tv_nsec / 1000000000.0f));
mtime = caml_copy_double((double) buf->st_mtime + (buf->st_mtim.tv_nsec / 1000000000.0f));
ctime = caml_copy_double((double) buf->st_ctime + (buf->st_ctim.tv_nsec / 1000000000.0f));
I have tried to modify lib/unix_stubs.c and when I run ocaml setup.ml -build, that works, then I run ocaml setup.ml -install and that works, but then I try opam install core_bench (.. also reading Real World OCaml...) and it doesn't seem to find the built version of core I just did and so tries to install it again and it breaks as described in the OP.
In my case, man stat64 indicates I should be using buf->st_atime et.al. for backward compatibility which is how I changed unix_stubs.c, which seemed to build just fine except that opam doesn't see it that way.