http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48515
Summary: [4.6] GCJ fails to compile jni.cc because of reflection errors on i686-w64-mingw32 target Product: gcc Version: 4.6.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: java AssignedTo: unassig...@gcc.gnu.org ReportedBy: blak...@gentooist.com When building cross gcj compiler for i686-w64-mingw32 target, libjava fails to compile with following errors: ../../../../sources/gcc-4.6-20110401/libjava/jni.cc: In function 'java::lang::Object* _Jv_JNI_ToReflectedField(JNIEnv*, jclass, jfieldID, jboolean)': ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:1663:14: error: new declaration 'java::lang::Object* _Jv_JNI_ToReflectedField(JNIEnv*, jclass, jfieldID, jboolean)' ../../../../sources/gcc-4.6-20110401/libjava/java/lang/reflect/Field.h:93:19: error: ambiguates old declaration 'java::lang::Object* _Jv_JNI_ToReflectedField(_Jv_JNIEnv*, jclass, jfieldID, jboolean)' ../../../../sources/gcc-4.6-20110401/libjava/java/lang/reflect/Field.h:83:105: error: 'java::lang::Class* java::lang::reflect::Field::declaringClass' is private ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:1669:14: error: within this context ../../../../sources/gcc-4.6-20110401/libjava/java/lang/reflect/Field.h:85:8: error: 'jint java::lang::reflect::Field::offset' is private ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:1670:14: error: within this context ../../../../sources/gcc-4.6-20110401/libjava/java/lang/Class.h:675:14: error: '_Jv_Field* java::lang::Class::fields' is private ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:1670:55: error: within this context ../../../../sources/gcc-4.6-20110401/libjava/java/lang/reflect/Field.h:84:26: error: 'java::lang::String* java::lang::reflect::Field::name' is private ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:1671:14: error: within this context ../../../../sources/gcc-4.6-20110401/libjava/jni.cc: In function 'java::lang::Object* _Jv_JNI_ToReflectedMethod(JNIEnv*, jclass, jmethodID, jboolean)': ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:1694:15: error: new declaration 'java::lang::Object* _Jv_JNI_ToReflectedMethod(JNIEnv*, jclass, jmethodID, jboolean)' ../../../../sources/gcc-4.6-20110401/libjava/java/lang/reflect/Method.h:78:19: error: ambiguates old declaration 'java::lang::Object* _Jv_JNI_ToReflectedMethod(_Jv_JNIEnv*, jclass, jmethodID, jboolean)' ../../../../sources/gcc-4.6-20110401/libjava/java/lang/reflect/Constructor.h:19:3: error: 'java::lang::reflect::Constructor::Constructor()' is private ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:1706:41: error: within this context ../../../../sources/gcc-4.6-20110401/libjava/java/lang/reflect/Constructor.h:56:8: error: 'jint java::lang::reflect::Constructor::offset' is private ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:1707:10: error: within this context ../../../../sources/gcc-4.6-20110401/libjava/java/lang/Class.h:666:17: error: '_Jv_Method* java::lang::Class::<anonymous union>::methods' is private ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:1707:50: error: within this context ../../../../sources/gcc-4.6-20110401/libjava/java/lang/reflect/Constructor.h:53:105: error: 'java::lang::Class* java::lang::reflect::Constructor::declaringClass' is private ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:1708:10: error: within this context ../../../../sources/gcc-4.6-20110401/libjava/java/lang/reflect/Method.h:20:3: error: 'java::lang::reflect::Method::Method()' is private ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:1713:31: error: within this context ../../../../sources/gcc-4.6-20110401/libjava/java/lang/reflect/Method.h:73:8: error: 'jint java::lang::reflect::Method::offset' is private ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:1714:10: error: within this context ../../../../sources/gcc-4.6-20110401/libjava/java/lang/Class.h:666:17: error: '_Jv_Method* java::lang::Class::<anonymous union>::methods' is private ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:1714:50: error: within this context ../../../../sources/gcc-4.6-20110401/libjava/java/lang/reflect/Method.h:64:105: error: 'java::lang::Class* java::lang::reflect::Method::declaringClass' is private ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:1715:10: error: within this context ../../../../sources/gcc-4.6-20110401/libjava/jni.cc: At global scope: ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:2891:1: error: invalid conversion from 'java::lang::Object* (*)(_Jv_JNIEnv*, jclass, jmethodID, jboolean)' to 'java::lang::Object* (*)(JNIEnv*, jclass, jmethodID, jboolean)' [-fpermissive] ../../../../sources/gcc-4.6-20110401/libjava/jni.cc:2891:1: error: invalid conversion from 'java::lang::Object* (*)(_Jv_JNIEnv*, jclass, jfieldID, jboolean)' to 'java::lang::Object* (*)(JNIEnv*, jclass, jfieldID, jboolean)' [-fpermissive] This is because in jni.cc, _Jv_JNI_ToReflectedField and _Jv_JNI_ToReflectedMethod are defined using JNICALL macro, while they are defined in java/lang/reflect/Method.h and java/lang/reflect/Field.h without. The GCC snapshot used for this build was: 4.6-20110401 The configure command line used was: configure --prefix=/users_csee/parizet/test/root --with-sysroot=/users_csee/parizet/test/root --disable-multilib --with-mpfr=/users_csee/parizet/test/root --with-mpc=/users_csee/parizet/test/root --with-gmp=/users_csee/parizet/test/root --disable-shared --enable-threads=win32 --disable-tls --disable-__cxa_atexit --enable-languages=c,c++,java --enable-libssp --disable-win32-registry --disable-nls --disable-lto --enable-libgcj --enable-sjlj-exceptions --target=i686-w64-mingw32 --build=i386-redhat-linux