Ruby Gnome2 on Windows

Hello,

I am currently developing a little app which needs to be cross-plateform
(Linux, Windows ans maybe MacOSX later). I used Glade3 and GTK Builder
to design its interface on my Linux system and it works well.
If I am not mistaken (please correct me if so) , the latest version of
ruby2-gnome for windows is 2.0.16, which does not support GTK Builder.
Is there a newer installer version?
I tried to recompile it from the latest sources by the generated
MakeFiles seems to have some few troubles. Is there any official written
procedure for compiling them on Windows ?
I am wondering if it doesn’t fail because I am not compiling it using
MSYS, but straight from the cmd.exe . Do you think it could come from
that?

Thank for your answer,

Best regards.

can you give a little more details on what steps you took to try
compilation and why it fails?

– niklas

I don’t know too much about mingw, but the code between @( and ) is
actually shell script, so maybe mingw’s make tries to evaluate it in
cmd.exe? do you have some bash port, such as cygwin to try from there?

– niklas

Hello,

Sure thing.

  • I installed Ruby for Windows ( v 1.8.7 )
  • I installed MinGW
  • I installed Glade3 (with GTK+) for Windows from the Glade website
  • I downloaded GTK2-Ruby v 0.19.4
  • I run the extconf.rb , which worked quite fine
  • When I try to make the project here is what I get :

C:\ruby-gtk2-0.19.4>C:\MinGW\bin\mingw32-make.exe
if was unexpected.
mingw32-make: *** [all] Error 255

Here is the all target (with the aliasesdeclarations on the top ):

TOPSRCDIR = C:/ruby-gtk2-0.19.4
SUBDIRS = glib gdkpixbuf pango atk gtk
COMMAND = C:/Ruby/bin/ruby.exe C:/ruby-gtk2-0.19.4/exec_make.rb
RM = rm -rf

all:
@(
succeeded=’’;
failed=’’;
for dir in $(SUBDIRS); do
(cd $$dir; $(MAKE) all);
if [ $$? -eq 0 ]; then
succeeded="$$succeeded $$dir";
else
failed="$$failed $$dir";
fi;
done;
if [ “$$succeeded” = “” ]; then
succeeded=“NONE”;
fi;
if [ “$$failed” = “” ]; then
failed=“NONE”;
fi;
echo;
echo “-----”;
echo “SUCCEEDED: $$succeeded”;
echo “FAILED: $$failed”;
echo “-----”;
echo “Done.”;
)

Thanks a lot for your help!

Best

Stefano

Le 28.06.2010 16:50, niklas | brueckenschlaeger a écrit :

Hello,

Thank you for your answer.
I installed MSYS and was able to run the makefile this time.
I however get a weird error which makes every lib fail to link :

c:\MinGW\bin…\lib\gcc\mingw32\3.4.5…\mingw32\bin\ld.exe:
cannot locate -lruby-cairo
collect2: ld returned 1 exit status

Is there some other ruby-* binding I need to find and compile (for
instance, ruby-cairo) ?

Does anyone here know who built the last Windows automatic installer for
ruby-gtk2 ? It could be helpful for me to see what was performed by the
installer (in case someone knows where to find the source code) and I
may even be able to update it to the current version (which could be
helpful for my further developments as well as for others).

Thanks for your help,

best regards

Stefano G.

Le 29.06.2010 01:12, Mario S. a écrit :

Hello,

I am sorry to insist but I truly believe that providing a cross-platform
(and ready to use) library for Ruby-GTK would be a great thing as it
allows people to take advantage of the extreme simplicity of both Ruby
and Glade3 on both Linux and Windows.
Is there really none who knows how the ruby-gtk for Windows
auto-installer was the first time built?

Best regards

Stefano G.

The best way to use it, is to use the MSYS package from MinGW, which
includes a BASH system. You will also need to set Environment
variables, as
well as headers and libs for GTK so that MinGW, and Ruby-GTK can find
it.

hth,

Mario

On Mon, Jun 28, 2010 at 12:59 PM, niklas | brueckenschlaeger <

Like I said in my previous mail, I did not manage to compile it because
of the error hereafter. I guess that I still lack some dependency,
however I did not find a list of them anywhere. I wanted to retrieve the
code of the previous installer so that I could check what is lacking and
maybe, where to find it and how to compile it.

The error I am talking about :

c:\MinGW\bin…\lib\gcc\mingw32\3.4.5…\mingw32\bin
\ld.exe: cannot locate -lruby-cairo
collect2: ld returned 1 exit status

Thanks for your answer,

Stefano G.

did you try to use your build on a different windows installation?
should be binary compatible I guess…

On 2 July 2010 04:08, Stefano G. [email protected] wrote:

c:\MinGW\bin..\lib\gcc\mingw32\3.4.5........\mingw32\bin
\ld.exe: cannot locate -lruby-cairo
collect2: ld returned 1 exit status

Well… I’ve never done this, so I’m only guessing but the README
says that Cairo comes from rcairo, which you can get here:

http://cairographics.org/rcairo/

On Windows you must set the environment variable CAIRO_PATH.

It’s also supposed to be optional, so perhaps there is
a bug.

To be honest, I remember that all the cairo stuff was changed about
a year ago, but I don’t remember what was done. Perhaps the
documentation is out of date…

For the Windows installer, that was done a long, long, long time
ago. I don’t think the person who did it is around any more :frowning:
I agree with you that it is very important. I just got a computer
with Windows on it a few days ago, so I will try to help you.
But I am busy for a few more weeks. If you haven’t solved
all the problems by then I will help! :slight_smile:

Good luck!

       MikeC

Stefano G. wrote:

Hello,

Thank you for your answer.
I installed MSYS and was able to run the makefile this time.
I however get a weird error which makes every lib fail to link :

c:\MinGW\bin…\lib\gcc\mingw32\3.4.5…\mingw32\bin\ld.exe:
cannot locate -lruby-cairo
collect2: ld returned 1 exit status

Is there some other ruby-* binding I need to find and compile (for
instance, ruby-cairo) ?

I used rcairo-1.8.5.tar.gz inside msys/1.0/home to build and install it.
That seemed to do the trick but env vars may vary. That at least gave me
a working copy of cairo.so in the site-ruby/1.8/i386-msvcrt folder which
worked better than the cairo.gem.

Does anyone here know who built the last Windows automatic installer for
ruby-gtk2 ? It could be helpful for me to see what was performed by the
installer (in case someone knows where to find the source code) and I
may even be able to update it to the current version (which could be
helpful for my further developments as well as for others).

Thanks for your help,

best regards

Stefano G.

Le 29.06.2010 01:12, Mario S. a écrit :

Stefano G. wrote:

Hello,

I am currently developing a little app which needs to be cross-plateform
(Linux, Windows ans maybe MacOSX later). I used Glade3 and GTK Builder
to design its interface on my Linux system and it works well.
If I am not mistaken (please correct me if so) , the latest version of
ruby2-gnome for windows is 2.0.16, which does not support GTK Builder.

see this page:http://ruby-gnome2.sourceforge.jp/

Is there a newer installer version?
I tried to recompile it from the latest sources by the generated
MakeFiles seems to have some few troubles. Is there any official written
procedure for compiling them on Windows ?
I am wondering if it doesn’t fail because I am not compiling it using
MSYS, but straight from the cmd.exe . Do you think it could come from
that?

I am having issues also.
I tried to follow the install guide as closely as possible with a few
minor changes such as different files like the previously mentioned one
at the top of the page. Then I found that I needed to change some header
includes to find the headers like cairo.h to cairo/cairo.h and so forth.
I don’t know if it is wise but I copied many of the GTK includes and
libs into mingw also just in case.
I’ve gotten cairo, glib, and pango to work so far but now I find that I
do not have gtk/gtkpagesetupunixdialog.h and this is the first error I
get with the gtk
makefile. Any luck there?

Thank for your answer,

Best regards.

I just compiled ruby-gtk2-0.19.4 with ruby 1.9.2 (mingw) on my windows 7
64bit. Its quite a painful process that I spend hours just to compile
it. There is nothing wrong with the ruby-gnome code but the Makefile
like include directory, lib directory missing and even the Makefile
don’t produce the static library .a file if you don’t do some
modification.

I compile with rcairo-1.8.5. It has some error with rb_errinfo (not sure
why the extconf.rb doesn’t detect the correct setting, I just modify the
code to use the correct rb_errinfo)

compiling glib found missing libintl.h, this is easy just add the path
manually to the Makefile. Then it should compile without problem. The
only thing is it might not found the ruby-cairo although you set the
correct path. Looking at the Makefile, it appends src at my cairo path
which is not correct(I think the older version of the rcairo has a src
directory?), just remove the src should make it compile. At last, which
I had struggle for long time is it doesn’t produce the static library
for glib. After searching around on the net, I had to modify the
following line in Makefile(apply for gtk, pango and etc…):

-dldflags = -Wl,–enable-auto-image-base,–enable-auto-import
$(DEFFILE),–out-implib=libruby-glib2.a
+dldflags =
-Wl,–out-implib=libruby-glib2.a,–enable-auto-image-base,–enable-auto-import
$(DEFFILE)

Just do the same tricks for others like pango, atk…etc. Move the
–out-implib to the front.

In the end when come to compile gtk. I face another error. It state that
libruby-gtk2.a not found. I have no idea why this happend. So, I just
remove the -lruby-gtk2 and let it create the libruby-gtk2.a. After that,
I added back the -lruby-gtk2 into it and compile again. But it still
give me another error where it can’t export some function like
rbgtk_clipboard_get_type, rbgtk_make_clipboard, …etc. Looking at the
gtk2.def, all the function which not able to export is rbgtk function
which had DATA at the end. I just remove the DATA at the function in the
gtk2.def file and it able to compile successfully and install. I was
able to run the gtk-demo in the src code without problem, no extensive
testing since I am just compile this for fun.

Any can explain what the impact I remove the DATA from the gtk2.def,
here is the gtk2.def after I made changes(some rbgtk function had DATA
but I just remove it):

EXPORTS
Init_gtk2
mGdk DATA
rb_cGdkColor DATA
mGtk DATA
exec_callback
gdk_atom_copy
gdk_atom_get_type
gdk_geometry_get_type
gdk_region_get_type
gdk_windowattr_get_type
get_gdkatom
get_gdkevent
gtk_accel_group_entry_get_type
gtk_accel_key_get_type
gtk_notebookpage_get_type
gtk_target_list_get_type
gtk_bindingset_get_type
make_gdkevent
notebookpage_copy
rbgtk_atom2selectiondata
rbgtk_atom2selectiondata_free
rbgtk_clipboard_get_type
rbgtk_get_clipboard
rbgtk_make_clipboard
rbgtk_get_target_entry
rbgtk_get_tree_row_reference
rbgtk_initialize_gtkobject
rbgtk_register_treeiter_set_value_func
rbgtk_tree_row_reference_get_type
gtk_text_appearance_get_type DATA
rbgtk_dialog_add_buttons_internal