Shoes, extconf.rb, mkmf.rb and binject

[UPDATED: March 19, 2014 and March 20]
There’s only a few people in the world that cross compile Ruby as an embedded (dependent lib) for their larger app like Shoes. For a damn good reason – it’s a lot harder than it should be. One reason is extconf.rb tied up with RbConfig::CONFIG in mysterious ways. It requires magic and no one talks about it once they know the secret words. It’s not for malice or laziness – it’s just once you understand it enough to work for you, you move on to fun things.

That’s what I did when I got Shoes (Ruby) extensions ftsearch and chipmunk compiled and cross compiled. I’m tempted to move on myself but there might be another person struggling that needs a hint. extconf.rb and mkmf.rb are dependent on RbConfig::CONFIG vars for building the tests like have_library("z")
and the settings in RbConfig::MAKEFILE_CONFIG are used to create the Makefile that will build/cross compile the extension. Two different things. [Update Mar 18, 2014]. RbConfig::MAKEFILE_CONFIG is mostly in control of what mkmf does. You probably want them to be the same but in a cross compile situation you want them (both) to be something different from the Ruby that is running the extconf.rb. Magic?

For Shoes purposes, binject cross compiles for raspberry pi (arm) x86_64 and i686 builds. Mingw cross compile requires slightly more fun and magic but I’m sure it can be done. [March 20, 2014] Got it. MinGW
version cross compiles binject.

LET ME BE CLEAR: binject and packaging don’t work in 3.2 any better than it does in 3.1 (i.e. not at all) and its useless for most folks until the Windows version of Shoes is working and that may never happen.

Leave a Reply

Your email address will not be published. Required fields are marked *