On Wed, Jul 21, 2010 at 3:44 PM, Nobuyoshi Nakada <nobu / ruby-lang.org> wrot=
e:
> Hi,
>
> At Wed, 21 Jul 2010 20:16:58 +0900,
> Luis Lavena wrote in [ruby-core:31401]:
>> The problem seems to be cross compilation, where the def file is not
>> created and the shared libraries generated do not export the needed
>> symbols.
>
> How do you cross-compile extension libraries?
>

Ruby installed using rake-compiler:

# using 1.9.2-rc2

gem install rake-compiler
rake-compiler cross-ruby VERSION=3D1.9.2-rc2

[ruby-1.9.2-rc2] luis@ubuntu86:~/testext$ ruby
-I/home/luis/.rake-compiler/builds/ruby-1.9.2-rc2
-ri386-mingw32-fake.rb -rmkmf extconf.rb
creating Makefile

[ruby-1.9.2-rc2] luis@ubuntu86:~/testext$ make
ruby -e "puts 'EXPORTS', 'Init_testext'"  > testext-i386-mingw32.def
i586-mingw32msvc-gcc -I.
-I/home/luis/.rake-compiler/builds/ruby-1.9.2-rc2/.ext/include/i386-mingw32
-I/home/luis/.rake-compiler/sources/ruby-1.9.2-rc2/include/ruby/backward
-I/home/luis/.rake-compiler/sources/ruby-1.9.2-rc2/include -I.   -O3
-g -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith
-Wwrite-strings -Wno-missing-field-initializers -Wno-long-long  -o
testext.o -c testext.c
i586-mingw32msvc-gcc -shared -s -o testext.so testext.o -L.
-L/home/luis/.rake-compiler/builds/ruby-1.9.2-rc2 -L.
-Wl,--enable-auto-image-base,--enable-auto-import
testext-i386-mingw32.def  -lmsvcrt-ruby191  -lshell32 -lws2_32

Seems it generates the export file...

$ cat testext-i386-mingw32.def
EXPORTS
Init_testext

OT: since which version "#{RUBY_PLATFORM}-fake.rb" is generated? I
remember only "fake" was generated before, I will need to adjust
rake-compiler to properly copy it after installation, as right now is
faking it:

http://github.com/luislavena/rake-compiler/blob/master/lib/rake/extensionta=
sk.rb#L364-373

>
> Nokogiri is bad for cross-compile example. =A0It's quite tricky.
>

Indeed, but the normal usage cases for cross-compilation are gem
developers wanting to provide native gems for projects like nokogiri,
sqlite3-ruby, DataMapper, etc.

Thank you for your time.
--=20
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exup=E9ry