compiling ruby under windows (+ gtk stuff, is the gtk list dead?)

G

Gergely Kontra

Hi!

I tried to compile ruby under windows with mingw:
mingw 3.1.0
msys 1.0.11-20040430

My iconv.h:
#define _LIBICONV_VERSION 0x0109 /* version number: (major<<8) +
minor */

The error message:
make[1]: Entering directory `/f/tmp/ruby-1.9/ext/iconv'
gcc -shared -s -Wl,--enable-auto-import,--export-all -L'../..'
-L'c:/programs/ruby19/lib' -o ../../.ext/i386-mingw32/iconv.so iconv.o
-lmsvcrt-ruby19 -lwsock32
iconv.o(.text+0xf7):iconv.c: undefined reference to
`_imp__libiconv_open'
iconv.o(.text+0x133):iconv.c: undefined reference to
`_imp__libiconv_open'
iconv.o(.text+0x1e9):iconv.c: undefined reference to
`_imp__libiconv_close'
iconv.o(.text+0x21e):iconv.c: undefined reference to
`_imp__libiconv_close'
iconv.o(.text+0x30d):iconv.c: undefined reference to `_imp__libiconv'
make[1]: *** [../../.ext/i386-mingw32/iconv.so] Error 1
make[1]: Leaving directory `/f/tmp/ruby-1.9/ext/iconv'
make: *** [all] Error 1

After deleting the iconv library :)
C:\programs\ruby19\bin>ruby -v
ruby 1.9.0 (2004-06-04) [i386-mingw32]

The same with ruby 1.8.2
make[1]: Entering directory `/f/tmp/ruby-1.8/ext/iconv'
gcc -O2 -I. -If:/tmp/ruby-1.8 -If:/tmp/ruby-1.8
-If:/tmp/ruby-1.8/ext/iconv -DHAVE_ICONV_H -DICONV_INPTR_CAST="" -c
iconv.c
gcc -shared -s -Wl,--enable-auto-import,--export-all
-L'f:/tmp/ruby-1.8' -L'/programs/ruby181/lib' -o iconv.so iconv.o
-lmsvcrt-ruby18 -lwsock32
iconv.o(.text+0xe7):iconv.c: undefined reference to
`_imp__libiconv_open'
iconv.o(.text+0x123):iconv.c: undefined reference to
`_imp__libiconv_open'
iconv.o(.text+0x1a9):iconv.c: undefined reference to
`_imp__libiconv_close'
iconv.o(.text+0x1de):iconv.c: undefined reference to
`_imp__libiconv_close'
iconv.o(.text+0x2bd):iconv.c: undefined reference to `_imp__libiconv'
make[1]: *** [iconv.so] Error 1
make[1]: Leaving directory `/f/tmp/ruby-1.8/ext/iconv'
make: *** [all] Error 1

And, libraries go to msys
Compilation starts with:

/configure --prefix=c:/programs/ruby18 && make && make install

I end up with some libs in
c:/programs/msys1.0.11-20040430/programs/ruby18/lib

kgergely@LIGHTSPEED
/c/programs/msys/1.0.11-20040430/programs/ruby18/lib/ruby/1.8
$ ls
bigdecimal remote-tk.rb tkcanvas.rb tkmacpkg.rb tkvirtevent.rb
dl sha1.rb tkclass.rb tkmenubar.rb tkwinpkg.rb
i386-mingw32 tk tkconsole.rb tkmngfocus.rb
kconv.rb tk.rb tkdialog.rb tkpalette.rb
md5.rb tkafter.rb tkentry.rb tkscrollbox.rb
multi-tk.rb tkbgerror.rb tkfont.rb tktext.rb


------------------
gtk2 stuff:

kgergely@LIGHTSPEED /c/tmp/ruby-gtk2-0.9.1
$ ruby extconf.rb
extconf.rb: Entering directory `glib'
extconf.rb:50:in `system': No such file or directory -
c:\programs\ruby19\bin\ruby (Errno::ENOENT)
from extconf.rb:50
from extconf.rb:42:in `each'
from extconf.rb:42

when compiling parts manually:

kgergely@LIGHTSPEED /c/tmp/ruby-gtk2-0.9.1/atk
$ make
make[1]: Entering directory `/c/tmp/ruby-gtk2-0.9.1/atk/src'
make[1]: *** No rule to make target `ruby.h', needed by `rbatk.o'.
Stop.
make[1]: Leaving directory `/c/tmp/ruby-gtk2-0.9.1/atk/src'
make: *** [all] Error 2

kgergely@LIGHTSPEED /c/tmp/ruby-gtk2-0.9.1/atk
$ make
make[1]: Entering directory `/c/tmp/ruby-gtk2-0.9.1/atk/src'
make[1]: *** No rule to make target `defines.h', needed by `rbatk.o'.
Stop.
make[1]: Leaving directory `/c/tmp/ruby-gtk2-0.9.1/atk/src'
make: *** [all] Error 2


kgergely@LIGHTSPEED /f/tmp/ruby-gtk2-0.9.1/gdkpixbuf
$ ruby extconf.rb
checking for GCC... yes
checking for rb_define_alloc_func()... no
checking for rb_block_proc()... no
checking for new allocation framework... yes
checking for attribute assignment... yes
checking for gdk-pixbuf-2.0... yes
checking for G_PLATFORM_WIN32... yes
checking for G_OS_WIN32... yes
checking for g_print()... no

Gergõ
 
J

Jeff Mitchell

--- Gergely Kontra said:
Hi!

I tried to compile ruby under windows with mingw:
mingw 3.1.0
msys 1.0.11-20040430

I don't use msys but I can tell you how I compile mingw32-ruby
with cygwin:

export CC=/usr/local/mingw32/bin/gcc.exe
export LD=/usr/local/mingw32/bin/ld.exe
export AR=/usr/local/mingw32/bin/ar.exe
export AS=/usr/local/mingw32/bin/as.exe
export RANLIB=/usr/local/mingw32/bin/ranlib.exe
export CPP=/usr/local/mingw32/bin/cpp.exe
export CXX=/usr/local/mingw32/bin/g++.exe
export NM=/usr/local/mingw32/bin/nm.exe
/configure --build=i386-mingw32 --host=i386-mingw32 --target=i386-mingw32

It may be overkill but it works every time. You can verify ruby
does not depend on cygwin using cygcheck,
cygcheck ./ruby.exe
/ruby.exe
.\msvcrt-ruby18.dll
C:\WINNT\system32\ADVAPI32.DLL
C:\WINNT\system32\NTDLL.DLL
C:\WINNT\system32\KERNEL32.DLL
C:\WINNT\system32\RPCRT4.DLL
C:\WINNT\system32\msvcrt.dll
C:\WINNT\system32\USER32.dll
C:\WINNT\system32\GDI32.DLL
C:\WINNT\system32\WSOCK32.DLL
C:\WINNT\system32\WS2_32.DLL
C:\WINNT\system32\WS2HELP.DLL

There's also a -no-cygwin flag to gcc, but I've always preferred
using the latest mingw compiler.

I'm actually not sure why msys exists; cygwin has been around
a while and has worked out many of its kinks.
kgergely@LIGHTSPEED /c/tmp/ruby-gtk2-0.9.1
This reminded me of Lightspeed C, the very first C compiler I saw and used :)





__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo
 
J

Joao Pedrosa

Hi,

--- Jeff Mitchell said:
I don't use msys but I can tell you how I compile
mingw32-ruby
with cygwin:

[snip]

Masao has a guide on compiling Ruby and, most
importantly, Ruby-GTK with MinGW:
http://ruby-gnome2.sourceforge.jp/hiki.cgi?compile_mingw

I have followed successfully the guide a couple of
times. Maybe something has changed since I used it a
couple of months ago, but I believe it's just some
step missing when following it.

I even managed to compile other extensions
successfully with it.

Cheers,
Joao



__________________________________
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.
http://promotions.yahoo.com/new_mail
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,736
Latest member
zacharyharris

Latest Threads

Top