[DRE-maint] Bug#982887: libruby2.7: separate rbconfig.rb for cross building

Helmut Grohne helmut at subdivi.de
Mon Feb 15 20:20:23 GMT 2021


Package: libruby2.7
Version: 2.7.2-4
User: debian-cross at lists.debian.org
Usertags: ftcbfs
Control: affects -1 + src:ruby-json

ruby-json (and many others) fail to cross build from source in the same
way. dh_ruby runs ruby ... extconf.rb, which configures for the build
architecture and then some dependency (usually ruby/config.h) goes
missing as it is only installed for the host architecture.

As far as I can tell, the root cause is the extconf.rb invocation. For
cross compiling, one should pass -I /somepath to ruby such that
/somepath contains the host's rbconfig.rb. Unfortunately, we cannot just
pass -I /usr/lib/<triplet>/ruby/2.7.0 here, because doing so results in
ruby attempting to load foreign extension modules. We need a different
path here.

Let me give a little excursion into other ecosystems to give you a
better idea what is needed here:

Perl has a file that is similar to rbconfig.rb and it is simply called
Config.pm. It normally resides in /usr/lib/x86_64-linux-gnu/perl-base.
Using this path would have the same issue. Therefore, there also is
/usr/lib/x86_64-linux-gnu/perl/5.32.1 containing a symlink.

Python has a similar file _sysconfigdata.py. Rather than disambiguating
the containing directory, Python renames it and arrives at things like
_sysconfigdata__x86_64-linux-gnu.py. Rather than specifying a directory
to to search for modules, a separate environment variable can specify
its location.

The Ruby way is like Perl. I suggest copying this approach. To that end,
I request that ruby2.7-dev adds a new, architecture-dependent directory
that contains a symlink to the matching rbconfig.rb. Then dh_ruby can
pass that directory via -I and things should work.

Does that sound good to you? Do you have any preference on the naming?

No, this is not meant for bullseye.

Helmut



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