PDAL / java

Java extension and bindings for PDAL
https://pdal.io/java.html
Other
8 stars 10 forks source link

[macos-arm] @rpath problem #98

Closed WhiteSte closed 8 months ago

WhiteSte commented 8 months ago

I'm using the last snapshot version 2.6.3+1-a017f86c-SNAPSHOT together with pdal v2.7.0

I'm getting the following problem:

java.lang.UnsatisfiedLinkError: /private/var/folders/5l/hyxnq7h918n15ghp3k65z3380000gn/T/jni-12734689024374330701/libpdaljni.2.6.dylib: dlopen(/private/var/folders/5l/hyxnq7h918n15ghp3k65z3380000gn/T/jni-12734689024374330701/libpdaljni.2.6.dylib, 0x0001): Library not loaded: @rpath/libpdalcpp.17.dylib
  Referenced from: <23F2C953-BC7A-3A17-A169-9FC262FD3C12> /private/var/folders/5l/hyxnq7h918n15ghp3k65z3380000gn/T/jni-12734689024374330701/libpdaljni.2.6.dylib
  Reason: tried: '@rpath/libpdalcpp.17.dylib' (no such file), '/usr/local/lib/libpdalcpp.17.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libpdalcpp.17.dylib' (no such file), '/opt/homebrew/lib/libpdalcpp.17.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/lib/libpdalcpp.17.dylib' (no such file), '/opt/local/lib/libpdalcpp.17.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/local/lib/libpdalcpp.17.dylib' (no such file), '/Users/runner/miniconda3/envs/pdal-java/lib/libpdalcpp.17.dylib' (no such file), '/System/Volume
        at processing.opengl.PSurfaceJOGL.lambda$initAnimator$2(PSurfaceJOGL.java:426)
        at java.base/java.lang.Thread.run(Thread.java:833)

I've already tried the proposed solution in the readme:

> pdal-config --libs
-L/nix/store/m4bnvl67dml3lylzd026ccrh449158cn-pdal-2.7.0/lib -lpdalcpp

> echo $DYLD_FALLBACK_LIBRARY_PATH

/nix/store/m4bnvl67dml3lylzd026ccrh449158cn-pdal-2.7.0/lib

Could the problem be related due to different version between pdal and pdal-java?

pomadchin commented 8 months ago

Hi, I assume it can't find /usr/local/lib/libpdalcpp.17.dylib; what's installed there? ls -la /usr/local/lib/ | grep libpdalcpp

WhiteSte commented 8 months ago

Nothing, my installation is done through nix. Everything is inside there /nix/store/m4bnvl67dml3lylzd026ccrh449158cn-pdal-2.7.0/lib

pomadchin commented 8 months ago

Oh I meant that it looks like DYLD_FALLBACK_LIBRARY_PATH was not properly propagated

pomadchin commented 8 months ago

Could you try the examples project with the following params set in the build.sbt?

run / envVars += ("DYLD_FALLBACK_LIBRARY_PATH" -> "/nix/store/m4bnvl67dml3lylzd026ccrh449158cn-pdal-2.7.0/lib")
WhiteSte commented 8 months ago

I'm doing

sbt run 1/2/3/4 from inside /examples/ and for each i get

[warn] No sbt.version set in project/build.properties, base directory: /Users/steve/Downloads/java-main/examples
[info] welcome to sbt 1.9.8 (Eclipse Adoptium Java 17.0.7)
[info] set current project to examples (in build file:/Users/steve/Downloads/java-main/examples/)
[error] java.lang.RuntimeException: No main class detected.
[error]     at scala.sys.package$.error(package.scala:30)
[error] stack trace is suppressed; run last Compile / bgRun for the full output
[error] (Compile / bgRun) No main class detected.
[error] Total time: 0 s, completed 22 mar 2024, 01:14:56

I suppose i need to compile something but how?

WhiteSte commented 8 months ago

btw Installing pdal with brew solved the problem, i suppose that effectively DYLD_FALLBACK_LIBRARY_PATH is not catched

pomadchin commented 8 months ago

sbt run will do compilation for you; the folder is incorrect; cd examples/pdal-jni; sbt run

pomadchin commented 8 months ago

Also don't forget updating the version: https://github.com/PDAL/java/blob/main/examples/pdal-jni/build.sbt#L26

WhiteSte commented 8 months ago

it works i think (?) except for some errors at the end

(I have uninstalled pdal from brew in order to have a clean system)

[success] Total time: 3 s, completed 22 mar 2024, 01:26:12
[error] Expected letter
[error] Expected symbol
[error] Expected '+'
[error] Expected '++'
[error] Expected 'java++'
[error] Expected 'java+'
[error] Expected '^'
pomadchin commented 8 months ago

I'll close this one for now; feel free to re-open it / make a new issue if it's still there!