Backport #1261
Updated by jeremyevans0 (Jeremy Evans) over 4 years ago
=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