# WxRuby, Ruby 2.0, and Windows 7

**URL:** <https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223>\
**Category:** wxRuby\
**Created:** [April 2, 2014, 10:15pm UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223 "2014-04-02T22:15:14Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [April 2, 2014, 10:15pm UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/1 "2014-04-02T22:15:14Z")

</div>

I’m working on a project for the National Renewable Energy Labs,  
developing a plugin for Trimble SketchUp. We are using WxRuby as the  
backbone for our GUI components. We love it’s flexibility and ease of  
use. Unfortunately, SketchUp recently updated from Ruby 1.8.6 to Ruby  
2.0.0 and now WxRuby is incompatible with our plugin.

Has anyone had success getting WxRuby to work with Ruby 2.0 on a Windows  
machine? I have downloaded the WxRuby source code, WxWidgets source  
code, and SWIG, and I’ve spent a lot of effort investigating how WxRuby  
works. Unfortunately, I have had no success compiling my own version to  
be compatible with Ruby 2.0.0. Also, what version of WxWidgets should I  
be using? Do the newer versions (e.g. WxWidgets 3.0.0) present problems  
with WxRuby?

Can anyone offer any help getting WxRuby to work with Ruby 2.0.0?

Thanks!

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 3, 2014, 12:07pm UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/2 "2014-04-03T12:07:09Z")

</div>

Am 02.04.2014 22:15, schrieb Kameron Kincade:

> Has anyone had success getting WxRuby to work with Ruby 2.0 on a Windows  
> machine?

wxRuby is currently unmaintained since several years, i.e. nobody works  
on it. Unless you want to maintain wxRuby yourself, there are no  
guarantees it builds on anything.

> Also, what version of WxWidgets should I  
> be using? Do the newer versions (e.g. WxWidgets 3.0.0) present problems  
> with WxRuby?

wxRuby is incompatible with any wxWidgets version greater then 2.8.12.  
Additionally, wxRuby AFAIK needs SWIG 1.3.x to built successfully.  
wxRuby was barely compatible with Ruby 1.9, so I doubt it would work on  
Ruby 2.x.

> Can anyone offer any help getting WxRuby to work with Ruby 2.0.0?

A friend of mine is working on an alternative wxWidgets bridge to ruby:

> **[GitHub - Hanmac/rwx: wxWidgets binding for ruby](https://github.com/Hanmac/rwx)**
>
> wxWidgets binding for ruby

Maybe you want to try that one?

> Thanks!

Vale,  
Quintus

–  
Blog: [http://www.quintilianus.eu](http://www.quintilianus.eu)

I will reject HTML emails. | Ich akzeptiere keine HTML-Nachrichten.  
|  
Use GnuPG for mail encryption: | GnuPG fr Mail-Verschlsselung:  
[http://www.gnupg.org](http://www.gnupg.org) | [The GNU Privacy Guard](http://gnupg.org/index.de.html)

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 4, 2014, 6:24pm UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/3 "2014-04-04T18:24:59Z")

</div>

> A friend of mine is working on an alternative wxWidgets bridge to ruby:  
> [GitHub - Hanmac/rwx: wxWidgets binding for ruby · GitHub](https://github.com/Hanmac/rwx)
> 
> Maybe you want to try that one?

Thanks for the suggestion. Do you have any more information on rwx?

Some of my questions include:  
Is it compatible with Ruby 2.0?  
What version of WxWidgets is it compatible with and to what extent (what  
widgets are not functional)?  
Does it need to be built, and if so how?

I cloned the git repo, but unfortunately there are not any instructions  
on how to use it. Any information you can provide would be much  
appreciated. Thanks!!!

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 4, 2014, 7:50pm UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/4 "2014-04-04T19:50:25Z")

</div>

Hi i am the Author of rwx, so for your questions:

rwx should work with 1.9.3 but 2.0 is recomended, (i test it against  
trunk)  
wxWidgets 3.0 is current, it should work with that, and also there i  
test against trunk (2.8 is not supported and i don’t know if i want  
that)

there are still some widgets that does not work or are not implemented  
yet  
there are some samples for beginning and there is a decent rdoc  
documentation

the usage is similar to wxRuby but with a bit differences (like  
WX::ID\_OK or what else its named in wxRuby is not a constant in rwx but  
you can simply use :ok as symbol) this differences are not documented  
yet in a README but might be noticeable from the samples

like i said README is currently not important, and currently i try not  
to add new classes or methods and try to document the existing ones  
(currently ~44% documented)

a gem can be build with rake:

rake gem  
gem install \*

or directly with

cd ext  
ruby extconf.rb  
make  
[sudo] make install

PS: but i do not know what todo on a windows machine … (never had one  
since years)

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 16, 2014, 1:36pm UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/5 "2014-04-16T13:36:10Z")

</div>

@Jason: what wx version did you use (what are the compile flags), what  
is your Gcc/clang version  
and what sample did you use and what did you do?  
because i couldnt reproduce it yet

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 16, 2014, 12:23am UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/6 "2014-04-16T00:23:04Z")

</div>

Hi,

Thanks for your work on rwx.

I followed the instruction (on Mac 10.9 using Ruby 2.1 via RVM).  
Compiled OK. When I tried to run an example, got the error

ruby(1246,0x7fff7d5a8310) malloc: \*\*\* error for object 0x7fff5872feb0:  
pointer being freed was not allocated  
\*\*\* set a breakpoint in malloc\_error\_break to debug  
Abort trap: 6

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 22, 2014, 12:51pm UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/7 "2014-04-22T12:51:27Z")

</div>

i might fixed that problem with “couldn’t set to colour string ‘CYAN’”  
please try it again if it works, if not i might need to fix more

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 22, 2014, 12:31am UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/8 "2014-04-22T00:31:46Z")

</div>

Hi Hans,

I installed standard WxWidgets 3.0 for Mac.

$ gcc --version  
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr  
–with-gxx-include-dir=/usr/include/c++/4.2.1  
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)  
Target: x86\_64-apple-darwin13.1.0  
Thread model: posix

$ruby -version  
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86\_64-darwin13.0]

The example I tried

$cd samples/controls  
$ruby controls.rb

I just did git pull, and rebuild (ruby extconf.rb; make), got this  
error:

~/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core\_ext/kernel\_require.rb:55:in  
`require': wxColour::Set - couldn't set to colour string 'CYAN' (WX::Error) from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in`require’  
from controls.rb:2:in `’

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 22, 2014, 11:26pm UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/9 "2014-04-22T23:26:15Z")

</div>

Hi Hans,

Did update and rebuild, still got the “CYAN” error.

~/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core\_ext/kernel\_require.rb:55:in  
`require': wxColour::Set - couldn't set to colour string 'CYAN' (WX::Error) from ~/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in`require’  
from controls.rb:2:in `’

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 23, 2014, 2:51pm UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/10 "2014-04-23T14:51:42Z")

</div>

i fixed the color bug … the bad thing is that the constants are only  
later available

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 24, 2014, 7:43am UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/11 "2014-04-24T07:43:53Z")

</div>

hm what i think the problem might be, try to use a newer gcc version or  
use a newer clang version, i dont know about homebrew but this should  
be easly installed with macports (the gcc4.2 version from mac might be  
buggy)

rvm does help to recompile ruby after changing the CC (because even with  
newer gcc or newer clang it still prefers the system installed version)

and PS: if you try this, all, wxwidgets, ruby and this gem need to be  
compiled with the same version so mixing clang & gcc does not work

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 24, 2014, 12:19am UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/12 "2014-04-24T00:19:00Z")

</div>

Hi Hans,

The ‘CYAN’ issue is fixed. I ran controls.rb under samples/controls, got  
the error. I am using fresh-installed Mac OS X 10.9, given rwx was  
working for you, the only thing I can think of : I installed homebrew.

ruby(3099,0x7fff75122310) malloc: \*\*\* error for object 0x7fff5c9e7e50:  
pointer being freed was not allocated  
\*\*\* set a breakpoint in malloc\_error\_break to debug  
Abort trap: 6

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 24, 2014, 7:46am UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/13 "2014-04-24T07:46:46Z")

</div>

PS also try wxtrunk, the packaged version from wx might be buggy

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 24, 2014, 8:44am UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/14 "2014-04-24T08:44:42Z")

</div>

Jason S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> ruby(3099,0x7fff75122310) malloc: \*\*\* error for object 0x7fff5c9e7e50:  
> pointer being freed was not allocated  
> \*\*\* set a breakpoint in malloc\_error\_break to debug  
> Abort trap: 6

To help Hans debugging the problem, you might want to run your program  
in a GDB session like this:

$ gdb ruby

> r yourscript.rb  
> (wait until it aborts)  
> bt

This will give you a backtrace that exactly shows where the code  
crashes. You will need to have compiled rwx in debug mode for this.  
Note I’m not a rwx dev, just throwing in a random suggestion here.

Vale,  
Quintus

–  
Blog: [http://www.quintilianus.eu](http://www.quintilianus.eu)

I will reject HTML emails. | Ich akzeptiere keine HTML-Nachrichten.  
|  
Use GnuPG for mail encryption: | GnuPG für Mail-Verschlüsselung:  
[http://www.gnupg.org](http://www.gnupg.org) | [The GNU Privacy Guard](http://gnupg.org/index.de.html)

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 26, 2014, 4:40am UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/15 "2014-04-26T04:40:23Z")

</div>

Thanks for the responses.

Tried, GDB approach, no stack returned.

(gdb) r controls.rb  
Starting program: ~/.rvm/rubies/ruby-2.1.1/bin/ruby controls.rb  
Unable to find Mach task port for process-id 32174: (os/kern) failure  
(0x5).  
(please check gdb is codesigned - see taskgated(8))  
(gdb) bt  
No stack.

Then I use rvm to use system Ruby (ruby 2.0.0p247) to compile rwx. Got  
four errors as the below:

wxAboutDlg.cpp:68:2: error: use of undeclared identifier ‘RARRAY\_AREF’  
set\_option2(version,Version)  
^

Can you point me some instructions on wxtrunk? thanks.

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 27, 2014, 4:37am UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/16 "2014-04-27T04:37:25Z")

</div>

Hi Hans,

The RARRAY\_AREF is fixed, got this compilation error (rvm use system  
ruby on Mac OS 10.9)

wxBookCtrl.cpp:126:2: error: no matching function for call to  
‘rb\_enumeratorize\_with\_size’  
RETURN\_SIZED\_ENUMERATOR(self,0,NULL,\_each\_size);  
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/intern.h:217:13:  
note:  
expanded from macro ‘RETURN\_SIZED\_ENUMERATOR’  
return rb\_enumeratorize\_with\_size((obj),  
ID2SYM(rb\_frame\_this\_func()),  
^ ~~~~~~~~~~~~~~~~~~~~~~~~~  
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/intern.h:214:7:  
note:  
candidate function not viable: no known conversion from ‘VALUE  
(VALUE)’ to ‘VALUE (\*)(…)’ for  
5th argument  
VALUE rb\_enumeratorize\_with\_size(VALUE, VALUE, int, VALUE _, VALUE  
(_)(ANYARGS));  
^  
1 error generated.  
make: \*\*\* [wxBookCtrl.o] Error 1

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 26, 2014, 8:16am UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/17 "2014-04-26T08:16:29Z")

</div>

fixed problem with RARRAY\_AREF … it was because of i only test against  
newer versions … (currenlty does not have a working system there)

with wxtrunk i mean try to compile from there

> **[GitHub - wxWidgets/wxWidgets: Cross-Platform C++ GUI Library](https://github.com/wxWidgets/wxWidgets)**
>
> Cross-Platform C++ GUI Library. Contribute to wxWidgets/wxWidgets development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 27, 2014, 5:16am UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/18 "2014-04-27T05:16:56Z")

</div>

so, should be fixed with RUBY\_METHOD\_FUNC … funny that it seems  
unnecessary on my system

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [April 29, 2014, 5:19am UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/19 "2014-04-29T05:19:40Z")

</div>

Hi,

I still experienced the same error.

wxBookCtrl.cpp:126:2: error: no matching function for call to  
‘rb\_enumeratorize\_with\_size’  
RETURN\_SIZED\_ENUMERATOR(self,0,NULL,\_each\_size);  
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/intern.h:217:13:  
note:

---

<div class="post-metadata">

**Author:** ![kkincade](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/258eb7/32.png) [@kkincade](https://www.ruby-forum.com/u/kkincade)\
**Post date:** [May 5, 2014, 9:00am UTC](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223/20 "2014-05-05T09:00:28Z")

</div>

sorry i had an error with unmerged code i didn’t noticed yet,  
i fixed it and added 26 new commits yesterday

[Next page](https://www.ruby-forum.com/t/wxruby-ruby-2-0-and-windows-7/240223.md?page=2)
