y-scope / clp-ffi-java

Apache License 2.0
10 stars 3 forks source link

CLP FFI for Linux/aarch64 #46

Open suddendust opened 2 weeks ago

suddendust commented 2 weeks ago

Request

I am getting the following exception while trying to build my application on linux/aarch64

2024-06-13T11:18:17.715+00:00 clp-ffi: Failed to find native library in JAR.
2024-06-13T11:18:17.717+00:00 clp-ffi: System.loadLibrary failed - no clp-ffi-java in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib

Does CLP-FFI have a distribution for linux/aarch64?

Possible implementation

N/A

kirkrodrigues commented 2 weeks ago

Hi @suddendust,

We don't include an aarch64 binary in the package right now. Let me look into adding it (we had plans to add it before but put it on hold temporarily).

suddendust commented 2 weeks ago

Thanks @kirkrodrigues

kirkrodrigues commented 1 week ago

We have a process to build the new binaries. I'll need to go through a few PRs and then release a new version. Will let you know when it's ready.

suddendust commented 1 week ago

@kirkrodrigues really helpful, thanks! Please let me know if I can help in any way.

suddendust commented 1 week ago

@kirkrodrigues Are there instructions on how to build it by ourselves? It'll be faster for us, thanks!

jackluo923 commented 1 week ago

Hi @suddendust,

If you simply want to build the project on an aarch64 machine, you can follow the instructions provided in the clp-ffi-java README. It works as expected and we use them within Uber.

The challenging part is not building, but rather publishing an artifact that includes multiple platform-specific binaries and automatically selects the correct one at run-time. This is particularly tricky on macOS, where the JVM might run in emulated mode rather than natively, making it difficult to determine whether to load the aarch64 or x86-64 library. @kirkrodrigues will provide more updates when a new release is available with multi-platform binaries.

suddendust commented 5 days ago

@jackluo923 I tried building the binary but got the following exception. I do have g++ and CMake installed on my Linux machine:

CMake Error at CMakeLists.txt:77 (target_compile_features):
  target_compile_features specified unknown feature "cxx_std_17" for target
  "clp-ffi-java".

-- Configuring incomplete, errors occurred!
See also "/home/pinot/clp-ffi-java/target/cmake-build/CMakeFiles/CMakeOutput.log".
See also "/home/pinot/clp-ffi-java/target/cmake-build/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:1000)
    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:947)
    at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:471)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    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)

Still debugging this, but wondering if you've already seen this and can help me out here. Thanks!