gpu / JOCL

Java bindings for OpenCL
http://www.jocl.org
Other
187 stars 33 forks source link

Build failed on Ubuntu 18.04 (on mvn clean install) #33

Open tecnique2 opened 3 years ago

tecnique2 commented 3 years ago

I've tried to build JOCL on Ubuntu 18.04.

What I have done so far:

mkdir /home/<user>/JOCLRoot mkdir /home/<user>/JOCLRoot/JOCLBuild

cd /home/<user>/JOCLRoot

git clone https://github.com/gpu/JOCL.git git clone https://github.com/gpu/JOCLCommon.git

cmake-gui

cmake to /home/<user>/JOCLRoot/JOCLBuild

cd /home/<user>/JOCLRoot/JOCLBuild

make

cd /home/<user>/JOCLRoot/JOCL

mvn clean install

And on "mvn clean install" there are errors:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.259 s
[INFO] Finished at: 2020-12-30T09:57:34+01:00
[INFO] Final Memory: 15M/96M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project jocl: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/<user>/JOCLRoot/JOCL/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

If I check the logs in /home//JOCLRoot/JOCL/target/target/surefire-reports the following error occurs:

-------------------------------------------------------------------------------
Test set: org.jocl.test.JOCLMinimalPlatformTest
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.056 sec <<< FAILURE! - in org.jocl.test.JOCLMinimalPlatformTest
testGetPlatformIDs(org.jocl.test.JOCLMinimalPlatformTest)  Time elapsed: 0.055 sec  <<< ERROR!
java.lang.UnsatisfiedLinkError: Error while loading native library "JOCL_2_0_2-linux-x86_64"
Operating system name: Linux
Architecture         : amd64
Architecture bit size: 64
---(start of nested stack traces)---
Stack trace from the attempt to load the library as a file:
java.lang.UnsatisfiedLinkError: no JOCL_2_0_2-linux-x86_64 in java.library.path: [/home/<user>/JOCLRoot/JOCL/nativeLibraries]
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2670)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
    at java.base/java.lang.System.loadLibrary(System.java:1870)
    at org.jocl.LibUtils.loadLibrary(LibUtils.java:144)
    at org.jocl.CL.loadNativeLibrary(CL.java:65)
    at org.jocl.CL.<clinit>(CL.java:51)
    at org.jocl.test.JOCLMinimalPlatformTest.testGetPlatformIDs(JOCLMinimalPlatformTest.java:18)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Stack trace from the attempt to load the library as a resource:
java.io.IOException: No resource found with name '/lib/libJOCL_2_0_2-linux-x86_64.so'
    at org.jocl.LibUtils.writeResourceToFile(LibUtils.java:341)
    at org.jocl.LibUtils.loadLibraryResource(LibUtils.java:269)
    at org.jocl.LibUtils.loadLibrary(LibUtils.java:159)
    at org.jocl.CL.loadNativeLibrary(CL.java:65)
    at org.jocl.CL.<clinit>(CL.java:51)
    at org.jocl.test.JOCLMinimalPlatformTest.testGetPlatformIDs(JOCLMinimalPlatformTest.java:18)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
---(end of nested stack traces)---

    at org.jocl.LibUtils.loadLibrary(LibUtils.java:194)
    at org.jocl.CL.loadNativeLibrary(CL.java:65)
    at org.jocl.CL.<clinit>(CL.java:51)
    at org.jocl.test.JOCLMinimalPlatformTest.testGetPlatformIDs(JOCLMinimalPlatformTest.java:18)

I think this is the important one: java.lang.UnsatisfiedLinkError: no JOCL_2_0_2-linux-x86_64 in java.library.path: [/home/<user>/JOCLRoot/JOCL/nativeLibraries]

In "/home//JOCLRoot/JOCL/nativeLibraries" I can only find the file "libJOCL_2_0_1-linux-x86_64.so"

So there is somehow a conflict between 2_0_2 and 2_0_1.

How can I fix that?

Thanks in advance for the help!

gpu commented 3 years ago

Yes, sorry, that wasn't managed cleanly: The version number in the CMake file is 2.0.1. But the version number on the Java side (specifially, the one that is encoded in CL.java) is 2.0.2. The reason for that is that there had been no changes in the native part between 2.0.1 and 2.0.1 (it was only an minor update on the Java side).

I have updated the version number via https://github.com/gpu/JOCL/commit/2335da1b782f97c7e69765b730d7af630d6ffec2 (for you, there is actually no reason to re-compile the native lib - you could just rename it from 2.0.1 to 2.0.2).

Sorry for the confusion here.