Can't install core with opam. Build error.

180 views
Skip to first unread message

Soumik Rakshit

unread,
Sep 20, 2014, 12:51:39 PM9/20/14
to ocaml...@googlegroups.com
I started reading Real World Ocaml. I am unable to install the Core library with opam. Here is the error report -

└─$ 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



Soumik Rakshit

unread,
Sep 20, 2014, 12:55:45 PM9/20/14
to ocaml...@googlegroups.com

I am running Arch Linux 64 bit with the 'opam-git' AUR package.
$ 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

Ocaml version is 4.02.0
$ pacman -Q ocaml
ocaml
4.02.0-1


Soumik Rakshit

unread,
Sep 20, 2014, 2:25:38 PM9/20/14
to ocaml...@googlegroups.com
OK. I changed lines 447-449. Directly using st_atim.tv_nsec instead of the atimensec macros, as it is being done in case _BSD_SOURCE (line 438) and Core is now building and seems to work.


    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));


Yaron Minsky

unread,
Sep 21, 2014, 7:28:37 AM9/21/14
to ocaml...@googlegroups.com
Thanks for doing the spelunking. Would you mind submitting the fix as
a PR on github? (or as an explicit patch by email).

y
> --
> You received this message because you are subscribed to the Google Groups
> "ocaml-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ocaml-core+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

tcar...@googlemail.com

unread,
Sep 23, 2014, 3:22:50 PM9/23/14
to ocaml...@googlegroups.com
Hello,

Same problem with me on Archlinux 3.16.3-1-ARCH kernel, ocaml 4.02.0-1.

I'm not a developer and not certain why the code doesn't work. man 2 stat 'NOTES' section claims that if none of the [included macros] are defined then st_atimensec should be exposed. Not sure where to look to figure out why it apparently isn't.

Sincerely,
T

dsw...@gmail.com

unread,
Sep 25, 2014, 3:36:17 PM9/25/14
to ocaml...@googlegroups.com
I'm also experience this issue on Arch Linux. It doesn't look like there's a pull request for this feature on the repo either. I could try and submit this change as well, but I'm unsure about any sort of testing I should be doing besides making sure it still builds correctly. Are there any other instructions I should follow before attempting to figure out the pull request? I'm also new to OCaml and would like to be able to try these tools.

s...@srparish.net

unread,
Oct 6, 2014, 11:28:14 PM10/6/14
to ocaml...@googlegroups.com
I'm hitting this same problem. How do I go about getting opam to build core from the pull request branch, or against a local checkout of core with the patch applied?

Thanks

Soumik Rakshit

unread,
Oct 8, 2014, 12:29:45 AM10/8/14
to ocaml...@googlegroups.com
Hello. The patch uploaded (not by me) is the proper way to portably do it, it seems and it builds successfully. So core developers, please merge it. The way I suggested is not really the proper way to do it. (On a side note, I'm sorry Mr Minsky, I was out for a few days and had exams and couldn't send a github pull request as you suggested :( ).  Really enjoying Real World Ocaml btw!

jeff.t...@gmail.com

unread,
Oct 22, 2014, 11:25:47 AM10/22/14
to ocaml...@googlegroups.com
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. 

How to proceed?

I'm also on Arch Linux with opam 1.1.1 from AUR (released version, not opam-git). 

Thanks,
Jeff

Jeremie Dimino

unread,
Oct 23, 2014, 8:41:39 AM10/23/14
to ocaml...@googlegroups.com
On Wed, Oct 22, 2014 at 4:25 PM, <jeff.t...@gmail.com> wrote:
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. 

You need to 'pin' your local version of code:

  opan pin add core <path-to-your-local-copy>

Then opam will pick core from this location.

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. 

There is a fix in the git repo, we are going to do a minor release today.
 
--
Jeremie
Reply all
Reply to author
Forward
0 new messages