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

Linux x64 binding exception #111

Open
jsorel opened this issue Dec 12, 2024 · 2 comments
Open

Linux x64 binding exception #111

jsorel opened this issue Dec 12, 2024 · 2 comments
Labels
question Further information is requested

Comments

@jsorel
Copy link

jsorel commented Dec 12, 2024

Hello,

I am trying to use java bindings on linux x64 (fedora 40). but the .so fails to load in java with a good old exception :

Exception in thread "main" java.lang.UnsatisfiedLinkError: /tmp/jni-1601019841721826404/libpdaljni.2.8.so: libpdalcpp.so.18: Ne peut ouvrir le fichier d'objet partagé: Aucun fichier ou dossier de ce type
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2399)
	at java.base/java.lang.Runtime.load0(Runtime.java:852)
	at java.base/java.lang.System.load(System.java:2030)

The file does exist, and is a valid x64 elf,

(base) jsorel@pc10:/tmp/jni-1601019841721826404$ readelf -h libpdaljni.2.8.so 
En-tête ELF:
  Magique:   7f 45 4c 46 02 01 01 03 00 00 00 00 00 00 00 00 
  Classe:                            ELF64
  Données:                          complément à 2, système à octets de poids faible d'abord (little endian)
  Version:                           1 (actuelle)
  OS/ABI:                            UNIX - GNU
  Version ABI:                       0
  Type:                              DYN (fichier objet partagé)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Adresse du point d'entrée:         0x0
  Début des en-têtes de programme :  64 (octets dans le fichier)
  Début des en-têtes de section :    176120 (octets dans le fichier)
  Fanions:                           0x0
  Taille de cet en-tête:             64 (octets)
  Taille de l'en-tête du programme:  56 (octets)
  Nombre d'en-tête du programme:     11
  Taille des en-têtes de section:    64 (octets)
  Nombre d'en-têtes de section:      32
  Table d'index des chaînes d'en-tête de section: 31

But it's a dynamic lib, not a static one.

When listing the native links in the .so we have :

(base) jsorel@pc10:/tmp/jni-1601019841721826404$ ldd libpdaljni.2.8.so
ldd: attention : vous n'avez pas la permission d'exécution pour `./libpdaljni.2.8.so'
	linux-vdso.so.1 (0x00007fd4c780c000)
	libpdalcpp.so.18 => not found
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fd4c7400000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fd4c779b000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fd4c721e000)
	libm.so.6 => /lib64/libm.so.6 (0x00007fd4c76ba000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fd4c780e000)

libpdalcpp.so.18 => not found

I believe this is why the so is not loaded, because a required lib is not available.

I tried installing PDAL on my machine, so I got pdal 2.5.6 (the latest one available on fedora 40) and downgraded the java binding to the closest version which is 2.5.1.

This time it loads but crashed a bit later :

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f5a7bb8238f, pid=28993, tid=28994
#
# JRE version: OpenJDK Runtime Environment Temurin-22.0.2+9 (22.0.2+9) (build 22.0.2+9)
# Java VM: OpenJDK 64-Bit Server VM Temurin-22.0.2+9 (22.0.2+9, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# C  [libpdal_base.so.15+0x38238f]  pdal::PipelineManager::validateStageOptions() const+0x1f
#

In it's current state the portable binding only works if you have the exact same version of PDAL already installed.

Would it be possible to have a release with a static build of PDAL java bindings for linux x64 ?

thank you

Johann

@pomadchin pomadchin added the enhancement New feature or request label Dec 12, 2024
@pomadchin
Copy link
Collaborator

pomadchin commented Dec 12, 2024

Hi! Thanks for reporting. That's a good question, should be not hard to do, most likely a flag. But I thought / think it's still treated as the 'x86' platform.

@pomadchin
Copy link
Collaborator

pomadchin commented Dec 12, 2024

I believe this is why the so is not loaded, because a required lib is not available.

That is correct, PDAL-JNI is just PDAL bindings. Reading through the issue one more time.

But it's a dynamic lib, not a static one.

This is also true, we rely on the PDAL version and dynamically link. 👍

  • Could you try the latest PDAL / bindings versions?
  • What is the code that is running? Mb it's a bug of the older bindings overlapped with smth else.

@pomadchin pomadchin added question Further information is requested and removed enhancement New feature or request labels Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants