ocamljava icon indicating copy to clipboard operation
ocamljava copied to clipboard

Can't build from source

Open Vertmo opened this issue 6 years ago • 4 comments

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 ?

Vertmo avatar Dec 22 '18 19:12 Vertmo

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?

xclerc avatar Jan 02 '19 19:01 xclerc

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 ?

Vertmo avatar Jan 02 '19 22:01 Vertmo

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?

xclerc avatar Jan 21 '19 08:01 xclerc

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.

Vertmo avatar Jan 21 '19 09:01 Vertmo