clEsperanto / clesperantoj_prototype

A Java Wrapper around CLIc / clesperanto
BSD 3-Clause "New" or "Revised" License
4 stars 3 forks source link

Build error: [ERROR] Failed to execute JavaCPP Builder: net.clesperanto.clicwrapper.clesperantoj #4

Closed haesleinhuepf closed 3 months ago

haesleinhuepf commented 2 years ago

Hi Brian @bnorthan ,

I'm trying to build this project and struggle a bit. I'm receiving this error:

[ERROR] Failed to execute goal org.bytedeco:javacpp:1.5:parse (generate-sources) on project clesperantoj_: Failed to execute JavaCPP Builder: net.clesperanto.clicwrapper.clesperantoj -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.bytedeco:javacpp:1.5:parse (generate-sources) on project clesperantoj_: Failed to execute JavaCPP Builder

...

Caused by: java.lang.ClassNotFoundException: net.clesperanto.clicwrapper.clesperantoj
    at java.net.URLClassLoader.findClass (URLClassLoader.java:476)

Also nothing is written into the src/gen/java folder...

I'm working on this branch derived from yours. And the only thing I changed: I renamed bin to build in this line as instructed here.

Do you have any idea, what might be missing?

Full log: log.txt

bnorthan commented 2 years ago

Hi Robert

I think you need to change the CMAKE_INSTALL_PREFIX to (path on your system)/CLIc_prototype/bin as the java wrappers look for the CLIc_prototype libs there. It is a bit confusing because the cmake gui has an option called 'Where to build the binaries' however we need to also specify the installation location. Happy to tweak these locations, but I was thinking we should use a path relative to where the source is, as to make it more robust on different computers.

Also before running mvn you may need to make a trivial change (like adding a space) to clesperantoj to trigger the parse step.

bnorthan commented 2 years ago

FYI. I've added more detailed build instructions to the readme on the javacpp branch here. It's still a bit rough, but I'm hoping these instructions can help early adapters.

haesleinhuepf commented 2 years ago

Perfect thanks @bnorthan ! The configuration of CMAKE_INSTALL_PREFIX and the step cmake --build ./build --parallel 10 --target install were very important! The CLIc_prototype/bin folder now contains includes as we need them there.

However, when running mvn (or mvn -X for debugging) I still receive this error:

[ERROR] Failed to execute goal org.bytedeco:javacpp:1.5:parse (generate-sources) on project clesperantoj_: Failed to execute JavaCPP Builder: net.clesperanto.clicwrapper.clesperantoj -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.bytedeco:javacpp:1.5:parse (generate-sources) on project clesperantoj_: Failed to execute JavaCPP Builder

...

Caused by: java.lang.ClassNotFoundException: net.clesperanto.clicwrapper.clesperantoj
    at java.net.URLClassLoader.findClass (URLClassLoader.java:476)

I've also tried to do trivial changes (addind spaces) to net/clesperanto/clicwrapper/clesperantoj.java and it doesn't help. Any further hint is appreciated!

bnorthan commented 2 years ago

It seems as it is failing on the parse goal in the generate-sources phase. At first glance it seems it can't find net.clesperanto.clicwrapper.clesperantoj. That is a java class that specifies the c header that should be parsed and the files to include and link to.

I can't think of a reason that file would be missing or not found. I suppose there could be a weird thing in a path name or something.

Or perhaps a file the clesperantoj is trying to link to is missing and the message is incomplete. Take a look at the includepath and linkpath that point to the CUDA toolkit. In the version I checked in they point to 11.2. This may need to be changed on your machine (proper thing to do may be to point to a un-versioned virtual path if one exists).

If that doesn't help double check the javacpp section of the pom and make sure the relative link and include paths specified there exist.

If that doesn't work either we could do a quick zoom later today to try and figure it out.

haesleinhuepf commented 2 years ago

Hey Brian @bnorthan ,

I think I found the issue. I tried compiling everything without that section in the pom. This failed with a compiler error, because this class didn't exist. After deleting InteractiveWrapperTest.java, the build worked, also with the restored pom file including the section I deleted in step 1.

I think it makes sense to also save the generated java files in github... This should kind-of-solve the issue. Big thanks again for the support!

haesleinhuepf commented 2 years ago

image

🥳

bnorthan commented 2 years ago

hmmm. I still am a bit confused. The automatically generated class should be created before the code is compiled. And in fact it has to be. However it wasn't being generated on your machine because the javacpp parser could not find the source file.

If I understand you correctly, you compiled once with the parser de-activated, re-activated it, and it worked. Maybe the source directory is not set up until the compiler is run once (then it is stored in a settings file or something), so on the next run the source directory is known and the parser works.

I am wondering if on a fresh machine we will still run into issues because the first time you run maven, the parsing will be run before compiling, and it still won't yet have set the source directory.

I'm not completely sure, as I am an intermediate but not an advanced user of maven.

haesleinhuepf commented 2 years ago

Yes, I'm also a bit confused, especially as this workaround is also necessary when renaming classes. So it hit me 2-3 more times.

Anyway I think I can explain it: clesperantoj.java is a Java-file obviously and BridJ appears to access the configuration after compiling it. However, all Java needs to be compiled together. Thus, if there's a compiler error in some other part of the project, this step will fail.

I presume we need one sub-project for generating the wrapper code (a src-folder that contains the current pom.xml and clesperantoj.java) and then another sub-project (in a different src-folder with a different pom.xml) that builds custom java on top of the generated java. In this case, we can also build a jar-file from the second src-folder that does not contain clesperantoj.java. I'm also speculating here btw. :-)

StRigaud commented 1 year ago

I have managed a minimal version which compile and run on my local ubuntu

I also have the issue where I first need to run maven without the content of the <execution> in the pom.xml, and then run it again with the <execution>. This is a bit annoying, I would like to know why and how to fix it because it will prevent use from doing proper CI.

On the other hand, I simplify the CLIc compile and install so that we don't have to manage it. I also removed the linking with OpenCL as this is also managed in CLIc.

We will also need to see how to generalise the @Properties in the clicwrapper/clesperantoj.java class and in the pom.xml for the include and linking.

@haesleinhuepf -> Ready to make a test on windows when you are.

PS: I had to write some java and I did not like it :angry:

haesleinhuepf commented 1 year ago

Hey Stephane @StRigaud ,

I'm just testing on Windows. CLIc_prototype was built without any issues. I'm currently struggling running mvn in clesperantoj_prototype (branch test_stephane_linux). Error below. If you have time and I don't manage before, would be available for a 30 min try-compile-together-zoom 4pm today before we meet the London folks today 4:30?

Error:

C:\structure\code\clesperantoj_prototype>mvn
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< net.clesperanto:clesperantoj_ >--------------------
[INFO] Building clesperantoj_ 0.0.0.1
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- enforcer:1.4.1:enforce (enforce-rules) @ clesperantoj_ ---
[INFO] Skipping Rule Enforcement.
[INFO]
[INFO] --- build-helper:3.3.0:regex-property (sanitize-version) @ clesperantoj_ ---
[INFO]
[INFO] --- build-helper:3.3.0:regex-property (guess-package) @ clesperantoj_ ---
[INFO] No match to regex '[^a-z0-9_.]+' found in 'net.clesperanto.clesperantoj_'. The initial value 'net.clesperanto.clesperantoj_' is left as-is...
[INFO]
[INFO] --- buildnumber:1.4:create (default) @ clesperantoj_ ---
[INFO] Executing: cmd.exe /X /C "git rev-parse --verify HEAD"
[INFO] Working directory: C:\structure\code\clesperantoj_prototype
[INFO] Storing buildNumber: 4da1f8098c49fe5cc1604d274a3c430a40616ec9 at timestamp: 1675860661341
[INFO] Storing buildScmBranch: test_stephane_linux
[INFO]
[INFO] --- scijava:2.0.0:set-rootdir (set-rootdir) @ clesperantoj_ ---
[INFO] Setting rootdir: C:\structure\code\clesperantoj_prototype
[INFO]
[INFO] --- jacoco:0.8.5:prepare-agent (jacoco-initialize) @ clesperantoj_ ---
[INFO] argLine set to -javaagent:C:\\Users\\haase\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.5\\org.jacoco.agent-0.8.5-runtime.jar=destfile=C:\\structure\\code\\clesperantoj_prototype\\target\\jacoco.exec
[INFO]
[INFO] --- exec:1.6.0:exec (cppbuild) @ clesperantoj_ ---
Detected platform "windows-x86_64"
Building for platform "windows-x86_64"
Installing "clesperantoj"
/c/structure/code/clesperantoj_prototype/native/clesperantoj/cppbuild /c/structure/code/clesperantoj_prototype/native
-- The C compiler identification is MSVC 19.34.31933.0
-- The CXX compiler identification is MSVC 19.34.31933.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe - broken
CMake Error at C:/Program Files/CMake/share/cmake-3.25/Modules/CMakeTestCCompiler.cmake:70 (message):
  The C compiler

    "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/structure/code/clesperantoj_prototype/native/clesperantoj/cppbuild/CMakeFiles/CMakeScratch/TryCompile-jr3t5t

    Run Build Command(s):nmake -f Makefile /nologo cmTC_ecf4d\fast &&   "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\nmake.exe"  -f CMakeFiles\cmTC_ecf4d.dir\build.make /nologo -L                  CMakeFiles\cmTC_ecf4d.dir\build
    Building C object CMakeFiles/cmTC_ecf4d.dir/testCCompiler.c.obj
        "C:\Program Files\CMake\bin\cmake.exe" -E cmake_cl_compile_depends --dep-file=CMakeFiles\cmTC_ecf4d.dir\testCCompiler.c.obj.d --working-dir=C:\structure\code\clesperantoj_prototype\native\clesperantoj\cppbuild\CMakeFiles\CMakeScratch\TryCompile-jr3t5t --filter-prefix="Note: including file: " -- C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1434~1.319\bin\Hostx64\x64\cl.exe @C:\Users\haase\AppData\Local\Temp\nm8A4A.tmp
    testCCompiler.c
    Linking C executable cmTC_ecf4d.exe
        "C:\Program Files\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_ecf4d.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1434~1.319\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\cmTC_ecf4d.dir\objects1 @C:\Users\haase\AppData\Local\Temp\nm8A89.tmp
    RC Pass 1: command "rc /fo CMakeFiles\cmTC_ecf4d.dir/manifest.res CMakeFiles\cmTC_ecf4d.dir/manifest.rc" failed (exit code 0) with the following output:
    The system cannot find the file specifiedNMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0xffffffff'
    Stop.
    NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\Hostx64\x64\nmake.exe"' : return code '0x2'
    Stop.

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:7 (project)

-- Configuring incomplete, errors occurred!
See also "C:/structure/code/clesperantoj_prototype/native/clesperantoj/cppbuild/CMakeFiles/CMakeOutput.log".
See also "C:/structure/code/clesperantoj_prototype/native/clesperantoj/cppbuild/CMakeFiles/CMakeError.log".
[ERROR] Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
    at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:804)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:751)
    at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:313)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
StRigaud commented 1 year ago

Let's do that!

haesleinhuepf commented 1 year ago

I'm one step aheed. Compilation is now running. In our documentation it says:

For windows, please use the x64 Native Tools Command Prompt for VS 2019 (64 bit!)

... and then it appears to work... Stay tuned.

haesleinhuepf commented 1 year ago

... I had to do this trick again.

And after executing mvn -X, I see now this error in a long stacktrace:

[INFO] cl /IC:\structure\code\clesperantoj_prototype\src\main\java /IC:\structure\code\clesperantoj_prototype/native/clesperantoj/include /IC:\structure\code\clesperantoj_prototype/native/clesperantoj/cppbuild/_deps/clic_lib-build/clic/include /IC:\Users\haase\.jdks\zulu11.62.17-ca-jdk11.0.18-win_x64\include /IC:\Users\haase\.jdks\zulu11.62.17-ca-jdk11.0.18-win_x64\include\win32 C:\structure\code\clesperantoj_prototype\target\classes\net\clesperanto\clicwrapper\jniclesperantojWrapper.cpp C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp /Oi /O2 /EHsc /Gy /GL /MD /LD /fp:fast /W3 /link /OUT:jniclesperantojWrapper.dll /LIBPATH:C:\structure\code\clesperantoj_prototype/lib/win64/ /LIBPATH:C:\structure\code\clesperantoj_prototype/lib/win64/lib CLIc.lib clesperantoj.lib psapi.lib
Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31933 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

jniclesperantojWrapper.cpp
C:\structure\code\clesperantoj_prototype/native/clesperantoj/include\clesperantoj.hpp(4): fatal error C1083: Cannot open include file: 'clesperanto.hpp': No such file or directory

... I keep debugging ... (just taking notes here)

Edit: This error goes away by adding this to the pom.xml (inspired by):

<includePath>${basedir}/../CLIc_prototype/clic/include/core/</includePath>
haesleinhuepf commented 1 year ago

The next error is now:

[INFO] cl /IC:\structure\code\clesperantoj_prototype\src\main\java /IC:\structure\code\clesperantoj_prototype/native/clesperantoj/include /IC:\structure\code\clesperantoj_prototype/native/clesperantoj/cppbuild/_deps/clic_lib-build/clic/include /IC:\structure\code\clesperantoj_prototype/../CLIc_prototype/clic/include/core/ /IC:\Users\haase\.jdks\zulu11.62.17-ca-jdk11.0.18-win_x64\include /IC:\Users\haase\.jdks\zulu11.62.17-ca-jdk11.0.18-win_x64\include\win32 C:\structure\code\clesperantoj_prototype\target\classes\net\clesperanto\clicwrapper\jniclesperantojWrapper.cpp C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp /Oi /O2 /EHsc /Gy /GL /MD /LD /fp:fast /W3 /link /OUT:jniclesperantojWrapper.dll /LIBPATH:C:\structure\code\clesperantoj_prototype/lib/win64/ /LIBPATH:C:\structure\code\clesperantoj_prototype/lib/win64/lib CLIc.lib clesperantoj.lib psapi.lib
Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31933 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

jniclesperantojWrapper.cpp
C:\structure\code\clesperantoj_prototype/native/clesperantoj/cppbuild/_deps/clic_lib-build/clic/include\clic.hpp(26): fatal error C1083: Cannot open include file: 'CL/opencl.hpp': No such file or directory

I did have that file in this folder:

<includePath>${basedir}/../CLIc_prototype/thirdparty/opencl/ocl-clhpp/include/</includePath>

But this is missing in the current CLIc_prototype... and it doesn't exist in the NVidia CL: image

Edit: and this error goes away by adding this to the pom.xml:

<includePath>${basedir}/../CLIc_prototype/build/thirdparty/opencl_clhpp-src/include/</includePath>
StRigaud commented 1 year ago

Wait, you should not have a CLIc_prototype in your basedir. MVN should deal with compiling the lib and including the folders needed for the reste of the process.

Also, you should not rely on the include of OpenCL as CLIc is providing them already. Same for binding to OpenCL, CMake and CLIc is managing that, maven need just to link CLIc and ClesperantoJ lib to the jar.

haesleinhuepf commented 1 year ago

Wait, you should not have a CLIc_prototype in your basedir.

Hm, no I don't see this folder:

C:\structure\code\clesperantoj_prototype>dir
 Volume in drive C has no label.
 Volume Serial Number is 1C19-0CE7

 Directory of C:\structure\code\clesperantoj_prototype

02/08/2023  02:58 PM    <DIR>          .
02/08/2023  02:58 PM    <DIR>          ..
02/07/2023  01:21 PM               532 .gitignore
02/08/2023  02:22 PM    <DIR>          .idea
02/07/2023  01:20 PM    <DIR>          developer_docs
02/07/2023  01:20 PM    <DIR>          imgs
02/08/2023  02:06 PM    <DIR>          lib
02/07/2023  01:21 PM    <DIR>          native
02/08/2023  02:58 PM             7,198 pom.xml
02/07/2023  01:33 PM             6,741 README.md
02/07/2023  01:20 PM    <DIR>          src
02/08/2023  02:11 PM    <DIR>          target
               3 File(s)         14,471 bytes
               9 Dir(s)  490,263,470,080 bytes free

I added one more include dir to the pom:

<includePath>C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2/include/</includePath>

And now I see this error:

[INFO] cl /IC:\structure\code\clesperantoj_prototype\src\main\java /IC:\structure\code\clesperantoj_prototype/native/clesperantoj/include /IC:\structure\code\clesperantoj_prototype/native/clesperantoj/cppbuild/_deps/clic_lib-build/clic/include /IC:\structure\code\clesperantoj_prototype/../CLIc_prototype/clic/include/core/ /IC:\structure\code\clesperantoj_prototype/../CLIc_prototype/build/thirdparty/opencl_clhpp-src/include/ "/IC:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2/include/" /IC:\Users\haase\.jdks\zulu11.62.17-ca-jdk11.0.18-win_x64\include /IC:\Users\haase\.jdks\zulu11.62.17-ca-jdk11.0.18-win_x64\include\win32 C:\structure\code\clesperantoj_prototype\target\classes\net\clesperanto\clicwrapper\jniclesperantojWrapper.cpp C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp /Oi /O2 /EHsc /Gy /GL /MD /LD /fp:fast /W3 /link /OUT:jniclesperantojWrapper.dll /LIBPATH:C:\structure\code\clesperantoj_prototype/lib/win64/ /LIBPATH:C:\structure\code\clesperantoj_prototype/lib/win64/lib CLIc.lib clesperantoj.lib psapi.lib
Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31933 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

jniclesperantojWrapper.cpp
C:\structure\code\CLIc_prototype\clic\include\core\cleBackend.hpp(10): error C2429: language feature 'nested-namespace-definition' requires compiler flag '/std:c++17'
C:\structure\code\CLIc_prototype\clic\include\core\cleBackend.hpp(30): warning C4267: 'argument': conversion from 'size_t' to 'cl_uint', possible loss of data
C:\structure\code\CLIc_prototype\clic\include\core\cleMemory.hpp(15): error C2429: language feature 'nested-namespace-definition' requires compiler flag '/std:c++17'
StRigaud commented 1 year ago

So,

Inside native you have a javacpp.sh script and a cmakelist.txt which will take care of DL CLIc, build it, and install it along the overlayer clesperantoJ. All of those are then install in the folder {basedir}/lib/{platform}

inside this lib folder you should have

ALL <includePath> and <linkPath> of the pom.xml should lead to there as the lib folder normally contain all that is needed in therm of lib and include. You should not be needed to go fetch some specific path folder outside the basedir/lib. With one exception inside the native folder, here

However you may need to update some stuff here for windows specific values.

But I repeat, ClesperantoJ is not in charge of linking to your OpenCL install. CLIc is in charge of this, ClesperantoJ only link to CLIc.

haesleinhuepf commented 1 year ago

Inside native you have a javacpp.sh script

Yeah, executing bash scripts on windows is a bit tricky. I'll show you later.

haesleinhuepf commented 1 year ago

I just pushed my half-backed changes: https://github.com/clEsperanto/clesperantoj_prototype/compare/test_stephane_linux...test_robert_windows

StRigaud commented 1 year ago

So first test see if it solve your issue:

Look at this commit and make the same changes on your side (the CMakeList inside the native>clesperantoj.

This should tell your compiler to use the correct C++17 flag and hopefully fix the issue.

bnorthan commented 1 year ago

I'm happy to test the build and build instructions with both Windows on Linux on my machines, when there is a branch ready that should work on both. Let me know if that is the case, and if so what branch I should use.

haesleinhuepf commented 1 year ago

So first test see if it solve your issue:

The error becomes then this:

Installing "clesperantoj"
/c/structure/code/clesperantoj_prototype/native/clesperantoj/cppbuild /c/structure/code/clesperantoj_prototype/native
-- clesperantoj
-- Build project code coverage: OFF
-- Build CLIc as shared lib: OFF
-- Build tests: OFF
-- Build documentation: ON (WIP)
-- Build benchmark: OFF
-- CMAKE_BUILD_TYPE: Release
-- CMAKE_GENERATOR: Single-config
-- CMAKE_GENERATOR: NMake Makefiles
-- CMAKE_REGISTRY_FOLDER: OFF
-- OpenCL_LIBRARY : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2/lib/x64/OpenCL.lib
-- Configuring done
-- Generating done
-- Build files have been written to: C:/structure/code/clesperantoj_prototype/native/clesperantoj/cppbuild

Microsoft (R) Program Maintenance Utility Version 14.34.31933.0
Copyright (C) Microsoft Corporation.  All rights reserved.

[  1%] Generating kernels header from clij opencl files.
[  1%] Built target generate_kernels
[  2%] Generating cleKernelList header.
[  2%] Built target generate_kernels_list
[  3%] Building CXX object _deps/clic_lib-build/clic/CMakeFiles/CLIc.dir/src/core/cleImage.cpp.obj
cleImage.cpp
C:\structure\code\clesperantoj_prototype\native\clesperantoj\cppbuild\_deps\clic_lib-src\clic\include\core\cleBackend.hpp(10): error C2429: language feature 'nested-namespace-definition' requires compiler flag '/std:c++17'
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\nmake.exe"' : return code '0x2'
StRigaud commented 1 year ago

Okay. So still the same issue of the compiler requesting the /std:c+17 flag. Though I am actually specifying it in CMake.

Can you first try to run Repair on your Visual Studio? This is a solution suggested here

Meaning while I am trying to setup a dev environment on a windows at work to make some test on my side and I a hitting also an issue. Maven fail when needing to run the cppbuild.sh shell script. I cannot make then run correctly. How is this running on your side?

bnorthan commented 1 year ago

Robert may have a more elegant solution, but I start up the Visual Studio 'x64 Native Tools' command prompt, then start a bash session from within that prompt. Then I can run bash scripts and also have all the Microsoft compiler paths set up properly. image

StRigaud commented 1 year ago

Thanks @bnorthan I will try this

haesleinhuepf commented 1 year ago

Can you first try to run Repair on your Visual Studio? This is a solution suggested here

This didn't work. I'm working with VS 2022 and the suggestion is for VS 2017 btw...

haesleinhuepf commented 1 year ago

I've also tried to compile it with the CLIc branch 'c++11-compatibility-v2' and this also didn't work. Still same error:

[INFO] --- exec:1.6.0:exec (cppbuild) @ clesperantoj_ ---
Detected platform "windows-x86_64"
Building for platform "windows-x86_64"
Installing "clesperantoj"
/c/structure/code/clesperantoj_prototype/native/clesperantoj/cppbuild /c/structure/code/clesperantoj_prototype/native
-- clesperantoj
-- Build project code coverage: OFF
-- Build CLIc as shared lib: OFF
-- Build tests: OFF
-- Build documentation: ON (WIP)
-- Build benchmark: OFF
-- CMAKE_BUILD_TYPE: Release
-- CMAKE_GENERATOR: Single-config
-- CMAKE_GENERATOR: NMake Makefiles
-- CMAKE_REGISTRY_FOLDER: OFF
-- OpenCL_LIBRARY : C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2/lib/x64/OpenCL.lib
-- Configuring done
-- Generating done
-- Build files have been written to: C:/structure/code/clesperantoj_prototype/native/clesperantoj/cppbuild

Microsoft (R) Program Maintenance Utility Version 14.34.31933.0
Copyright (C) Microsoft Corporation.  All rights reserved.

[  1%] Generating cleKernelList header.
[  1%] Built target generate_kernels_list
[  2%] Generating kernels header from clij opencl files.
[  2%] Built target generate_kernels
[  3%] Building CXX object _deps/clic_lib-build/clic/CMakeFiles/CLIc.dir/src/core/cleImage.cpp.obj
cleImage.cpp
C:\structure\code\clesperantoj_prototype\native\clesperantoj\cppbuild\_deps\clic_lib-src\clic\include\core\cleBackend.hpp(10): error C2429: language feature 'nested-namespace-definition' requires compiler flag '/std:c++17'
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.34.31933\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
[ERROR] Command execution failed.
StRigaud commented 1 year ago

So just to be clear, the issue is not so much with our build and the wrapper but its with the compilation flag given to VS2022 compiler so that he build the code.

This should be managed by CMake but for unknown reason, it is not ... The weird stuff it is that outside of this repo, CLIc build all fine on windows. Hence something is stopping CMake to pass the correct flags here.

I have made a new branch on CLIc to do some test on my side: std-flag-compatibility and I will continue using my branch here.

My current guess is related to possible incompatibility between CMake way of specifying C++ version flag and and extension management. So I am changing the CMake so that we only rely on the old way for a start

StRigaud commented 1 year ago

So,

We have fix the CMake compilation for windows, and now the CLIc and clesperantoJ C++ library in native are compiled through the cppbuild.sh called by maven.

However, it seems that javacpp is doing a second round relying on the compiler and we hit again the error where it requires the compilation flag /std:c++17. This not on CMake side so it must be provided either in the pom.xml or in the clicwrapper/clesperantoJ.java source file in the @properties options, or else where but I have no idea. @bnorthan if it rings any bell here, proposition are welcome!

This is clearly a microscoft compiler issue which gcc (and clang?) do not have.

I will continue to work on this when I can

bnorthan commented 1 year ago

What's the best branch to try and run the newest Windows build with?

StRigaud commented 1 year ago

Mine "in theory" should be good for both. Though I am still trying to reach the same error that Robert has, there is nothing platform specific.

Bash script and OpenCL and Path are good, now facing a submodule cascade which fail with a "path name too long" issue.

StRigaud commented 1 year ago

FYI I managed now to reproduced @haesleinhuepf error. At least we have this comming.

Same issue, CMake compilation is doing fine, but now fail during the build execution of javacpp where it requires compiler flag '/std:c++17'

EDIT: Alternative solution -> use gcc on windows?

StRigaud commented 1 year ago

RHAAAAAAAAAAAAAAAAAAAAA

@Properties(value = { @Platform(
        // note: comment this in to debug
        compiler = { "cpp17" }, // removed "fastfpu", don't know what it does
        // header file for c++ class we want to wrap
        include = "clesperantoj.hpp",
        // libraries we need to link to
        link = { "clesperantoj" })

It build on windows!

EDIT: still need to make it run now

haesleinhuepf commented 1 year ago

It looks we're a step ahead indeed! I had to change "SHARED" to "STATIC" again here because of an error "clesperantoj.lib" not found.

I'm getting a linker error though:

[INFO] cl /IC:\structure\code\clesperantoj_prototype\src\main\java /IC:\structure\code\clesperantoj_prototype\native\clesperantoj\include /IC:\structure\code\clesperantoj_prototype\lib\win64\include\CLIc /IC:\Users\haase\.jdks\zulu11.62.17-ca-jdk11.0.18-win_x64\include\win32 /IC:\Users\haase\.jdks\zulu11.62.17-ca-jdk11.0.18-win_x64\include C:\structure\code\clesperantoj_prototype\target\classes\net\clesperanto\clicwrapper\jniclesperantojWrapper.cpp C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp /Oi /O2 /EHsc /Gy /GL /MD /LD /std:c++17 /Zc:__cplusplus /W3 /link /OUT:jniclesperantojWrapper.dll /LIBPATH:C:\structure\code\clesperantoj_prototype\lib\win64 clesperantoj.lib psapi.lib
Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31933 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

jniclesperantojWrapper.cpp
C:\structure\code\clesperantoj_prototype\lib\win64\include\CLIc\cleBackend.hpp(30): warning C4267: 'argument': conversion from 'size_t' to 'cl_uint', possible loss of data
C:\structure\code\clesperantoj_prototype\target\classes\net\clesperanto\clicwrapper\jniclesperantojWrapper.cpp(284): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\structure\code\clesperantoj_prototype\target\classes\net\clesperanto\clicwrapper\jniclesperantojWrapper.cpp(285): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\structure\code\clesperantoj_prototype\target\classes\net\clesperanto\clicwrapper\jniclesperantojWrapper.cpp(307): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\structure\code\clesperantoj_prototype\target\classes\net\clesperanto\clicwrapper\jniclesperantojWrapper.cpp(321): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\structure\code\clesperantoj_prototype\target\classes\net\clesperanto\clicwrapper\jniclesperantojWrapper.cpp(323): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
jnijavacpp.cpp
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(255): warning C4267: '=': conversion from 'size_t' to 'DWORD', possible loss of data
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(477): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(654): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(655): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(677): warning C4267: 'argument': conversion from 'size_t' to 'jsize', possible loss of data
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(744): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(746): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(1149): warning C4244: 'argument': conversion from 'jlong' to 'jint', possible loss of data
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(1150): warning C4244: 'argument': conversion from 'jlong' to 'jint', possible loss of data
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(1478): warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(1513): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(1557): warning C4996: 'strtok': This function or variable may be unsafe. Consider using strtok_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(1635): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(1718): warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
C:\structure\code\clesperantoj_prototype\target\classes\jnijavacpp.cpp(1781): warning C4996: 'strncat': This function or variable may be unsafe. Consider using strncat_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
Microsoft (R) Incremental Linker Version 14.34.31933.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:jniclesperantojWrapper.dll
/ltcg
/dll
/implib:jniclesperantojWrapper.lib
/OUT:jniclesperantojWrapper.dll
/LIBPATH:C:\structure\code\clesperantoj_prototype\lib\win64
clesperantoj.lib
psapi.lib
jniclesperantojWrapper.obj
jnijavacpp.obj
   Creating library jniclesperantojWrapper.lib and object jniclesperantojWrapper.exp
jniclesperantojWrapper.obj : error LNK2001: unresolved external symbol clReleaseCommandQueue
clesperantoj.lib(clesperantoj.cpp.obj) : error LNK2001: unresolved external symbol clReleaseCommandQueue
jniclesperantojWrapper.obj : error LNK2001: unresolved external symbol clReleaseContext
clesperantoj.lib(clesperantoj.cpp.obj) : error LNK2001: unresolved external symbol clReleaseContext
jniclesperantojWrapper.obj : error LNK2001: unresolved external symbol clReleaseMemObject
jniclesperantojWrapper.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl cle::Image::ToString(void)const " (?ToString@Image@cle@@UEBA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
jniclesperantojWrapper.obj : error LNK2001: unresolved external symbol "public: virtual unsigned __int64 __cdecl cle::Image::GetNumberOfElements(void)const " (?GetNumberOfElements@Image@cle@@UEBA_KXZ)
jniclesperantojWrapper.obj : error LNK2001: unresolved external symbol "public: virtual class std::array<unsigned __int64,3> const & __cdecl cle::Image::Shape(void)const " (?Shape@Image@cle@@UEBAAEBV?$array@_K$02@std@@XZ)
jniclesperantojWrapper.obj : error LNK2001: unresolved external symbol "public: virtual unsigned int __cdecl cle::Image::Ndim(void)const " (?Ndim@Image@cle@@UEBAIXZ)
jniclesperantojWrapper.obj : error LNK2001: unresolved external symbol "public: virtual unsigned __int64 __cdecl cle::Image::GetMemorySize(void)const " (?GetMemorySize@Image@cle@@UEBA_KXZ)
jniclesperantojWrapper.obj : error LNK2001: unresolved external symbol "public: virtual unsigned __int64 __cdecl cle::Image::GetDataSizeOf(void)const " (?GetDataSizeOf@Image@cle@@UEBA_KXZ)
jniclesperantojWrapper.obj : error LNK2001: unresolved external symbol clReleaseDevice
clesperantoj.lib(clesperantoj.cpp.obj) : error LNK2001: unresolved external symbol clReleaseDevice
clesperantoj.lib(clesperantoj.cpp.obj) : error LNK2001: unresolved external symbol "public: __cdecl cle::Clesperanto::Clesperanto(void)" (??0Clesperanto@cle@@QEAA@XZ)
clesperantoj.lib(clesperantoj.cpp.obj) : error LNK2001: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl cle::Clesperanto::Info(void)" (?Info@Clesperanto@cle@@QEAA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ)
jniclesperantojWrapper.dll : fatal error LNK1120: 12 unresolved externals
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.995 s
[INFO] Finished at: 2023-02-15T13:42:51+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.bytedeco:javacpp:1.5.8:build (process-classes) on project clesperantoj_: Execution process-classes of goal org.bytedeco:javacpp:1.5.8:build failed: Process exited with an error: 2 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.bytedeco:javacpp:1.5.8:build (process-classes) on project clesperantoj_: Execution process-classes of goal org.bytedeco:javacpp:1.5.8:build failed: Process exited with an error: 2
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:347)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:260)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:172)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:100)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:821)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:270)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution process-classes of goal org.bytedeco:javacpp:1.5.8:build failed: Process exited with an error: 2
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:133)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:260)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:172)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:100)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:821)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:270)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.RuntimeException: Process exited with an error: 2
    at org.bytedeco.javacpp.tools.Builder.generateAndCompile (Builder.java:620)
    at org.bytedeco.javacpp.tools.Builder.build (Builder.java:1167)
    at org.bytedeco.javacpp.tools.BuildMojo.execute (BuildMojo.java:417)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:260)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:172)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:100)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:821)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:270)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[ERROR]
[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/PluginExecutionException
[DEBUG] Shutting down adapter factory; available factories [file-lock, rwlock-local, semaphore-local, noop]; available name mappers [discriminating, file-gav, file-hgav, gav, static]
[DEBUG] Shutting down 'file-lock' factory
[DEBUG] Shutting down 'rwlock-local' factory
[DEBUG] Shutting down 'semaphore-local' factory
[DEBUG] Shutting down 'noop' factory
StRigaud commented 1 year ago

WE normally should stick to SHARED. I do not know it if can run with STATIC, it fail on my Linux.

Now SHARED also fail on windows and I am stuck there too. Hit me when you wanna try together

haesleinhuepf commented 1 year ago

I made it work in #10. Let me know if you know better how to do the same thing. We're meeting in about an hour right? :-)

StRigaud commented 1 year ago

Okay so, following our last meeting, @bnorthan pointed the missing piece of the puzzle for windows:

https://github.com/clEsperanto/clesperantoj_prototype/blob/86a481e83e04251dc1976428cb584ace87c0ebb7/native/clesperantoj/include/clesperantoj.hpp#L17-L21

Following this, I update my branch with the CMake equivalent option:

https://github.com/clEsperanto/clesperantoj_prototype/blob/f055e528139cfe31b614b2bad1fa9dc0ec815107/native/clesperantoj/CMakeLists.txt#L19

Still need to be tested, will do it soon.

StRigaud commented 1 year ago

Okay so,

I have tested on a windows the CMake option CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS. It work and it generate a dll, though it also generate a static lib with it. I am not sure how dissociable these are.

In the linking part, JavaCPP requires both JCLIc and OpenCL to work for windows.

After fixing all those little annoying things, It compile and run all fine! :partying_face:

I extended the over-all with a beginning of a wrapper structure similar to what I did for the python. High wrapping though still keeping elements separated to allow flexibility.

All this is in my brand test_stephane_linux. Will update the doc / README soon.

StRigaud commented 3 months ago

I close this. Do not hesitate to reopen if needed.