# Help getting started: compiling sum.ml from RWO Chapter 1

**URL:** <https://discuss.ocaml.org/t/help-getting-started-compiling-sum-ml-from-rwo-chapter-1/1677>\
**Category:** Learning\
**Created:** [March 7, 2018, 10:21am UTC](https://discuss.ocaml.org/t/help-getting-started-compiling-sum-ml-from-rwo-chapter-1/1677 "2018-03-07T10:21:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xxfelixxx](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/xxfelixxx/32/878_2.png) [@xxfelixxx](https://discuss.ocaml.org/u/xxfelixxx)\
**Post date:** [March 7, 2018, 10:21am UTC](https://discuss.ocaml.org/t/help-getting-started-compiling-sum-ml-from-rwo-chapter-1/1677/1 "2018-03-07T10:21:44Z")

</div>

Following along in Chapter 1 of RWO, I get to the final program:

**sum.ml**

```
open Core
   
let rec read_and_accumulate accum =
  let line = In_channel.input_line In_channel.stdin in
  match line with
  | None -> accum
  | Some x -> read_and_accumulate ( accum +. Float.of_string x )

let () =
  printf "Total: %F\n" (read_and_accumulate 0.)

```

I have **Core** successfully installed via _opam_, but when I try to compile it using _corebuild_ I get:

```
corebuild sum.native
ocamlfind ocamlopt -linkpkg -g -thread -package core sum.cmx -o sum.native
+ ocamlfind ocamlopt -linkpkg -g -thread -package core sum.cmx -o sum.native
File "_none_", line 1:
Error: No implementations provided for the following modules:
         Stdio__ referenced from sum.cmx
         Core_kernel__ referenced from sum.cmx
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

```

Any ideas on how to proceed? I am running OCaml v4.06.1 with Core v0.10.0 on RHEL 7.4 with opam v1.2.2.

---

<div class="post-metadata">

**Author:** ![jeremiedimino](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/jeremiedimino/32/699_2.png) [@jeremiedimino](https://discuss.ocaml.org/u/jeremiedimino)\
**Post date:** [March 7, 2018, 10:32am UTC](https://discuss.ocaml.org/t/help-getting-started-compiling-sum-ml-from-rwo-chapter-1/1677/2 "2018-03-07T10:32:51Z")

</div>

This is due to a regression in jbuilder beta18. Pinning Jbuilder to beta17 should fix the issue.

BTW, `corebuild` is no longer expected to work. I think RWO is getting updated. The recommended way is to write a jbuild file as follow:

```auto
(executable
 ((name sum)
  (libraries (core))))

```

and build and run the executable with:

```bash
$ jbuilder exec ./sum.exe

```

---

<div class="post-metadata">

**Author:** ![xxfelixxx](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/xxfelixxx/32/878_2.png) [@xxfelixxx](https://discuss.ocaml.org/u/xxfelixxx)\
**Post date:** [March 7, 2018, 10:51am UTC](https://discuss.ocaml.org/t/help-getting-started-compiling-sum-ml-from-rwo-chapter-1/1677/3 "2018-03-07T10:51:10Z")

</div>

That worked, thanks!

Pinning jbuilder was done by:

```
opam pin add jbuilder 1.0+beta17
```
