solvuu / solvuu-build

DEPRECATED. We recommend Jane Street's dune (formerly jbuilder).
ISC License
24 stars 5 forks source link

make native fails after make #45

Closed copy closed 7 years ago

copy commented 7 years ago

Here's a minimal reproducing test case:

open Solvuu_build.Std

let project_name = "test"

let lib = Project.lib project_name
  ~dir:"lib"
  ~style:(`Pack project_name)
  ~pkg:project_name

let app = Project.app "main"
  ~internal_deps:[lib]
  ~file:"main.ml"

let () = Project.basic1 ~project_name ~version:"dev" [lib; app]
(* main.ml *)
module F = Test.Test

lib/test.ml is an empty file.

Here's log output with increased verbosity:

$ make native
ocamlbuild -verbose 5 -tag 'optimize(3)' -use-ocamlfind -plugin-tag "package(solvuu-build)" project.mk
include directories are: [ "." ]
ocamlfind ocamlopt -package unix -package ocamlbuild -linkpkg -package solvuu-build myocamlbuild.ml /home/fabian/.opam/4.03.0+flambda/lib/ocamlbuild/ocamlbuild.cmx -o myocamlbuild
Doing sanity checks
include directories are: [ "." ]
==> project.mk
start rule project.mk ()
mid rule project.mk (): cache miss: a product is not in build dir (project.mk)
mkdir -p .
end rule project.mk ()
ocamlbuild -verbose 5 -tag 'optimize(3)' -use-ocamlfind -plugin-tag "package(solvuu-build)" ./test.cmxa
include directories are: [ "." ]
Doing sanity checks
include directories are: [ "." ]
==> test.cmxa
====> test.cmx
======> lib/test.ml
lib/test.ml exists in source dir -> import it
start rule lib/test.ml -> test.cmx ()
======> lib/test.cmx
========> lib/test.ml
lib/test.ml already built
start rule lib/test.ml -> lib/test.cmx,lib/test.cmi ()
mid rule lib/test.ml -> lib/test.cmx,lib/test.cmi (): cache miss: a product is not in build dir (lib/test.cmx)
ocamlfind ocamlopt -c -for-pack Test -I lib -o lib/test.cmx -package '' lib/test.ml
end rule lib/test.ml -> lib/test.cmx,lib/test.cmi ()
mid rule lib/test.ml -> test.cmx (): cache miss: a product is not in build dir (test.cmx)
ocamlfind ocamlopt -o ./test.cmx -pack lib/test.cmx
+ ocamlfind ocamlopt -o ./test.cmx -pack lib/test.cmx
Fatal error: exception File "middle_end/closure_conversion.ml", line 407, characters 4-10: Assertion failed
Command exited with code 2.
make: *** [_build/project.mk:4: _build/./test.cmxa] Error 10
copy commented 7 years ago

Actually the issue happens also if you don't run make first, I misinterpreted some behaviour.

agarwal commented 7 years ago

I'm unsure if this is a solvuu-build issue. If you rename test.ml to something else like a.ml, then it works fine. Note your error is an assertion from the compiler. I get a different error but also from the compiler:

ocamlbuild -use-ocamlfind -no-links -plugin-tag "package(solvuu-build)" ./test.cmxa
Finished, 0 targets (0 cached) in 00:00:00.
+ ocamlfind ocamlopt -o ./test.cmx -pack lib/test.cmx
Fatal error: exception Stack overflow
Raised at file "asmcomp/asmgen.ml", line 152, characters 12-15
Re-raised at file "asmcomp/asmgen.ml", line 163, characters 10-13
Called from file "asmcomp/asmgen.ml", line 248, characters 2-110
Called from file "asmcomp/asmpackager.ml", line 233, characters 2-72
Called from file "asmcomp/asmpackager.ml", line 257, characters 4-89
Re-raised at file "asmcomp/asmpackager.ml", line 261, characters 10-11
Called from file "driver/optmain.ml", line 292, characters 6-103
Re-raised at file "parsing/location.ml", line 442, characters 20-23
Re-raised at file "parsing/location.ml", line 442, characters 20-23
Re-raised at file "parsing/location.ml", line 442, characters 20-23
Re-raised at file "parsing/location.ml", line 442, characters 20-23
Re-raised at file "parsing/location.ml", line 442, characters 20-23
Re-raised at file "parsing/location.ml", line 442, characters 20-23
Called from file "driver/optmain.ml", line 323, characters 6-37
Called from file "utils/timings.ml", line 69, characters 10-13
Command exited with code 2.
Compilation unsuccessful after building 2 targets (0 cached) in 00:00:00.
make: *** [_build/./test.cmxa] Error 10
agarwal commented 7 years ago

I get a different error

Which might be simply because I wasn't on an flambda enabled compiler.

copy commented 7 years ago

Indeed, it isn't a problem with solvuu-build. The problem appears when using ~style:(`Pack pack_name) and there's a file with the pack name in the library directory. It's this issue: https://caml.inria.fr/mantis/view.php?id=6537