FFI on Turkish Windows

I’m getting a problem loading the FFI library on Turkish Windows 2008
(x64 w/ x32 java) and wondered if anybody else has run into this before.
It looks like it is using the turkish “i” without a dot in place of the
standard “i” in the architecture string. So I get an error like this:

irb(main):001:0> require ‘ffi’
LoadError: Unsupported platform: ı386-unknown
from org/jruby/RubyKernel.java:1033:in require' from c:/jruby-1.6.7.2/lib/ruby/site_ruby/shared/ffi/ffi.rb:69:in(root)’
from org/jruby/RubyKernel.java:1033:in require' from c:/jruby-1.6.7.2/lib/ruby/site_ruby/shared/ffi/ffi.rb:1:in(root)’
from org/jruby/RubyKernel.java:1033:in require' from c:/jruby-1.6.7.2/lib/ruby/site_ruby/shared/ffi.rb:1:inevaluate’
from org/jruby/RubyKernel.java:1083:in eval' from c:/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:158:ineval_input’
from c:/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:271:in signal_status' from c:/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:155:ineval_input’
from org/jruby/RubyKernel.java:1410:in loop' from org/jruby/RubyKernel.java:1183:incatch’
from c:/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:154:in eval_input' from c:/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:71:instart’
from org/jruby/RubyKernel.java:1183:in catch' from c:/jruby-1.6.7.2/lib/ruby/1.8/irb.rb:70:instart’
from c:\jruby-1.6.7.2\bin\jirb:13:in `(root)’

This happens when I straight up require “ffi-internal.so” as well.
Unfortunately, I cannot seem to find this file anywhere on my system and
can’t figure out what code this is running to figure out what the
problem is.

Any suggestions?


Matt H.

This is just guessing, but what is the text on line 69 of
c:/jruby-1.6.7.2/lib/ruby/site_ruby/shared/ffi/ffi.rb ?

Thanks,

Andrew

On 1 August 2012 14:54, Matt H. [email protected] wrote:

This happens when I straight up require “ffi-internal.so” as well.
Unfortunately, I cannot seem to find this file anywhere on my system and
can’t figure out what code this is running to figure out what the problem
is.

The code is in org/jruby/ext/ffi/Platform.java - look for
determineCPU() and determineOS().

Those methods try to infer the cpu and os from the os.name and os.arch
java properties, and if they don’t match any supported combination,
then it won’t load FFI.

So, start by checking what os.name and os.arch print out. It may be
that we have to do charset conversion on those properties before
comparing them. Or hardcode the turkish variants in there.

Matt, can you test jruby-master?

I did a few changes to FFI and the underlying jffi library to always
use Locale.ENGLISH when doing case conversions.

Thanks for the pointer Wayne, it looks like that’s where the issue is,
depending on toLowerCase() which is returning the turkish “i”. Filed a
bug: http://jira.codehaus.org/browse/JRUBY-6808


Matt H.

Almost there. It’s struggling with the “i” in windows now. This is what
I’m seeing:

C:\Users\Administrator\jruby>bin\jirb
A­u 03, 2012 2:28:01 AM jnr.ffi.provider.jffi.NativeRuntime
buildNativeTypeAliases
SEVERE: failed to load type aliases: java.lang.ClassNotFoundException:
jnr/ffi/provider/jffi/platform/x86_64/w²ndows/TypeAliases
irb(main):001:0> require ‘ffi’
NameError: uninitialized constant FFI::Type::VOID
from org/jruby/RubyModule.java:2688:in const_missing' from C:/Users/Administrator/jruby/lib/ruby/shared/ffi/types.rb:59:inFF
I’
from
C:/Users/Administrator/jruby/lib/ruby/shared/ffi/types.rb:30:in (r oot)' from org/jruby/RubyKernel.java:1021:inrequire’
from
C:/Users/Administrator/jruby/lib/ruby/shared/rubygems/custom_requir
e.rb:1:in (root)' from C:/Users/Administrator/jruby/lib/ruby/shared/rubygems/custom_requir e.rb:36:inrequire’
from org/jruby/RubyKernel.java:1021:in require' from C:/Users/Administrator/jruby/lib/ruby/shared/ffi/ffi.rb:71:in(roo
t)’
from
C:/Users/Administrator/jruby/lib/ruby/shared/rubygems/custom_requir
e.rb:1:in (root)' from org/jruby/RubyKernel.java:1021:inrequire’
from
C:/Users/Administrator/jruby/lib/ruby/shared/rubygems/custom_requir
e.rb:36:in require' from C:/Users/Administrator/jruby/lib/ruby/shared/ffi.rb:1:in(root)’
from org/jruby/RubyKernel.java:1067:in eval' from C:/Users/Administrator/jruby/lib/ruby/shared/rubygems/custom_requir e.rb:1:in(root)’
from
C:/Users/Administrator/jruby/lib/ruby/shared/rubygems/custom_requir
e.rb:36:in require' from (irb):1:inevaluate’
from org/jruby/RubyKernel.java:1392:in loop' from org/jruby/RubyKernel.java:1175:incatch’
from org/jruby/RubyKernel.java:1175:in catch' from C:\Users\Administrator\jruby\bin\jirb:13:in(root)’

Should we continue this conversation on the bug for the sake of keeping
it on record?

I’m not sure if this is a good time or not, but it would probably be a
good idea to make this change extensively throughout jruby to stop these
bugs from popping up in other places as well?


Matt H.