SerCeMan / jnr-fuse

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

UnsatisfiedLinkError when running MemoryFS on Windows with jnr-fuse 0.5.2 #60

Closed gdiet closed 6 years ago

gdiet commented 6 years ago

When I run ru.serce.jnrfuse.examples.MemoryFS on Windows (with WinFSP 1.3, in IDEA, in an SBT project with libraryDependencies += "com.github.serceman" % "jnr-fuse" % "0.5.1"), everything works fine.

When I update the dependency to 0.5.2, running MemoryFS results in an "java.lang.UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider".

I have tracked the problem down to the following thing: jffi-1.2.15-native.jar is automatically imported as dependency of jnr-fuse 0.5.1, but with jnr-fuse 0.5.2, no jffi-xxx-native.jar is imported as dependency.

I get jffi-1.2.17.jar in the depencencies, but not the native library. Any ideas?

SerCeMan commented 6 years ago

Hey, @gdiet!

Is it possible that 0.5.2 conflicts with some other dependencies in your project? Could you try the fat jar build? (classifier all )

gdiet commented 6 years ago

Hi Sergey @SerCeMan,

when adding the "all" classifier, everything works fine. It's unexpected that you need to add the classifier, so it would be good if either this is documented or solved in one of the next versions. For my project, all is fine now, thanks! So if you think this issue should be closed directly, go ahead :)

By the way: I have no conflicting dependencies. This is my basic SBT project definition:

version in ThisBuild := "0.6-SNAPSHOT"
scalaVersion in ThisBuild := "2.12.6"
scalacOptions in ThisBuild ++= Seq(
  "-deprecation",
  "-feature",
  "-unchecked"
)

fork in run in ThisBuild := true

resolvers += "bintray" at "http://jcenter.bintray.com"
libraryDependencies += "com.github.serceman" % "jnr-fuse" % "0.5.2" // classifier "all"

Regards Georg

SerCeMan commented 6 years ago

It's unexpected that you need to add the classifier, so it would be good if either this is documented or solved in one of the next versions.

The classifier is not normally needed, when all is used - jnr-fuse doesn't bring any dependencies with it, everything is bundled inside the jar, which signals that there is a conflict with one of the transitive dependencies. Could you try to inspect your transitive dependencies for the presence of any of the JNR libraries using one of the way described in this question? https://stackoverflow.com/questions/25519926/how-see-dependency-tree-in-sbt

SerCeMan commented 6 years ago

Hey, @gdiet! The only suspicious thing that I found is the fact that jnr-ffi specifies jffi as a dependency twice with different versions which sbt can handle differently to gradle and maven. I raised a PR to fix this, https://github.com/jnr/jnr-ffi/pull/169.

Could you please print your jnr-related dependency tree to see which version of jffi is chosen?

gdiet commented 6 years ago

Hi Sergey, here we go:

output of "dependencyTree" with "com.github.serceman" % "jnr-fuse" % "0.5.2" - with or without classifier "all":

[info]   +-com.github.serceman:jnr-fuse:0.5.2
[info]     +-com.github.jnr:jnr-constants:0.9.9
[info]     +-com.github.jnr:jnr-ffi:2.1.8
[info]     | +-com.github.jnr:jffi:1.2.16 (evicted by: 1.2.17)
[info]     | +-com.github.jnr:jffi:1.2.17
[info]     | +-com.github.jnr:jnr-x86asm:1.0.2
[info]     | +-org.ow2.asm:asm-analysis:5.0.3
[info]     | | +-org.ow2.asm:asm-tree:5.0.3
[info]     | |   +-org.ow2.asm:asm:5.0.3
[info]     | |
[info]     | +-org.ow2.asm:asm-commons:5.0.3
[info]     | | +-org.ow2.asm:asm-tree:5.0.3
[info]     | |   +-org.ow2.asm:asm:5.0.3
[info]     | |
[info]     | +-org.ow2.asm:asm-tree:5.0.3
[info]     | | +-org.ow2.asm:asm:5.0.3
[info]     | |
[info]     | +-org.ow2.asm:asm-util:5.0.3
[info]     | | +-org.ow2.asm:asm-tree:5.0.3
[info]     | |   +-org.ow2.asm:asm:5.0.3
[info]     | |
[info]     | +-org.ow2.asm:asm:5.0.3
[info]     |
[info]     +-com.github.jnr:jnr-posix:3.0.46
[info]       +-com.github.jnr:jnr-constants:0.9.9
[info]       +-com.github.jnr:jnr-ffi:2.1.8
[info]         +-com.github.jnr:jffi:1.2.16 (evicted by: 1.2.17)
[info]         +-com.github.jnr:jffi:1.2.17
[info]         +-com.github.jnr:jnr-x86asm:1.0.2
[info]         +-org.ow2.asm:asm-analysis:5.0.3
[info]         | +-org.ow2.asm:asm-tree:5.0.3
[info]         |   +-org.ow2.asm:asm:5.0.3
[info]         |
[info]         +-org.ow2.asm:asm-commons:5.0.3
[info]         | +-org.ow2.asm:asm-tree:5.0.3
[info]         |   +-org.ow2.asm:asm:5.0.3
[info]         |
[info]         +-org.ow2.asm:asm-tree:5.0.3
[info]         | +-org.ow2.asm:asm:5.0.3
[info]         |
[info]         +-org.ow2.asm:asm-util:5.0.3
[info]         | +-org.ow2.asm:asm-tree:5.0.3
[info]         |   +-org.ow2.asm:asm:5.0.3
[info]         |
[info]         +-org.ow2.asm:asm:5.0.3

Dependency tree with "com.github.serceman" % "jnr-fuse" % "0.5.1"


[warn]  * com.github.jnr:jnr-constants:0.9.9 is selected over 0.9.8
[warn]      +- com.github.serceman:jnr-fuse:0.5.1                 (depends on 0.9.9)
[warn]      +- com.github.jnr:jnr-posix:3.0.41                    (depends on 0.9.8)
[warn] Run 'evicted' to see detailed eviction warnings
[info] default:backup_2.12:0.6-SNAPSHOT [S]
[info]   +-com.github.serceman:jnr-fuse:0.5.1
[info]     +-com.github.jnr:jnr-constants:0.9.9
[info]     +-com.github.jnr:jnr-ffi:2.1.5
[info]     | +-com.github.jnr:jffi:1.2.15
[info]     | +-com.github.jnr:jnr-x86asm:1.0.2
[info]     | +-org.ow2.asm:asm-analysis:5.0.3
[info]     | | +-org.ow2.asm:asm-tree:5.0.3
[info]     | |   +-org.ow2.asm:asm:5.0.3
[info]     | |
[info]     | +-org.ow2.asm:asm-commons:5.0.3
[info]     | | +-org.ow2.asm:asm-tree:5.0.3
[info]     | |   +-org.ow2.asm:asm:5.0.3
[info]     | |
[info]     | +-org.ow2.asm:asm-tree:5.0.3
[info]     | | +-org.ow2.asm:asm:5.0.3
[info]     | |
[info]     | +-org.ow2.asm:asm-util:5.0.3
[info]     | | +-org.ow2.asm:asm-tree:5.0.3
[info]     | |   +-org.ow2.asm:asm:5.0.3
[info]     | |
[info]     | +-org.ow2.asm:asm:5.0.3
[info]     |
[info]     +-com.github.jnr:jnr-posix:3.0.41
[info]       +-com.github.jnr:jnr-constants:0.9.8 (evicted by: 0.9.9)
[info]       +-com.github.jnr:jnr-constants:0.9.9
[info]       +-com.github.jnr:jnr-ffi:2.1.4 (evicted by: 2.1.5)
[info]       +-com.github.jnr:jnr-ffi:2.1.5
[info]         +-com.github.jnr:jffi:1.2.15
[info]         +-com.github.jnr:jnr-x86asm:1.0.2
[info]         +-org.ow2.asm:asm-analysis:5.0.3
[info]         | +-org.ow2.asm:asm-tree:5.0.3
[info]         |   +-org.ow2.asm:asm:5.0.3
[info]         |
[info]         +-org.ow2.asm:asm-commons:5.0.3
[info]         | +-org.ow2.asm:asm-tree:5.0.3
[info]         |   +-org.ow2.asm:asm:5.0.3
[info]         |
[info]         +-org.ow2.asm:asm-tree:5.0.3
[info]         | +-org.ow2.asm:asm:5.0.3
[info]         |
[info]         +-org.ow2.asm:asm-util:5.0.3
[info]         | +-org.ow2.asm:asm-tree:5.0.3
[info]         |   +-org.ow2.asm:asm:5.0.3
[info]         |
[info]         +-org.ow2.asm:asm:5.0.3```

Hope this helps :)
gdiet commented 6 years ago

Hi Sergey @SerCeMan, another update on the issue with some observations:

1) When I set up a Maven project in IDEA with the 0.5.2 dependency, I don't have to add the "all" classifier to run MemoryFS.

BUT... 2) Both in SBT and in Maven, when I run the MemoryFS with version 0.5.2, I don't see any files in the mounted drive, and I can't write and so on. With version 0.5.1, I see folders and files and I'm able to create new files and so on.

So, at least when used on Windows with winfsp, 0.5.2 currently seems unusable. Do you need anything else from me to hunt down the issue?


oh, by the way - from the SBT console, I can't start MemoryFS at all (using runMain ru.serce.jnrfuse.examples.MemoryFS). That seems to be a totally unrelated issue however, nothing to be investigated in this context.

SerCeMan commented 6 years ago

@gdiet, Can you confirm that if you add jffi 1.2.17 native to your project as a dependency everything starts working fine? If yes, I'll create a workaround for this in jnr-fuse and will wait for https://github.com/jnr/jnr-ffi/pull/169 to be merged.

gdiet commented 6 years ago

@SerCeMan sorry: In the SBT project, when I combine libraryDependencies += "com.github.serceman" % "jnr-fuse" % "0.5.2" and libraryDependencies += "com.github.jnr" % "jffi" % "1.2.17" classifier "native", I still can't start MemoryFS from IntelliJ IDEA, it's still the UnsatisfiedLinkError: could not load FFI provider jnr.ffi.provider.jffi.Provider.

Currently, I'm getting started with writing maven projects, so I can try the same thing with maven, but I did not get to the point that I have meaningful results. Running "mvn package" with the pom below gives me Failure to find com.github.jnr:jnr-ffi:jar:native:1.2.17, no matter how I try to add jffi 1.2.17 native...

  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>net.diet_rich</groupId>
  <artifactId>jnr-tryout</artifactId>
  <version>1.0-SNAPSHOT</version>
  <name>jnr-tryout</name>

  <repositories>
    <repository>
      <id>central</id>
      <name>bintray</name>
      <url>http://jcenter.bintray.com</url>
    </repository>
  </repositories>

  <dependencies>
    <dependency>
      <groupId>com.github.serceman</groupId>
      <artifactId>jnr-fuse</artifactId>
      <version>0.5.2</version>
      <classifier>all</classifier>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>3.1.0</version>
        <configuration>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
SerCeMan commented 6 years ago

Hey, @gdiet! I released 0.5.2.1. Could you please verify that this problem doesn't in 0.5.2.1?

gdiet commented 6 years ago

Hey Sergey @SerCeMan - thanks, great, with 0.5.2.1 it works like a charm.