janestreet / base

Standard library for OCaml
MIT License
860 stars 125 forks source link

Build through opam fails - Unbound module Cmo_format #82

Closed tigerjack closed 5 years ago

tigerjack commented 5 years ago

As the title says, I got the following error when installing base through opam.

ocamlc compiler-stdlib/gen/.gen.eobjs/byte/gen.{cmi,cmo,cmt} (exit 2) (cd _build/default && /usr/bin/ocamlc.opt -w -40 -g -bin-annot -I compiler-stdlib/gen/.gen.eobjs/byte -I /usr/lib/ocaml/compiler-libs -no-alias-deps -o compiler-stdlib/gen/.gen.eobjs/byte/gen.cmo -c -impl compiler-stdlib/gen/gen.ml) File "compiler-stdlib/gen/gen.ml", line 59, characters 33-51: 59 | let toc = (input_value ic : Cmo_format.library) in ^^^^^^^^^^^^^^^^^^ Error: Unbound module Cmo_format

Do you know how to fix it? Thanks in advance.

hhugo commented 5 years ago

Which version are you trying to build ?

hhugo commented 5 years ago

Also, what version of the ocaml compiler do you use ?

tigerjack commented 5 years ago

I was trying to build the default version provided by opam (I think), that is v0.12.2. For the compiler part, I'm using version 4.09.0-1 provided by Archlinux.

hhugo commented 5 years ago

There seems to be an issue with your ocaml installation The file cmo_format.cmi seem to be missing from /usr/lib/ocaml/compiler-libs/

tigerjack commented 5 years ago

@hhugo you're right, I have no such file. Is there any way I can install it? I have found no solution up to now.

hhugo commented 5 years ago

Try installing ocaml-compiler-libs https://www.archlinux.org/packages/extra/x86_64/ocaml-compiler-libs/

tigerjack commented 5 years ago

Sorry, maybe I wasn't so clear. I already installed that package from the official Arch repository. The problem is that it doesn't contain the cmo_format.cmi file, as you can see here. Is it possible that this file was added recently and it is still not added to the Arch package? Do you know any other way to get the compiler libs?

hhugo commented 5 years ago

That file was always part of the ocaml compiler distribution. I believe the arch package is broken. cmo_format use to be located under the bytecomp/ directory but starting with ocaml 4.09, it was moved under the file_formats/ directory. Please report the issue to the maintainer of the arch package.