[DRE-maint] Bug#982887: #982887: cross building Ruby extensions

Antonio Terceiro terceiro at debian.org
Thu Jul 21 22:48:29 BST 2022


Hi,

After a long time, I was able to finish a first version of this. The
solution has two parts:

1) Per Ruby version, per architecture rbconfig.rb provided by
ruby-all-dev:

$ dpkg -L ruby-all-dev:amd64 ruby-all-dev:arm64 | grep rbconfig
/usr/lib/x86_64-linux-gnu/ruby-crossbuild/3.0.0/rbconfig.rb
/usr/lib/aarch64-linux-gnu/ruby-crossbuild/3.0.0/rbconfig.rb

Packages that use Ruby by hand should add the corresponding directory to
the Ruby load path when calling ruby, like this (examples from an amd64
system):

$ ruby -e 'puts RbConfig::CONFIG["rubyarchhdrdir"]'
/usr/include/x86_64-linux-gnu/ruby-3.0.0
$ ruby -I/usr/lib/aarch64-linux-gnu/ruby-crossbuild/3.0.0 -e 'puts RbConfig::CONFIG["rubyarchhdrdir"]'
/usr/include/aarch64-linux-gnu/ruby-3.0.0

This will cause the rbconfig.rb of the desired host architecture to have
precedence over the native one, and things should generally work.

2) For standard Ruby packages, gem2deb 2.0 (about to be uploaded) should
handle the cross building itself automatically out of the box.

Most build dependencies in Ruby packages are used to run the tests, but
anotating them with <!nocheck> <!nodoc> is still needed in other to
optimize bootstrapping.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/pkg-ruby-extras-maintainers/attachments/20220721/f9ec19c7/attachment.sig>


More information about the Pkg-ruby-extras-maintainers mailing list