FFI understands :size_t
when running rails through jRuby, but not after using Warbler to create a .war file and running that using java -jar my_project.war
or Tomcat.
Linux | Windows
-----------------------------+-------------
java -jar works | doesn't work
tomcat works | doesn't work
rails s (using jruby) works | works
Linux and Windows use the same war file in the comparison.
Here is the top of a backtrace from running java -jar
on Windows. (I've edited the beginnings of the file paths in the backtrace).
--- Backtrace
TypeError: unable to resolve type 'size_t'
find_type at jar:file:/my_project.war/WEB-INF/lib/jruby-stdlib-1.7.2.jar!/META-INF/jruby.home/lib/ruby/shared/ffi/types.rb:55
type_size at jar:file:/my_project.war/WEB-INF/lib/jruby-stdlib-1.7.2.jar!/META-INF/jruby.home/lib/ruby/shared/ffi/types.rb:147
SQLAnywhere at my_project.war/WEB-INF/gems/gems/sqlanywhere-ffi-1.0.1/lib/sqlanywhere.rb:13
(root) at my_project.war/WEB-INF/gems/gems/sqlanywhere-ffi-1.0.1/lib/sqlanywhere.rb:5
require at org/jruby/RubyKernel.java:1027
When I look at the files in the backtrace, they list various c types, but not size_t
.
It seems to me that there are 2 FFIs available to jRuby.
- The normal FFI gem.
- The jruby-stdlib ffi.
The big difference between the 2, seems to be that only the former understands :size_t
.
My question is: Are there 2 different FFIs? If so: how do I make sure that my gem loads the correct ffi? If not: what am I doing wrong?
PS: I'm the author of the sqlanywhere-ffi gem, so if the problem is I'm depending on the wrong thing, I can change it. Currently it has ffi as a depenendency in the gemspec, the gemfile and it requires 'ffi'
in the main entry point.