/var/tmp/portage/dev-java/zstd-jni-1.4.9.1/work/zstd-jni-1.4.9-1/src/main/native/jni_directbuffercompress_zstd.c:1:10: fatal error: jni.h: No such file or directory 1 | #include <jni.h> | ^~~~~~~ compilation terminated. ------------------------------------------------------------------- This is an unstable amd64 chroot image at a tinderbox (==build bot) name: 17.1_hardened-20210316-095736 ------------------------------------------------------------------- gcc-config -l: [1] x86_64-pc-linux-gnu-10.2.0 * clang version 11.1.0 Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm/11/bin /usr/lib/llvm/11 11.1.0 Python 3.8.8 Available Rust versions: [1] rust-1.50.0 * The following VMs are available for generation-2: *) AdoptOpenJDK 8.282_p08 [openjdk-bin-8] Available Java Virtual Machines: [1] openjdk-bin-8 system-vm timestamp(s) of HEAD at this tinderbox image: /var/db/repos/gentoo Wed Mar 17 08:36:04 UTC 2021 emerge -qpvO dev-java/zstd-jni [ebuild N ] dev-java/zstd-jni-1.4.9.1
Created attachment 692103 [details] emerge-info.txt
Created attachment 692106 [details] dev-java:zstd-jni-1.4.9.1:20210317-090750.log
Created attachment 692109 [details] emerge-history.txt
Created attachment 692112 [details] environment
Created attachment 692115 [details] etc.portage.tar.bz2
Created attachment 692118 [details] logs.tar.bz2
Created attachment 692121 [details] temp.tar.bz2
just came across this issue on a server where i try to install this package. the cause is that not every jdk as we have it packaged provides jni.h: # find /usr/ -name jni.h /usr/include/libavcodec/jni.h /usr/lib64/icedtea8/include/jni.h /usr/lib64/openjdk-11/include/jni.h /usr/lib64/openjdk-8/include/jni.h # eselect java-vm list Available Java Virtual Machines: [1] icedtea-8 [2] icedtea-bin-8 [3] openjdk-8 [4] openjdk-11 system-vm [5] openjdk-bin-8 [6] openjdk-bin-11 so for some reason -bin versions of jdk do not provide this file. switching to a non-bin jdk works this issue around.
it's located in /opt /opt/openjdk-bin-8.292_p10/include/jni.h and accessible via symlink in /usr/lib/jvm/openjdk-bin-8/include/jni.h also via /etc/java-config-2/current-system-vm/include/jni.h ( if it's eselected ) so probably package needs to pass something like --includedir ${JAVA_HOME}/include ( that's imaginary option ofc ) so the file is provided, need to modify ebuilds/eclasses/build-systems to be able to look in right place.
find -L /usr -name jni.h 2>/dev/null need that -L for find to show symlinked paths
thanks, will have to dig into it more why it does not work with if include is symlink
*** Bug 802261 has been marked as a duplicate of this bug. ***
It seems like this issue is related to the 'headless-awt' USE flag of JDK packages. I got the same issue with dev-java/openjdk-bin-8.292_p10 with USE="headless-awt", but once I disabled this USE flag, dev-java/zstd-jni could be compiled without any more errors. I can find this USE flag enabled in the 'etc.portage.tar.bz2' file you uploaded: $ grep -nr headless-awt package.use/ package.use/23thrown_global_use_flags_from_metadata:2:*/* editcap -futex g-sorcery glide graphicaleffects headless-awt jbig When I installed this package with headless-awt enabled, the following line showed up in CMake output: -- Could NOT find JNI (missing: JAVA_AWT_LIBRARY) Then I rebuilt openjdk-bin with the USE flag disabled, and it changed to this: -- Found JNI: /opt/openjdk-bin-8.292_p10/jre/lib/amd64/libjawt.so
(In reply to "Leo" Y. Liao from comment #13) > It seems like this issue is related to the 'headless-awt' USE flag of JDK > packages. I got the same issue with dev-java/openjdk-bin-8.292_p10 with > USE="headless-awt", but once I disabled this USE flag, dev-java/zstd-jni > could be compiled without any more errors. > [...] Sounds very similar to bug #801277 except that dev-java/zstd-jni does not depend on virtual/jdk. Adding >=virtual/jdk-1.8:*[-headless-awt]
^ I created a pull request containing a patch that fixes this issue from a different approach. Although CMake's JNI module (located at /usr/share/cmake/Modules/FindJNI.cmake) requires all components of JNI, including libjawt.so, for setting JNI_FOUND to TRUE, libjawt.so is actually not used by zstd-jni. Therefore, it is fine for libjawt.so to be absent, and [-headless-awt] is not necessary. To trick CMake into thinking that the JNI is complete, it is possible to set JAVA_AWT_LIBRARY to a dummy value. This will not cause any problem for zstd-jni because it does not uses the AWT library, thus the JAVA_AWT_LIBRARY variable will not be read during the compilation process.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=16b7cf5e72b6255564733656746c76421b776b0a commit 16b7cf5e72b6255564733656746c76421b776b0a Author: Yuan Liao <liaoyuan@gmail.com> AuthorDate: 2021-07-28 15:03:03 +0000 Commit: Florian Schmaus <flow@gentoo.org> CommitDate: 2021-07-28 19:52:11 +0000 dev-java/zstd-jni: Allow CMake to find and use JNI without AWT The AWT library, libjawt.so, is not needed for zstd-jni itself as the compilation can finish without it. But CMake's FindJNI module will always try to search for it, and if it is not found, CMake will declare everything pertaining to JNI unavailable, even if some of the JNI components do exist on the system -- like jni.h, which is required for building zstd-jni. Because the AWT library is actually unused, it is safe to set the CMake variable controlling it (JAVA_AWT_LIBRARY) to an arbitrary string for deceiving CMake about its existence. Closes: https://bugs.gentoo.org/776910 Package-Manager: Portage-3.0.20, Repoman-3.0.2 Signed-off-by: Yuan Liao <liaoyuan@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/21816 Signed-off-by: Florian Schmaus <flow@gentoo.org> dev-java/zstd-jni/zstd-jni-1.4.9.1.ebuild | 3 +++ dev-java/zstd-jni/zstd-jni-1.5.0.4.ebuild | 3 +++ 2 files changed, 6 insertions(+)