Skip to content
This repository

FAQ 

luislavena edited this page · 6 revisions
Clone this wiki locally

Why would I want to do a fat binary?

A: Because on windows, if there exists a ruby-prof-0.8.1-x86-mingw32 with binaries for 1.8.6, and someone on 1.9 does a “gem install ruby-prof”, they will actually receive the 1.8.6 binaries, which will err.

How do I target multiple versions?

Here’s an example

  Rake::ExtensionTask.new('ruby_prof', default_spec) do |ext|
    ext.cross_compile = true
    ext.cross_platform = ['x86-mswin32', 'x86-mingw32'] # these are the two major windows versions 
  end

Either you can use i386 or x86 to identify architecture. RubyGems will automatically convert it to the later.

Another option would be x86-mswin32-60 if you want to target only msvcrt.dll v 6.0 (the standard). By default mingw cross compile builds link against msvcrt.dll v 6.0. You can mix and match though it’s a bit dangerous (ask on the mailing list).

How do you choose the “right” version of .so files for fat binaries.

Unfortunately with fat binaries typically you can have three locations where the .so file ends up. In ext/xxx/xxx.so (for source builds), and in lib/1.x/xxx.so for binary builds

ffi for example handles this by requiring all 3 and including ext as a require path

Some ruby versions don’t cross compile

Nope they don’t. Here’s a list of some that for sure do though other patch revisions might too. In general try compiling (the compile phase) with the first ruby in your path being the same version as that you are trying to cross compile.

How to specify ‘RUBY_CC_VERSION1.8.6:1.9.1’ programmatically

drop

ENV[‘RUBY_CC_VERSION’] = ‘1.8.6:1.9.1’
into your Rakefile before your require the extensiontask.
Something went wrong with that request. Please try again.