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

The usage of javah is not longer support for JDK > 8 #12

Open
0x6e3078 opened this issue Sep 7, 2018 · 6 comments
Open

The usage of javah is not longer support for JDK > 8 #12

0x6e3078 opened this issue Sep 7, 2018 · 6 comments

Comments

@0x6e3078
Copy link

0x6e3078 commented Sep 7, 2018

It's not possible to run the prepare.sh successfully with a JDK greater then 8. The javah command was removed and its forced to use the javac -h option.

The current workaround: use a JDK8

@freemo
Copy link
Member

freemo commented Sep 7, 2018 via email

@0x6e3078
Copy link
Author

0x6e3078 commented Sep 7, 2018

Hi freemo, I currently trying to get it working with javac but unfortunately it is not working like I expected it. I have added the -h option to the pom.xml

@@ -101,6 +101,15 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                    <encoding>UTF-8</encoding>
+                    <compilerArgs>
+                        <arg>-h</arg>
+                        <arg>../include/</arg>
+                     </compilerArgs>
+                </configuration>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>

But this will only create this two header
com_aparapi_internal_jni_KernelRunnerJNI.h
com_aparapi_internal_jni_OpenCLJNI.h

Best regards
Sven

@freemo
Copy link
Member

freemo commented Sep 7, 2018 via email

@0x6e3078
Copy link
Author

0x6e3078 commented Sep 7, 2018

No there is no error, but I guess that the java files may missing the Native Annotation.
https://docs.oracle.com/javase/10/docs/api/java/lang/annotation/Native.html

I tried it with the follow file: (patch)

diff --git i/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java w/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java
index 1972422..39f7c1f 100644
--- i/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java
+++ w/src/main/java/com/aparapi/internal/opencl/OpenCLMem.java
@@ -15,13 +15,16 @@
  */
 package com.aparapi.internal.opencl;

+import java.lang.annotation.Native;
+
+
 public class OpenCLMem{

-   public final static int MEM_DIRTY_BIT = 1 << 0x00F;
+@Native  public final static int MEM_DIRTY_BIT = 1 << 0x00F;

-   public final static int MEM_COPY_BIT = 1 << 0x010;
+@Native  public final static int MEM_COPY_BIT = 1 << 0x010;

-   public final static int MEM_ENQUEUED_BIT = 1 << 0x011;
+@Native  public final static int MEM_ENQUEUED_BIT = 1 << 0x011;

    public long bits; // dirty, copy, enqueued

Then the header file will be created. I will change that an try to provide a proper patch. But this will take until next week.

@freemo
Copy link
Member

freemo commented Sep 7, 2018 via email

@0x6e3078
Copy link
Author

0x6e3078 commented Sep 14, 2018

Hi I created two pull requests, one for aparapi and one for aparapi-native.

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

2 participants