Closed linyuan198996 closed 1 year ago
There is kinda a bug in the JSCIP CMakeLists.txt
here because it does not opt out of requiring AWT, which CMake's FindJNI.cmake
unfortunately defaults to requiring:
set(JNI_FIND_COMPONENTS AWT JVM)
# For compatibility purposes, if no components are specified both are
# considered required.
set(JNI_FIND_REQUIRED_AWT TRUE)
set(JNI_FIND_REQUIRED_JVM TRUE)
But you are missing not only the AWT JNI library, but also the Java headers (JAVA_INCLUDE_PATH
, JAVA_INCLUDE_PATH2
), or at least CMake cannot find them. Please make sure you install a full JDK (in distribution packages, that usually means installing the -devel
or -dev
subpackage of the Java/OpenJDK package) and not just the JRE parts. (And while theoretically a headless version should be sufficient, in practice, you will currently need AWT at build time, see above. There used to also be a runtime dependency on the AWT library, but I already fixed that part in commit 49e832b17d59f7bc84a5eb2f8bf5235d626c141d, so AWT is no longer required at runtime.)
I am keeping this open because of the unnecessary AWT build-time dependency, but this is mostly a user error.
Depending on how you installed Java, you may also have to set the JAVA_HOME
environment variable. But it should not be necessary for an installation from GNU/Linux distribution packages of OpenJDK.
The AWT library is no longer required after commit 468efd0a36d72aab7295fa79b363e41317ce8a75. But you will need to fix your missing Java includes for JSCIP to actually build.
CMake Error at /Applications/CMake.app/Contents/share/cmake-3.27/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find JNI (missing: JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 AWT)