I’m (re)-learning OCaml, and I hit a snag while trying to compile a simple program:
open Core
let print_current_dir_files () =
Sys.readdir "."
|> Array.to_list
|> String.concat ~sep:"\n\t"
|> printf "Files: \n\t%s\n"
let () =
print_current_dir_files()
This code works in coretop
, but when I try to compile it, that’s what I get:
$ corebuild src/hello_world.native
+ ocamlfind ocamlopt -linkpkg -g -thread -package base -package core_kernel -package core -I src src/hello_world.cmx -o src/hello_world.native
File "_none_", line 1:
Error: No implementations provided for the following modules:
Core_kernel__ referenced from src/hello_world.cmx
Core__ referenced from src/hello_world.cmx
Command exited with code 2.
Compilation unsuccessful after building 4 targets (0 cached) in 00:00:00.
I tried adding -pkg
flags, creating _tags
, running it with manual linking via ocamlbuild
, but nothing works.
I have Merlin and utop working without problem with Core. OCaml 4.06.1 is installed with asdf OCaml plugin. Some more debug output:
$ ocamlfind query core
/home/lakret/.asdf/installs/ocaml/4.06.1/4.06.1/lib/core
$ ocamlfind query core_kernel
/home/lakret/.asdf/installs/ocaml/4.06.1/4.06.1/lib/core_kernel
Compiling sample files without Core dependency is working fine.
Any ideas? Maybe I’m missing something?