# Ruby Gnome2 on Windows

**URL:** <https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811>\
**Category:** Ruby-Gnome 2\
**Created:** [June 28, 2010, 3:59pm UTC](https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811 "2010-06-28T15:59:52Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![esox\_ch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4da419/32.png) [@esox\_ch](https://www.ruby-forum.com/u/esox_ch)\
**Post date:** [June 28, 2010, 3:59pm UTC](https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811/1 "2010-06-28T15:59:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![esox\_ch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4da419/32.png) [@esox\_ch](https://www.ruby-forum.com/u/esox_ch)\
**Post date:** [June 28, 2010, 4:51pm UTC](https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811/2 "2010-06-28T16:51:24Z")

</div>

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

– niklas

---

<div class="post-metadata">

**Author:** ![esox\_ch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4da419/32.png) [@esox\_ch](https://www.ruby-forum.com/u/esox_ch)\
**Post date:** [June 28, 2010, 7:00pm UTC](https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811/3 "2010-06-28T19:00:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![esox\_ch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4da419/32.png) [@esox\_ch](https://www.ruby-forum.com/u/esox_ch)\
**Post date:** [June 28, 2010, 5:25pm UTC](https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811/4 "2010-06-28T17:25:58Z")

</div>

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 :

---

<div class="post-metadata">

**Author:** ![esox\_ch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4da419/32.png) [@esox\_ch](https://www.ruby-forum.com/u/esox_ch)\
**Post date:** [June 29, 2010, 3:09pm UTC](https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811/5 "2010-06-29T15:09:07Z")

</div>

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 :

---

<div class="post-metadata">

**Author:** ![esox\_ch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4da419/32.png) [@esox\_ch](https://www.ruby-forum.com/u/esox_ch)\
**Post date:** [July 1, 2010, 8:02pm UTC](https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811/6 "2010-07-01T20:02:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![esox\_ch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4da419/32.png) [@esox\_ch](https://www.ruby-forum.com/u/esox_ch)\
**Post date:** [June 29, 2010, 1:39am UTC](https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811/7 "2010-06-29T01:39:34Z")

</div>

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 \<

---

<div class="post-metadata">

**Author:** ![esox\_ch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4da419/32.png) [@esox\_ch](https://www.ruby-forum.com/u/esox_ch)\
**Post date:** [July 1, 2010, 9:08pm UTC](https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811/8 "2010-07-01T21:08:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![esox\_ch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4da419/32.png) [@esox\_ch](https://www.ruby-forum.com/u/esox_ch)\
**Post date:** [July 1, 2010, 9:03pm UTC](https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811/9 "2010-07-01T21:03:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![esox\_ch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4da419/32.png) [@esox\_ch](https://www.ruby-forum.com/u/esox_ch)\
**Post date:** [July 1, 2010, 11:47pm UTC](https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811/10 "2010-07-01T23:47:54Z")

</div>

On 2 July 2010 04:08, Stefano G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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/](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 ☹  
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! 🙂

Good luck!

```
       MikeC

```

---

<div class="post-metadata">

**Author:** ![esox\_ch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4da419/32.png) [@esox\_ch](https://www.ruby-forum.com/u/esox_ch)\
**Post date:** [August 29, 2010, 2:53am UTC](https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811/11 "2010-08-29T02:53:46Z")

</div>

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 :

---

<div class="post-metadata">

**Author:** ![esox\_ch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4da419/32.png) [@esox\_ch](https://www.ruby-forum.com/u/esox_ch)\
**Post date:** [August 29, 2010, 2:39am UTC](https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811/12 "2010-08-29T02:39:37Z")

</div>

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/](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.

---

<div class="post-metadata">

**Author:** ![esox\_ch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/4da419/32.png) [@esox\_ch](https://www.ruby-forum.com/u/esox_ch)\
**Post date:** [September 19, 2010, 5:51pm UTC](https://www.ruby-forum.com/t/ruby-gnome2-on-windows/190811/13 "2010-09-19T17:51:15Z")

</div>

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
