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

extractRegistered prompts java.io.FileNotFoundException for extracted dependency #29

Open
cafhach opened this issue Feb 4, 2019 · 1 comment

Comments

@cafhach
Copy link

cafhach commented Feb 4, 2019

For my native library, I need to extract some native dependencies and I wanted to use NativeLoader.extractRegistered() for that. I put all of them into a jar and listed the sonames in META-INF/lib/linux_64/.
From the log output below I'm guessing that the first dependency libifcoremt.so.5 is successfully extracted to the temporary dir but then something goes wrong. Is the temporary directory deleted too early?

content of META-INF/lib/linux_64/AUTOEXTRACT.LIST

linux_64/libifcoremt.so.5
linux_64/libifport.so.5
linux_64/libimf.so
linux_64/libintlc.so.5
[etc.]

initialization code

  static {    
    try {
      NativeLoader.extractRegistered();
      NativeLibraryUtil.loadNativeLibrary(MyLibJNI.class, "mylib");
    } catch (IOException e) {
      System.err.println("NativeLoader failed to load library. \n" + e);
      System.exit(1);
    }
  }

Log output

5028 [main] DEBUG org.scijava.nativelib.BaseJniExtractor - Extracting libraries registered in classloader sun.misc.Launcher$AppClassLoader@6d6f6e28
5030 [main] DEBUG org.scijava.nativelib.BaseJniExtractor - Extracting libraries listed in file:/home/me/src/trunk/native-intel-runtime/target/classes/META-INF/lib/linux_64/AUTOEXTRACT.LIST
5032 [main] DEBUG org.scijava.nativelib.BaseJniExtractor - Extracting 'file:/home/me/src/trunk/native-intel-runtime/target/classes/natives/linux_64/libifcoremt.so.5' to '/tmp/nativelib-loader_1434383826253268890/linux_64/libifcoremt.so.5'
NativeLoader failed to load library. 
java.io.FileNotFoundException: /tmp/nativelib-loader_1434383826253268890/linux_64/libifcoremt.so.5 (No such file or directory)
@cafhach cafhach changed the title extractRegistered is unable to successfully extract lib extractRegistered prompts java.io.FileNotFoundException for extracted dependency Feb 4, 2019
@ctrueden
Copy link
Member

Maybe it makes sense to step through in a debugger so that you can see which files are there when during the code's execution, and inspect those files using ldd etc. to make sure they are well-formed and functional from the temp folder?

Sorry I don't have more insight. If you figure it out and file a PR, I'll try to review / merge / release the fix ASAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants