I am getting this exception with FFI when using jruby-core jars but NOT
when using jruby-complete.jar:
org.jruby.exceptions.RaiseException: (LoadError) Could not load FFI
Provider: (NotImplementedError) FFI not available: Could not initialize
It seems that the libffi libraries are not included in any of the
jruby-core jars. The following is included in jruby-complete.jar but NOT
any of the jruby-core jars:
I am trying to figure how I could include these into my dependencies
alongside the jruby-core jars. Any ideas?
It depends on what dependency management you’re using.
If maven-ish (or anything that can use a maven repo, such as gradle,
ivy, etc), then add a dependency on com.github.jnr:jffi, something
Or, just download and add
to your classpath.
I am using the jruby-core 1.7.4 artifact as a dependency which depends
jffi 1.2.5 so jffi-1.2.5.jar is downloaded but not
I am using Ivy and currently stuck at trying to include
jffi-1.2.5-native.jar as an extra dependency.
Ahh, thats a fairly easy fix - since the binaries are packaged
separately to the main pom, you need an explicit dependency on the
Why that isn’t in jruby-core itself, or at least getting pulled in via
the jruby-core -> jnr-ffi dependency chain, I’m not too sure.
the jruby-core artifact should pull in exactly the same jars as
[INFO] - org.jruby:jruby-core:jar:1.7.4:compile
[INFO] ± org.jruby:jruby-stdlib:jar:1.7.4:compile
[INFO] ± org.jruby.joni:joni:jar:2.0.0:compile
[INFO] ± com.github.jnr:jnr-netdb:jar:1.1.2:compile
[INFO] ± com.github.jnr:jnr-enxio:jar:0.4:compile
[INFO] ± com.github.jnr:jnr-unixsocket:jar:0.3:compile
[INFO] ± com.github.jnr:jnr-posix:jar:2.5.2:compile
[INFO] ± org.jruby.extras:bytelist:jar:1.0.10:compile
[INFO] ± com.github.jnr:jnr-constants:jar:0.8.4:compile
[INFO] ± org.jruby.jcodings:jcodings:jar:1.0.10:compile
[INFO] ± com.github.jnr:jffi:jar:1.2.5:compile
[INFO] ± org.yaml:snakeyaml:jar:1.11:compile
[INFO] ± jline:jline:jar:2.7:compile
[INFO] ± joda-time:joda-time:jar:2.1:compile
[INFO] ± com.jcraft:jzlib:jar:1.1.2:compile
[INFO] ± com.headius:invokebinder:jar:1.2:compile
[INFO] - com.github.jnr:jnr-ffi:jar:1.0.4:compile
[INFO] ± com.github.jnr:jffi:jar:native:1.2.7:runtime
[INFO] - com.github.jnr:jnr-x86asm:jar:1.0.2:compile
with a pom with only jruby-core as depdenceny. this shows that
com.github.jnr:jffi:jar:native:1.2.7:runtime is pulled in by the
so I am still sure that jruby-core+transitive dependencies is
the same as jruby-complete. could it be that there is loading issue of
native lib - just guessing ?
ah-ah! classifier! thanks, I got it to include the native dependency and
for the record here’s my Ivy config:
and “classifier” is needed in the retrieve pattern, with something like:
ant.retrieve “pattern” =>
Hi I think that core jar dont include things thats not core … For a
with dependeces its better to use complete jar and then include
jars at classpath. I think that this includes could be posible even with
core but things will be more difficult… Because you must do again work
thats someone did to bundle complete jar container.
El 20/06/2013 20:03, “Colin Surprenant” [email protected]
I am not very good with both Ivy & Maven so this might just be caused by
weakness with these tools… A basic transitive dependency on jruby-core
with Ivy like this:
does not include jffi-native.
so looking at your dependency tree, jffi-native is in the maven
scope. I have tried without success to specify a runtime conf in Ivy to
include jffi-native. Again this might just be me not doing it right.
Manuel: jruby-complete can be useful but is not a good option when you
also dealing with other dependencies - with jruby-complete, it is not
possible to resolve conflicting jars etc.
it might very well be a Ivy thingy great that you found a solution.
maybe it is worth to declare com.github.jnr:jffi:jar:native:1.2.7 with
scope compile to keep the usage of jruby-core simple for Ivy users
On Fri, Jun 21, 2013 at 7:34 PM, Colin Surprenant <