Project

General

Profile

Actions

Backport #1261

closed

cross-compiling Ruby extensions using mkmf doesn't fully respect DESTDIR

Added by dangole (Daniel Golle) about 15 years ago. Updated almost 5 years ago.


Description

=begin
I'm having difficulties to cross-compile a ruby extension for a modified version OpenWRT... I couldn't get it working straight, but maybe I'm just getting something wrong...

mkmf doesn't find my Ruby headers because it looks for it only in Config::CONFIG["archdir"] which doesn't work in this case.
It is looking for /usr/lib/ruby/1.8/mips-linux/ruby.h which does not exist.
(actually /usr should not be accessed at all!)

See the rbconfig.rb of the target to understand why.
I changed line 136 in mkmf.rb to make it work:

  • if not $extmk and File.exist?(Config::CONFIG["archdir"] + "/ruby.h")
  • if not $extmk and File.exist?(Config::CONFIG["topdir"] + "/ruby.h")

But that was just a quick hack (because i got no idea what extmk is used for...). Somehow archdir in rbconfig is different from Config::CONFIG["archdir"] when read from mkmf...
Config::CONFIG["archdir"] in rbconfig.rb "../../../staging_dir/mips/usr/lib/ruby/1.8/mips-linux/"
Config::CONFIG["archdir"] in mkmf.rb "/usr/lib/ruby/1.8/mips-linux/"

strange...

../../../staging_dir/host/lib/ruby/1.8/x86_64-linux/ruby.h would be the host system's header
../../../staging_dir/mips/usr/lib/ruby/1.8/mips-linux/ruby.h is the correct location of the target system's header

extconf.rb get's called from inside a Makefile like this
DESTDIR=../../../staging_dir/mips/ ../../../staging_dir/host/bin/ruby -I ../../../staging_dir/mips/usr/lib/ruby/1.8/mips-linux/ extconf.rb

with my hack above the extensions get's build, but it seems that the linker paths are messed up :(
(it works if I LD_PRELOAD the shared libraries my extension is using)

maybe ENV["DESTDIR"] should be respected in mkmf.rb...?
=end


Files

rbconfig.rb (7.9 KB) rbconfig.rb Target rbconfig.rb dangole (Daniel Golle), 03/10/2009 11:25 PM
rbconfig.rb (7.11 KB) rbconfig.rb Host rbconfig.rb dangole (Daniel Golle), 03/10/2009 11:25 PM
Makefile (4.17 KB) Makefile dangole (Daniel Golle), 03/13/2009 02:59 AM
mkmf.log (28.9 KB) mkmf.log dangole (Daniel Golle), 03/13/2009 02:59 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0