Javacpp-presets: OpenCV arm64 can't find java

Created on 6 Oct 2019  路  5Comments  路  Source: bytedeco/javacpp-presets

Doing a Pi4-arm64 test

OpenCV complains it can't find Java - this is actually CMake not finding Java as I remember

I hack-ily add to the main cppbuild.sh as per below but it's a cop-out

Expecting same problem with ARMHF - will know later

---------------------- a bad but working work-around ----------------------
case $PLATFORM in
linux-arm64)
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-arm64
export JAVA_AWT_LIBRARY=/usr/lib/jvm/java-8-openjdk-arm64/lib/aarch64
export JAVA_JVM_LIBRARY=/usr/lib/jvm/java-8-openjdk-arm64/jre/lib/aarch64/server
export JAVA_INCLUDE_PATH=/usr/lib/jvm/java-8-openjdk-arm64/include
export JAVA_INCLUDE_PATH2=/usr/lib/jvm/java-8-openjdk-arm64/include/linux
export JAVA_AWT_INCLUDE_PATH=/usr/lib/jvm/java-8-openjdk-arm64/include
;;
esac

bug help wanted

All 5 comments

If you'd like to get this fixed properly, this should be reported upstream, not here.

I will do when I've checked ARMHF

Just letting you know as well

Maybe JavaCPP should be setting JAVA_HOME for the build script. That should take care of these kinds of issues...

For a robust JavaCPP then yes even though the problem is with CMake. If/When CMake fix it you'd still have to version check CMake to find if you've got a buggy one. In this case current stable is buggy - I always build CMake from source as distro versions have knock-on affects with other repos.

All the envars are important - I spent hours (months ago) tracking what was required - it's documented in FindJava.cmake / FindJNI.cmake (can't remember which - likely the JNI I guess)

Short note - Pi4 - arm64 - cpython just failed but I'm using a beta so not sure if a real bug or not - about to switch the armhf once I grab the cpython log...

I've raised an issue with CMake over this

While doing the Pi4-32bit build I ran into this again and had to re-work-around CMake being broken re FindJNI/Java using the stable Oracle 32bit tarball

If, as you suggested above you're going to set JAVA_HOME there's a load more that also need setting.

I just did a test build with _only_ JAVA_HOME exported and CMake failed so had to manually work out the new locations required for the tarball

The most useful hints on what to set are at https://cmake.org/cmake/help/v3.0/module/FindJNI.html

It should be noted that CMake will set some envars so this is a trappable situation

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Maurice-Betzel picture Maurice-Betzel  路  32Comments

nanguantong picture nanguantong  路  25Comments

mmanco picture mmanco  路  20Comments

blueberry picture blueberry  路  34Comments

archenroot picture archenroot  路  56Comments