xclerc / ocamljava

http://www.ocamljava.org
Other
172 stars 14 forks source link

Can't build from source #27

Open Vertmo opened 5 years ago

Vertmo commented 5 years ago

When trying to build the whole project from source, at step 7 (build and install extended ocamlbuild), compilation is giving the following error:

/home/vertmo/.opam/ocj/bin/ocamljava.opt unix.cmja -java-package ocaml.tools.ocamlbuild ocamlbuild_pack.cmj ocamlbuildlight.cmj -o ocamlbuildlight.jar                  
File "_none_", line 1:                                                                                                                                                    
Error: Error during linking:                                                                                                                                              
unable to read entry ("ocaml/tools/ocamlbuild/Options.class")                                                                                                             
Command exited with code 2.

This is happening both with alpha3 and alpha4. I've tried changing my ocaml version (between 4.01.0 and 4.07.1), but I haven't had any success... Anyone ever encountered this problem ?

xclerc commented 5 years ago

It looks like it fails when trying to link the first .jar file. Could you try to use ocamljava.opt on an empty .ml file to check whether this is indeed the problem?

Vertmo commented 5 years ago

Compiling an empty program does work without any issue. I think the problem may be coming from the patch applied to the ocamlbuild source before ocamlbuild is compiled (as it does touch the Options module), but I can't find how the original ocamlbuild source is downloaded. When blocking said patch (by commenting out lines 30 and 46 in compiler/ocamlbuild/Makefile-ocamljava) the compilation of ocamlbuild works successfully, but the next step fails, as the unpatched version of ocamlbuild can't handle building .cmja targets. Maybe the changes made to ocamlbuild since the last change to ocamljava have broken something ?

xclerc commented 5 years ago

Indeed, it looks like there is something broken with the bootstrap of ocamlbuild. However, the problem should not come from changes made to ocamlbuild since its sources are vendored.

I wonder whether the problem could come from failing to load Java elements. Which version of Java are you using?

Vertmo commented 5 years ago

I was trying with Java 8 (openjdk version "1.8.0_192"), With Java 7 (openjdk version "1.7.0_171") the error is a bit different:

+ /home/vertmo/.opam/ocj2/bin/ocamljava.opt -c -annot -w L -w R -w Z -java-package ocaml.tools.ocamlbuild -for-pack Ocamlbuild_pack -o plugin.cmj plugin.ml               
File "plugin.ml", line 1:                                                                                                                                                 
Error: Java error:                                                                                                                                                        
unable to write data                                                                                                                                                      
Command exited with code 2.

It still happends during the ocamlbuild step tough.