Subject: [ruby-ffi] Re: Possible issues with Ruby FFI on ARM processor (Raspberry PI) |
From: Wayne Meissner |
Date: 2/27/13 4:46 PM |
To: ruby-ffi@googlegroups.com |
On Monday, February 25, 2013 10:49:54 PM UTC+1, Wayne Meissner wrote:Off the top of my head, a couple of issues could be:1) data sizes/layout. Verify that the sizes of all your FFI structs match the C ones, and that the sizes & offsets of members match.That’s a good idea. I tried it, and they do match (was kind of hoping they didn’t — updated the gist with the offset-checking code).2) Given it only crashes on exit, it could be some sort of GC/finalizer interaction. Set all the MemoryPointer instances, including the ones backing the structs to autorelease=false - this causes FFI to disown the memory, so it won't try to free it.Hm, I’ve updated the gist with these changes. Unfortunately the crashes still occur. I know how vague crash messages can be, but in case it might ring any bells: `*** glibc detected *** ruby: free(): invalid next size (fast): 0x01a3acf0 ***`3) Endian-ness issues in ruby-ffi itself. Is that arm arch big-endian or little-endian?From what I could gather from googling is that it’s primarily little-endian. By primarily is that it apparently has some big-endian support if you do a little bit of hoop-jumping.Thanks for your time Wayne, I appreciate it.