2

I've been trying to make opencv for linux, I used the cmake parameters:

cmake -D CMAKE_BUILD_TYPE=RELEASE -D WITH_OPENCL=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_SHARED_LIBS=OFF -D JAVA_INCLUDE_PATH=$JAVA_HOME/include -D JAVA_AWT_LIBRARY=$JAVA_HOME/jre/lib/amd64/libawt.so -D JAVA_JVM_LIBRARY=$JAVA_HOME/jre/lib/arm/server/libjvm.so -D CMAKE_INSTALL_PREFIX=/usr/local

and it generated the files fine.

It was then into around the 81% when it was trting to generate the opencv-jar it opped up with

/home/pi/Desktop/opencv-3.1.0/modules/java/generator/src/cpp/common.h:8:17 fatal error jni.h No such file or directory

So I'm not sure what to be doing now with it. openjdk is installed properly too

Edit: I tried using the -I flag, by doing the command

make -I/usr/lib/jvm/java-8-openjdk-armhf/includes 

to no avail

ariagno
  • 532
  • 1
  • 15
  • 29

2 Answers2

0

the -I flag on make(1) command only affects the files included in the makefile by the .include directive, not the directories searched for by the compiler. For that purpose, just pass the -I flag to each compilation. One way to do this is

$ make CFLAGS="-I/usr/lib/jvm/java-8-openjdk-armhf/includes"

you can also pass the CFLAGS from the environment, as in

$ export CFLAGS=\""-I/usr/lib/..."\"  # escaped double quotes make them to be included in the string.
$ make
Luis Colorado
  • 10,974
  • 1
  • 16
  • 31
0

Please check: https://stackoverflow.com/a/67154438/1290868

FindJNI

find_package(JNI)

if (JNI_FOUND)
    message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
    message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")
endif()
myuce
  • 1,321
  • 1
  • 19
  • 29