From: Brian Takita Date: 2006-10-19T14:43:14+09:00 Subject: Re: Cross Compiling Ruby Extension ------=_Part_89483_15153680.1161236590909 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 10/18/06, Brian Takita wrote: > > On 10/18/06, Mauricio Fernandez wrote: > > > > On Wed, Oct 18, 2006 at 04:58:53PM +0900, Brian Takita wrote: > > > Hello, > > > > > > I'm attempting to cross compile a ruby extension for Windows from a > > Linux > > > box. > > > Im running Ubuntu 6.06, Ruby 1.8.5 , and mingw gcc 3.4.4. > > > > > > I attempted to follow Mauricio Fernandez's instructions > > > http://eigenclass.org/hiki.rb?cross+compiling+rcovrt#f01 > > > > > > The file compiled but it appears that it is still a Linux binary. > > > json_ext.so: ELF 32-bit LSB shared object, Intel 80386, version 1 > > (SYSV), > > > not stripped > > > > You are using mkrf instead of mkmf, so things work a bit differently. > > > > $ cat extconf.rb > > require 'rubygems' > > require 'mkrf' > > > > dir = File.dirname(__FILE__) > > Mkrf::Generator.new('json_ext', "#{dir}/*.c") > > $ cat > extconf.rb > > require 'mkmf' > > create_makefile "json_ext" > > $ ruby -I ~/usr/ruby-mingw32/lib/ruby/1.8/i386-mingw32 extconf.rb > > /home/batsman/ruby-mingw32/lib/ruby/1.8/i386-mingw32/rbconfig.rb:7: ruby > > lib version (1.8.4) doesn't match executable version (1.8.5) > > (RuntimeError) > > from /home/batsman/usr//lib/ruby/1.8/mkmf.rb:4:in `require' > > from /home/batsman/usr//lib/ruby/1.8/mkmf.rb:4 > > from extconf.rb:1:in `require' > > from extconf.rb:1 > > > > [use vim to edit rbconfig.rb and remove/comment the version check if the > > native & cross-compiled ruby version differ] > > > > $ ruby -I ~/ruby-mingw32/lib/ruby/1.8/i386-mingw32/ extconf.rb > > creating Makefile > > $ make > > i586-mingw32msvc-gcc -I. > > -I/home/batsman/ruby-mingw32/lib/ruby/1.8/i386-mingw32 > > -I/home/batsman/ruby-mingw32/lib/ruby/1.8/i386-mingw32 -I. -g -O2 -c > > json_ext.c > > i586-mingw32msvc-gcc -shared -s > > -Wl,--enable-auto-import,--export-all -L"/home/batsman/ruby-mingw32/lib" -o > > json_ext.so json_ext.o -lmsvcrt-ruby18 -lwsock32 > > $ file json_ext.so > > json_ext.so: MS Windows PE 32-bit Intel 80386 console DLL > > > Thanks for demoing this. I'll give it a shot. > It looks like the compile worked. I did not run make install on mingw. There where a couple of issues with the install task, such as rubyw.exemissing and the .ext directory missing. To resolve this I copied ruby.exe to rubyw.exe and the ext directory to .ext Thank you, Brian -- > > Mauricio Fernandez - http://eigenclass.org - singular Ruby > > > > > ------=_Part_89483_15153680.1161236590909--