Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: conflicting types for 'Java_java_lang_Class_forName0' #519

Open
somecoolword opened this issue Feb 2, 2017 · 2 comments
Open

Error: conflicting types for 'Java_java_lang_Class_forName0' #519

somecoolword opened this issue Feb 2, 2017 · 2 comments

Comments

@somecoolword
Copy link

Hello

Trying to compile Avian using flags openjdk and openjdk-src, but with no success. Please see error logs below.
Was trying openjdk7 and openjdk8
OS used windows10 and centos7, both are x86_64
In all configurations, the same error appeared

The purpose of this is to be able to compile JavaFX apps with Avian
openjdk7 was used just for tests to reproduce the error

Any suggestions for JavaFX apps compilation with Avian?

build/windows-x86_64-small-lzma-openjdk-src/openjdk/Class.c:99:1: error: conflicting types for 'Java_java_lang_Class_forName0'
Java_java_lang_Class_forName0(JNIEnv *env, jclass this, jstring classname,
^
In file included from build/windows-x86_64-small-lzma-openjdk-src/openjdk/Class.c:38:0:
build/windows-x86_64-small-lzma-openjdk-src/openjdk/java_lang_Class.h:31:26: note: previous declaration of 'Java_java_lang_Class_forName0' was here
JNIEXPORT jclass JNICALL Java_java_lang_Class_forName0
^
makefile:2269: recipe for target `build/windows-x86_64-small-lzma-openjdk-src/openjdk/share/native/java/lang/Class-openjdk.o' failed
make: *** [build/windows-x86_64-small-lzma-openjdk-src/openjdk/share/native/java/lang/Class-openjdk.o] Error 1

@dicej
Copy link
Member

dicej commented Feb 8, 2017

Thanks for reporting this, but I'm not able to reproduce it.

I tried this on Cygwin:

mkdir /work
cd /work
git clone git@github.com:dicej/avian
git clone git@github.com:readytalk/win64
git clone --recursive git@github.com:ojdkbuild/ojdkbuild
wget https://github.com/ojdkbuild/ojdkbuild/releases/download/1.8.0.121-1/java-1.8.0-openjdk-1.8.0.121-1.b13.ojdkbuild.windows.x86_64.zip
# extract the above using Windows Explorer's "Extract All..." command; using Cygwin's unzip will give incorrect file permissions
cd avian
export JAVA_HOME=/work/java-1.8.0-openjdk-1.8.0.121-1.b13.ojdkbuild.windows.x86_64/
make openjdk=$JAVA_HOME openjdk-src=/work/ojdkbuild/lookaside/java-1.8.0-openjdk/jdk/src/ test

I did have to tweak a couple of things to make it work, updating openjdk-patches/Inet6AddressImpl.c.8.patch like so:

--- openjdk/Inet6AddressImpl.c
+++ openjdk/Inet6AddressImpl.c
@@ -40,6 +40,14 @@
 #include "net_util.h"
 #include "icmp.h"

+#ifdef __MINGW32__
+typedef struct icmpv6_echo_reply_lh {
+  IPV6_ADDRESS_EX Address;
+  ULONG           Status;
+  unsigned int    RoundTripTime;
+} ICMPV6_ECHO_REPLY, *PICMPV6_ECHO_REPLY;
+#endif
+
 #ifdef WIN32
 #ifndef _WIN64

The old patch didn't work due to recent update to the OpenJDK file it applies to. I'll do some more testing to make sure it works on other platforms before checking it in.

The other thing is to work around what seems to be a bug in MinGW-w64's toolchain such that libmingwex contains an isnan symbol that conflicts with OpenJDK's version. Hence this patch (added to the source tree as openjdk-patches/s_isnan.c.patch):

--- openjdk/s_isnan.c
+++ openjdk/s_isnan.c
@@ -35 +35 @@
-        int isnan(double x)
+        int hide_isnan(double x)
@@ -37 +37 @@
-        int isnan(x)
+        int hide_isnan(x)

I'm not sure what the long term solution is to that problem, since that patch will probably break other platforms and other versions of MinGW-w64. Maybe some kind of weak symbol magic.

@AntonBikineev
Copy link

@catholic This problem goes away if I use one of the openjdk8 updates, specifically cloning
http://hg.openjdk.java.net/jdk8u/jdk8u/jdk
instead of
http://hg.openjdk.java.net/jdk8/jdk8/jdk
works fine for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants