Build OpenCV3.4.1 from source on Ubuntu 16.04, but failed to generate Java bindings

asked 2018-02-27 08:46:33 -0500

BAHRAMUDIN ADIL gravatar image

updated 2018-02-27 10:34:33 -0500

I am trying to build OpenCV from source on Ubuntu to within a Java application, but when during processing make command, when it reaches to generate Java bindings it fails with the following error:

> [ 90%] Generate files for Java
> bindings Traceback (most recent call
> last): File
> "/home/adil/Desktop/opencv/opencv/modules/java/generator/../generator/gen_java.py",
> line 1093, in
> copy_java_files(java_files_dir,
> target_path) File
> "/home/adil/Desktop/opencv/opencv/modules/java/generator/../generator/gen_java.py",
> line 1042, in copy_java_files
> package_path = 'org/opencv/' + module
> NameError: global name 'module' is not
> defined
> modules/java_bindings_generator/CMakeFiles/gen_opencv_java_source.dir/build.make:430:
> recipe for target
> 'CMakeFiles/dephelper/gen_opencv_java_source'
> failed make[2]: *
> [CMakeFiles/dephelper/gen_opencv_java_source]
> Error 1 CMakeFiles/Makefile2:2799:
> recipe for target
> 'modules/java_bindings_generator/CMakeFiles/gen_opencv_java_source.dir/all'
> failed make[1]: *
> [modules/java_bindings_generator/CMakeFiles/gen_opencv_java_source.dir/all]
> Error 2 Makefile:160: recipe for
> target 'all' failed make: *** [all]
> Error 2

I have installed every possible lib suggested on the Google and OpenCV website, nothing was solved the problem.

So what causes this error, and how solve?

Note: I have Java-9 installed on my machine.

edit retag flag offensive close merge delete

Comments

opencv version ?

the generator script tried to copy files to build/modules/java_bindings_generator/gen/java/org/opencv

but it couldn't. find out why.

I have installed every possible lib suggested -- not the problem here.

berak gravatar imageberak ( 2018-02-27 09:07:54 -0500 )edit
1

OpenCV is the latest version 3.4.1

BAHRAMUDIN ADIL gravatar imageBAHRAMUDIN ADIL ( 2018-02-27 10:29:17 -0500 )edit

and your python, cmake ?

there * is* something weird going on here , and indeed, module is not defined

berak gravatar imageberak ( 2018-02-27 11:19:03 -0500 )edit

Python is 3.5.2 and Python 2.7.12, Cmake is 3.10.2. I have tried every possible and the latest needed libs, but I don't know why it says cannot find this or that.

BAHRAMUDIN ADIL gravatar imageBAHRAMUDIN ADIL ( 2018-02-27 19:53:40 -0500 )edit