SerCeMan / jnr-fuse

FUSE implementation in Java using Java Native Runtime (JNR)
MIT License
365 stars 87 forks source link

HelloFuse.java wont run with WinFSP 1.3.18160 #63

Closed jenschurchill closed 6 years ago

jenschurchill commented 6 years ago

Tried 0.5.2 and 0.5.2.1 with and without all classifier

Path is correctly detected to "C:\Program Files (x86)\WinFsp\bin\winfsp-x64.dll"

LibraryLoader.java fails at 325

        try {
            return loadLibrary(interfaceClass, Collections.unmodifiableList(libraryNames), getSearchPaths(),
                Collections.unmodifiableMap(optionMap));

        } catch (LinkageError error) {
            if (failImmediately) throw error;
            return createErrorProxy(error);

with exception

Exception in thread "main" java.lang.UnsatisfiedLinkError: unknown
    at jnr.ffi.provider.jffi.NativeLibrary.loadNativeLibraries(NativeLibrary.java:87)
    at jnr.ffi.provider.jffi.NativeLibrary.getNativeLibraries(NativeLibrary.java:70)
    at jnr.ffi.provider.jffi.NativeLibrary.getSymbolAddress(NativeLibrary.java:49)
    at jnr.ffi.provider.jffi.NativeLibrary.findSymbolAddress(NativeLibrary.java:59)
    at jnr.ffi.provider.jffi.AsmLibraryLoader.generateInterfaceImpl(AsmLibraryLoader.java:158)
    at jnr.ffi.provider.jffi.AsmLibraryLoader.loadLibrary(AsmLibraryLoader.java:89)
    at jnr.ffi.provider.jffi.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:44)
    at jnr.ffi.LibraryLoader.load(LibraryLoader.java:325)
    at jnr.ffi.LibraryLoader.load(LibraryLoader.java:304)
    at ru.serce.jnrfuse.AbstractFuseFS.<init>(AbstractFuseFS.java:66)
    at ru.serce.jnrfuse.FuseStubFS.<init>(FuseStubFS.java:23)
    at com.sitemule.db2fs.fuse.HelloFuse.<init>(HelloFuse.java:21)
    at com.sitemule.db2fs.fuse.HelloFuse.main(HelloFuse.java:83)

Note, examples in winfsp itself, run fine.

jenschurchill commented 6 years ago

Note, cloning the repo, and running MemoryFsTest results in the same error, I've now also tried updating winfsp to 1.4.18211 to no effect.

jenschurchill commented 6 years ago

Solved, the JRE was 32bit, and the dll detected, was 64bit.

Fixed by extending extractRegLibraryPath in WinPathUtils to account for os.arch

        String fileName = "winfsp-x64.dll";
        String osArch = System.getProperty("os.arch");
        if (osArch.equalsIgnoreCase("x86")) {
            fileName = "winfsp-x86.dll";
        }
        return libraryPath + "bin\\" + fileName;