Skip to content

UnsatisfiedLinkError in beablebone black / bulldog-linux-native.so #114

@cjritola

Description

@cjritola

Problem with loading bulldog-linux-native.so.

Built a runnable JAR using SNAPSHOT as well as maven 0.3.0 using Eclipse, copied to BBB with fresh install of Debian 9.5 2018-10-07 4GB SD IoT found here (https://beagleboard.org/latest-images). Run, get:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no bulldog-linux-native in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at io.silverspoon.bulldog.linux.util.LinuxLibraryLoader.loadLibraryFromClasspath(LinuxLibraryLoader.java:51)
at io.silverspoon.bulldog.linux.util.LinuxLibraryLoader.loadNativeLibrary(LinuxLibraryLoader.java:60)
at io.silverspoon.bulldog.beagleboneblack.BeagleBoneBlackBoardFactory.createBoard(Unknown Source)
at io.silverspoon.bulldog.core.platform.Platform.createBoard(Unknown Source)
at ax25utils.CounterInputReporter.(CounterInputReporter.java:18)
at ax25utils.CounterInputReporter.main(CounterInputReporter.java:14)

... modified LinuxLibraryLoader to verify that the file exists at that path and it does:

private static void loadLibraryFromClasspath(String path) throws IOException {
File targetFile = File.createTempFile(LIB_NAME, ".so");
targetFile.deleteOnExit();
try (InputStream source = LinuxLibraryLoader.class.getResourceAsStream(path)) {
if (source == null) {
throw new FileNotFoundException("File " + path + " was not found in classpath.");
}
Files.copy(source, targetFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
}
// Finally, load the library
System.out.println("File exists? "+targetFile.exists());
System.load(targetFile.getAbsolutePath());
}

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
DEBUG: targetFile.exists()=true

... so the .so file is definitely at the path given yet the Exception states it cannot find an .so file. Next after extracting the .so file to local dir I wrote a small C program to try and load that file on the BBB.


#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>

int main() {
 void *lib_handle;
 
 lib_handle = dlopen("bulldog-linux-native.so", RTLD_NOW);
 if(!lib_handle) {
  printf("Failed to load: %s\n", dlerror());
  exit(1);
 }//end fail
 dlclose(lib_handle);
 return 0;
}

Also copied libroboticscape.so and tried both. libroboticscape.so loaded fine. bulldog-linux-native.so threw the following:

Failed to load: bulldog-linux-native.so: cannot open shared object file: No such file or directory

Here is output of LDD:

ldd bulldog-linux-native.so
not a dynamic executable

Here is output of file:

$ file bulldog-linux-native.so
bulldog-linux-native.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, not stripped

There are appears to be something wrong with the .so file. Either its throwing an error which is then being wrapped as a cannot-find-file error, or something inside the .so itself is failing to find an .so file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions