During the emerge of dev-java/libgtk-java-2.4.6-r1 it quits with an error: "!!! Function src_compile, Line 70, Exitcode 2" A couple of lines above is: " jni/jg_jnu.h:8:17: jni.h: No such file or directory" Reproducible: Always Steps to Reproduce: 1. emerge libgtk-java Actual Results: The error descibed by "details" Expected Results: It should have installed libgtk-java emerge info: Portage 2.0.51-r3 (default-linux/x86/2004.0, gcc-3.3.4, glibc-2.3.4.20040808-r1, 2.6.7-gentoo-r11 i686) ================================================================= System uname: 2.6.7-gentoo-r11 i686 Intel(R) Celeron(TM) CPU 1000 MHz Gentoo Base System version 1.4.16 distcc 2.16 i386-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled] Autoconf: sys-devel/autoconf-2.59-r4 Automake: sys-devel/automake-1.8.5-r1 Binutils: sys-devel/binutils-2.14.90.0.8-r1 Headers: sys-kernel/linux-headers-2.4.21-r1 Libtools: sys-devel/libtool-1.5.2-r5 ACCEPT_KEYWORDS="x86" AUTOCLEAN="yes" CFLAGS="-march=pentium3 -O2 -pipe" CHOST="i386-pc-linux-gnu" COMPILER="" CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config /usr/kde/3.2 /share/config /usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/ config /usr/share/texmf/dvipdfm/config/ /usr/share/texmf/dvips/config/ /usr/shar e/texmf/tex/generic/config/ /usr/share/texmf/tex/platex/config/ /usr/share/texmf /xdvi/ /var/qmail/control" CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d" CXXFLAGS="-march=pentium3 -O2 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms" GENTOO_MIRRORS="rsync://linux.rz.ruhr-uni-bochum.de/gentoo/ http://linux.rz.ruhr -uni-bochum.de/download/gentoo-mirror/ ftp://ftp.easynet.nl/mirror/gentoo/ http: //ftp.easynet.nl/mirror/gentoo/" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="X alsa apache2 apm avi berkdb bitmap-fonts cdr crypt cups directfb encode e sd f77 fam foomaticdb fortran gdbm gif gpm gstreamer gtk gtk2 guile imagemagick imlib java jpeg junit libg++ libwww mad mikmod motif mozilla mpeg mysql ncurses nls oggvorbis opengl oss pam pdflib perl png python quicktime readline samba sdl slang spell ssl svga tcltk tcpd tetex tiff truetype unicode x86 xml xml2 xmms x v zlib" The full error message: gcc -c -march=pentium3 -O2 -pipe -fPIC -Wall jni/jg_jnu.c -DXTHREADS -D_REENTRA NT -DXUSE_MTSAFE_API -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X1 1R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freet ype2 -I/usr/include/freetype2/config -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0 /include \ -o jni/jg_jnu.o In file included from jni/jg_jnu.c:6: jni/jg_jnu.h:8:17: jni.h: No such file or directory In file included from jni/jg_jnu.c:6: jni/jg_jnu.h:19: error: syntax error before '*' token jni/jg_jnu.h:19: warning: type defaults to `int' in declaration of `JNU_GetEnv' jni/jg_jnu.h:19: warning: data definition has no type or storage class jni/jg_jnu.h:28: error: syntax error before '*' token jni/jg_jnu.c:14: error: syntax error before '*' token jni/jg_jnu.c:14: warning: type defaults to `int' in declaration of `cached_jvm' jni/jg_jnu.c:14: warning: data definition has no type or storage class jni/jg_jnu.c:17: error: syntax error before "jint" jni/jg_jnu.c:17: error: syntax error before '*' token jni/jg_jnu.c:18: warning: return type defaults to `int' jni/jg_jnu.c: In function `JNI_OnLoad': jni/jg_jnu.c:19: error: `jvm' undeclared (first use in this function) jni/jg_jnu.c:19: error: (Each undeclared identifier is reported only once jni/jg_jnu.c:19: error: for each function it appears in.) jni/jg_jnu.c:20: error: `JNI_VERSION_1_2' undeclared (first use in this function ) jni/jg_jnu.c: At top level: jni/jg_jnu.c:24: error: syntax error before '*' token jni/jg_jnu.c:25: warning: return type defaults to `int' jni/jg_jnu.c: In function `JNU_GetEnv': jni/jg_jnu.c:26: error: `JNIEnv' undeclared (first use in this function) jni/jg_jnu.c:26: error: `env' undeclared (first use in this function) jni/jg_jnu.c:27: error: invalid type argument of `->' jni/jg_jnu.c:27: error: `JNI_VERSION_1_2' undeclared (first use in this function ) jni/jg_jnu.c: At top level: jni/jg_jnu.c:32: error: syntax error before '*' token jni/jg_jnu.c: In function `JNU_ThrowByName': jni/jg_jnu.c:34: error: `jclass' undeclared (first use in this function) jni/jg_jnu.c:34: error: syntax error before "cls" jni/jg_jnu.c:36: error: `cls' undeclared (first use in this function) jni/jg_jnu.c:37: error: `env' undeclared (first use in this function) jni/jg_jnu.c:37: error: `msg' undeclared (first use in this function) jni/jg_jnu.c: At top level: jni/jg_jnu.c:42: error: syntax error before '*' token jni/jg_jnu.c: In function `getStringArray': jni/jg_jnu.c:44: error: `jsize' undeclared (first use in this function) jni/jg_jnu.c:44: error: syntax error before "len" jni/jg_jnu.c:45: error: `len' undeclared (first use in this function) jni/jg_jnu.c:49: error: `jstring' undeclared (first use in this function) jni/jg_jnu.c:49: error: syntax error before "aString" jni/jg_jnu.c:50: error: `env' undeclared (first use in this function) jni/jg_jnu.c:50: error: `aString' undeclared (first use in this function) jni/jg_jnu.c: At top level: jni/jg_jnu.c:57: error: syntax error before '*' token jni/jg_jnu.c: In function `freeStringArray': jni/jg_jnu.c:59: error: `jsize' undeclared (first use in this function) jni/jg_jnu.c:59: error: syntax error before "len" jni/jg_jnu.c:61: error: `len' undeclared (first use in this function) jni/jg_jnu.c:62: error: `jstring' undeclared (first use in this function) jni/jg_jnu.c:62: error: syntax error before "aString" jni/jg_jnu.c:63: error: `env' undeclared (first use in this function) jni/jg_jnu.c:63: error: `aString' undeclared (first use in this function) jni/jg_jnu.c:63: error: `str' undeclared (first use in this function) jni/jg_jnu.c: At top level: jni/jg_jnu.c:67: error: syntax error before "getList" jni/jg_jnu.c:67: error: syntax error before '*' token jni/jg_jnu.c:68: warning: return type defaults to `int' jni/jg_jnu.c: In function `getList': jni/jg_jnu.c:70: warning: return makes integer from pointer without a cast jni/jg_jnu.c: At top level: jni/jg_jnu.c:73: error: syntax error before '*' token make[1]: *** [jni/jg_jnu.o] Error 1 make[1]: Leaving directory `/var/tmp/portage/libgtk-java-2.4.6-r1/work/libgtk-ja va-2.4.6/src' make: *** [distro] Error 2 !!! ERROR: dev-java/libgtk-java-2.4.6-r1 failed. !!! Function src_compile, Line 70, Exitcode 2 !!! (no error message) !!! If you need support, post the topmost build error, NOT this status message.
So the obvious problem is that jni.h isn't found. The far less obvious part is *why not*. On my system I have /opt/sun-jdk-1.4.2.04/include/jni.h /opt/blackdown-jdk-1.4.1/include/jni.h /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/include/jni.h /usr/lib/mozilla/include/java/jni.h So my question to reporter would be: can you figure out whether or not you have similar things installed? I just re-ran that part of the build, and compared my -I flags to yours, and they're the same. What JDK do you have installed? AfC Sydney
P.S. Karltk hasn't had a chance to import all the other ebuilds yet, so you might want to go to http://www.operationaldynamics.com/reference/software/gentoo/ and grab my tarball of the ebuilds there. It won't help this specific problem, but it'll give you the rest of java-gnome. AfC Sydney
Thank you for your help, At first I had only installed blackdown-jre and blackdown-jdk. After I installed sun-jdk (and set it als the default with java-config) the problem isn't solved. The jni.h files on my system are: locate jni.h /opt/sun-jdk-1.4.2.06/include/jni.h /opt/blackdown-jdk-1.4.1/include/jni.h /usr/lib/mozilla/include/java/jni.h There isn't a jni.h file in /usr/lib/gcc-lib/i386-pc-linux-gnu/3.3.4/include/ Could this be the problem? I think I have the same jdks as you. This is my gcc version: sys-devel/gcc-3.3.4-r1 Also i386-pc-linux-gnu is the only diretory in gcc-lib. Thank you for your time. David, Hoogeveen ;)
I poked around the upstream source tree, and found that in the autoconf macros a reference to a check for jni.h ... which is commented out. So I uncommented it, and tried it, and the check comes back with "no" (jni.h not found), which is obvisouly wrong. However, that's just the bog standard autoconf check for such a thing, and upstream doesn't do anything with it regardless. What needs to happen is that one of the installed jni.h files needs to end up on cc's include path. As a workaround, you can achieve that in one of two ways a) you need a -I/opt/sun-jdk-1.4.2.04/include argument to your compiler command lines. Looking around more, I found in src/Makefile a reference to a variable JAVA_INCLUDES, which isn't set to anything. If you manually add that -I flag to line 43 of /var/tmp/portage/libgtk-java-2.4.6-r1/work/libgtk-java-2.4.6/src/Makefile (or wherever) then you should be able to build. b) Re-build gcc with Java support, ie USE=gcj emerge gcc That will get you the fourth jni.h listed above, and that is on the system include path, and you'll be able to build. [One kinda has to wonder what results we've been getting building things with GCJ's jni.h and then running things with standard Java JREs, but hey, it works] Obviously the ebuild shouldn't need to depend absolutely on the presence of GCJ, so I'll see if I can dream up a patch to the autoconf macros and src/Makefile to automate this. Something along the lines of -I`java-config -O`/include might do it I'll also talk with upstream about this. Let me know how you get on. AfC Sydney
After recompiling gcc with gcj support libgtk-java installs fine! Also I tried the ebuilds from http://www.operationaldynamics.com/reference/software/gentoo/ because I want to make java/glade programs and there was a little (with an easy work around) bug in libglade-java, I posted a bug: http://bugs.gentoo.org/show_bug.cgi?id=72630. Thanks, David
I had a word with upstream, and they're of the opinion that finding jni.h is a distro responsibility. Uh huh. Whatever. I'll incorporate the fix alluded to in #4 at some point; for now, the workaround is "just use a gcc build with GCJ enabled". AfC Singapore
added a patch to set JAVA_INCLUDES when not using gcj