Open DCNick3 opened 9 months ago
@DCNick3 can you explain in detail how you worked around the issue? Where is the call to loadLibrary
? Thanks
The call is here I believe.
Here's a complete diff I used for my workaround:
diff --git a/lib/fetch_libs_and_build.sh b/lib/fetch_libs_and_build.sh
index d31b5e5..2917ba7 100755
--- a/lib/fetch_libs_and_build.sh
+++ b/lib/fetch_libs_and_build.sh
@@ -1,7 +1,7 @@
#!/bin/bash
[ ! -f src/main/resources/linux-x86-64/libdwarf.so ] && \
- curl -o src/main/resources/linux-x86-64/libdwarf.so -L --create-dirs https://github.com/cesena/libdwarf-ghidra2dwarf/releases/download/latest/libdwarf.so
+ curl -o src/main/resources/linux-x86-64/libdwarf_vendor.so -L --create-dirs https://github.com/cesena/libdwarf-ghidra2dwarf/releases/download/latest/libdwarf.so
[ ! -f src/main/resources/win32-x86-64/libdwarf.dll ] && \
curl -o src/main/resources/win32-x86-64/libdwarf.dll -L --create-dirs https://github.com/cesena/libdwarf-ghidra2dwarf/releases/download/latest/libdwarf.dll
diff --git a/lib/pom.xml b/lib/pom.xml
index b376647..a318e27 100644
--- a/lib/pom.xml
+++ b/lib/pom.xml
@@ -10,8 +10,8 @@
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>1.7</maven.compiler.source>
- <maven.compiler.target>1.7</maven.compiler.target>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
diff --git a/lib/src/main/java/libdwarf/LibdwarfLibrary.java b/lib/src/main/java/libdwarf/LibdwarfLibrary.java
index f6eaa90..88372ca 100644
--- a/lib/src/main/java/libdwarf/LibdwarfLibrary.java
+++ b/lib/src/main/java/libdwarf/LibdwarfLibrary.java
@@ -10,7 +10,7 @@ import com.sun.jna.ptr.LongByReference;
import com.sun.jna.ptr.PointerByReference;
public interface LibdwarfLibrary extends Library {
- public static final LibdwarfLibrary INSTANCE = (LibdwarfLibrary)Native.loadLibrary(Platform.isWindows() ? "libdwarf" : "dwarf", LibdwarfLibrary.class);
+ public static final LibdwarfLibrary INSTANCE = (LibdwarfLibrary)Native.loadLibrary(Platform.isWindows() ? "libdwarf" : "dwarf_vendor", LibdwarfLibrary.class);
// functions
String dwarf_errmsg(LibdwarfLibrary.Dwarf_Error Dwarf_Error1);
(the change to use of java 1.8 was probably because that's what I have on my system)
Then I re-built the plugin with the fetch_libs_and_build.sh
script in the lib
subfolder. After this the build plugin will be located at target/libdwarf.jar
When using with ghidra 10.3.3 on arch linux, I get the following error:
This seems to happen because of version mismatch of system libdwarf and the one used by the script + the loader preferring the system libdwarf over the one provided in the script.
I was able to work around the issue by renaming the library to
libdwardf_vendor.so
and updating the library to callloadLibrary
withdwardf_vendor