[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: libruby2.7: separate rbconfig.rb for cross building



Hi Antonio / Ruby Team,

You had a patch ready for this here[1] (before bullseye) or somewhere else, right?
If possible could you make an upload?
This would help ruby ext cross build, which would be pretty cool.


[1]: https://salsa.debian.org/ruby-team/ruby-defaults/-/tree/crossbuild

On Mon, 15 Feb 2021 21:20:23 +0100 Helmut Grohne <helmut@subdivi.de> wrote:
> Package: libruby2.7
> Version: 2.7.2-4
> User: debian-cross@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
> 
> 
> 

-- 
Best,
Nilesh

Attachment: signature.asc
Description: PGP signature


Reply to: