Building Ruby with MinGW help needed

Hi!

I’m happily running Ruby on my Linux box, but since the latest
Ruby-GNOME2 bindings have support for MinGW I’d like to test it on Win
platform.

I use latest MinGW & MSYS and built Ruby 1.6.8 from source.

The only problem I had was that (according to info found in archives)
Had to modify my LDSHARED line in Makefile to:

LDSHARED= dllwrap --target=mingw32 --export-all -s

and after make finishes, one has to run “make ruby.exe” to get ruby.exe.

However when I tried to build Ruby-GNOME2 bindings, "ruby extconf.rb"
reports that it cannot find Gobject-2.0 and GCC although they are both
present, along with other GTK+ libraries.

On the Ruby-GNOME2 mailing list, I got the answer that probably my
environment is not capable of building ruby extension libraries which
use extconf.rb.

I also tried with Ruby binary package for MinGW, but still the same.

So, I’m asking for some help and/or pointer how to build Ruby with MinGW
compiler (with MSYS environment) in order to be able to build extension
libraries for Win32.

Sincerely,
Gour

ps. Anyone built Ruby-GNOME2 libraries with MinGW?

···


Gour
gour@mail.inet.hr
Registered Linux User #278493

I’ve run across my share of these “cannot find gcc.exe” type messages.
Make sure mingw’s bin directory is on the path (but I suspect it already
is).

Here’s what I usually do: install all header and library files that you
need in the MinGW directory, not in the msys directory (configure with
–prefix=C:/MinGW). After that, run ruby extconf.rb from a DOS prompt,
not from the msys shell. Finally, run make also from the DOS prompt.
Strangely, make is called mingw32-make.exe and msys does some translation.
Use that name.

Hope that helps. And please report if you are successful and how you did
it on the list.

Tobias

···

On Mon, 24 Mar 2003, Gour wrote:

However when I tried to build Ruby-GNOME2 bindings, “ruby extconf.rb”
reports that it cannot find Gobject-2.0 and GCC although they are both
present, along with other GTK+ libraries.

I’ve run across my share of these “cannot find gcc.exe” type messages.
Make sure mingw’s bin directory is on the path (but I suspect it already
is).

Yes, this kind of message was also present when I was building Ruby, but
it disappaered when I stripped the LDSHARED line to:

LDSHARED=dllwrap --target=mingw32 --export-all -s

Here’s what I usually do: install all header and library files that you
need in the MinGW directory, not in the msys directory (configure with
–prefix=C:/MinGW). After that, run ruby extconf.rb from a DOS prompt,
not from the msys shell. Finally, run make also from the DOS prompt.
Strangely, make is called mingw32-make.exe and msys does some translation.
Use that name.

In my present setup (MinGW v2.0 & MSYS 1.0.8) in c:/mingw/bin there is
mingw32-make, while under c:/msys/bin there is make :-()

I tried to run ruby extconf.rb from the command prompt, but without a
success.

When I run ggc from the msys shell, it runs normally, but the extconf.rb
script reports that it cannot find it.

However, when I try to run some ./configure script, it finds gcc without
a problem.

So, no success at the moment. I will try to study again how to install
MinGW & MSYS together. (At the present moment I first installed MSYS &
msysDTK, and then I installed MinGW).

Sincerely,
Gour

Hope that helps. And please report if you are successful and how you did
it on the list.

If there will be something, I’ll surely report.

Thank you for the tips.

···

Tobias Peters (tpeters@invalid.uni-oldenburg.de) wrote:


Gour
gour@mail.inet.hr
Registered Linux User #278493

Here’s what I usually do: install all header and library files that you
need in the MinGW directory, not in the msys directory (configure with
–prefix=C:/MinGW). After that, run ruby extconf.rb from a DOS prompt,
not from the msys shell. Finally, run make also from the DOS prompt.
Strangely, make is called mingw32-make.exe and msys does some translation.
Use that name.

I followed your advice and was being able to built Ruby-GTk2 bindings.
The trick is to run extconf.rb under DOS prompt (although I don’t understand why? :slight_smile:

I have MSYS under c:\msys and MinGW in c:\msys\mingw.

The libraries are built, but the problem is with pango library - no
characters in GTK widgets :frowning:

Do you use Ruby-GTK2?

Hope that helps. And please report if you are successful and how you did
it on the list.

I’m still in the process, but I’ll write small howto for the new users.

Thank you for the help.

Sincerely,
Gour

···

Tobias Peters (tpeters@invalid.uni-oldenburg.de) wrote:


Gour
gour@mail.inet.hr
Registered Linux User #278493

The trick is to run extconf.rb under DOS prompt (although I don’t
understand why? :slight_smile:
[…]
Do you use Ruby-GTK2?

No. I just encounter similar problems with almost any extension for
mingw-ruby.

I’m still in the process, but I’ll write small howto for the new users.

great!

T

···

On Wed, 26 Mar 2003, Gour wrote:

I just tested the procedure to build Ruby-GTK2 bindings for MinGW & MSYS
environment (the howto has to be written - may later today evening :slight_smile:

After building Ruby bindings I tried to execute gtk-demo sample and it
works. This is on my Linux box running Win98 under Win4Lin.

However, when I try to run the same application on native Win98 with the
built Ruby-GTK2 libraries, the script complains about not finding the
required library, although it’s there.

Native GTK gtk-demo applications runs fine on native Win98 with GTK+ Runtime libraries
installed.

The question is: MinGW built applications and libraries should be
executable under native Win environment. How to do that ie. can you
execute and/or use applications/libraries which are built with mingw?

Sincerely,
Gour

···

Tobias Peters (tpeters@uni-oldenburg.de) wrote:

No. I just encounter similar problems with almost any extension for
mingw-ruby.


Gour
gour@mail.inet.hr
Registered Linux User #278493

I just discovered why there is a problem running “ruby extconf.rb” under
MSYS shell. In older ( < 1.7 or 1.8) versions of Ruby, there was problem
with “system” method call, e.g. try:

$ irb
irb(main):001:0> system(“gcc -v”)
=> false

while 1.8 gives:

ggd@GGD /opt/ruby/bin
$ ruby irb
irb(main):001:0> ENV[‘PATH’]
ENV[‘PATH’]
=>
“.;c:/MinGW/bin;C:/MSYS/1.0/BIN;c:/MinGW/BIN;c:/MinGW/LIB;j:/DOS;j:/MERGE;c:/WINDOWS;c:/WINDOWS/COMMAND;.”
irb(main):002:0> system(“gcc -v”)
system(“gcc -v”)
Reading specs from c:/MinGW/bin/…/lib/gcc-lib/mingw32/3.2/specs
Configured with: …/gcc/configure --with-gcc --with-gnu-ld --with-gnu-as
–host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads
–disable-nls --enable-languages=f77,c++,objc,ada
–disable-win32-registry --disable-shared
Thread model: win32
gcc version 3.2 (mingw special 20020817-1)
=> true
irb(main):003:0>

For building Ruby-GTK2 bindings I had to make one small adjustments in
mkmf-gnome2.rb script, and now the whole environment is correctly
recognized under MSYS shell.

I still have some problems in compiling my own 1.8, but after resolving
it, I’ll post my small HOWTO.

Sincerely,
Gour

···

Tobias Peters (tpeters@uni-oldenburg.de) wrote:

No. I just encounter similar problems with almost any extension for
mingw-ruby.


Gour
gour@mail.inet.hr
Registered Linux User #278493