Forum: wxRuby WxRuby, Ruby 2.0, and Windows 7

4f348554059d431584524ed310436dd0?d=identicon&s=25 Kameron Kincade (kkincade)
on 2014-04-02 22:15
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!
85991f138ede6236f35eb98da22b7b01?d=identicon&s=25 Marvin Gülker (quintus)
on 2014-04-03 12:07
(Received via mailing list)
Attachment: signature.asc (555 Bytes)
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:
https://github.com/Hanmac/rwx

Maybe you want to try that one?

> Thanks!

Vale,
Quintus

--
Blog: 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://gnupg.org/index.de.html
4f348554059d431584524ed310436dd0?d=identicon&s=25 Kameron Kincade (kkincade)
on 2014-04-04 18:24
> A friend of mine is working on an alternative wxWidgets bridge to ruby:
> 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!!!
D9ebdcb66f1583378e6f72155db507e2?d=identicon&s=25 Hans Mackowiak (hanmac)
on 2014-04-04 19:50
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)
8346d7f9cf627c168a179c2e31f57f8e?d=identicon&s=25 Jason Sandfield (jsandfield)
on 2014-04-16 00:23
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
D9ebdcb66f1583378e6f72155db507e2?d=identicon&s=25 Hans Mackowiak (hanmac)
on 2014-04-16 13:36
@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
8346d7f9cf627c168a179c2e31f57f8e?d=identicon&s=25 Jason Sandfield (jsandfield)
on 2014-04-22 00:31
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 `<main>'
D9ebdcb66f1583378e6f72155db507e2?d=identicon&s=25 Hans Mackowiak (hanmac)
on 2014-04-22 12:51
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
8346d7f9cf627c168a179c2e31f57f8e?d=identicon&s=25 Jason Sandfield (jsandfield)
on 2014-04-22 23:26
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 `<main>'
D9ebdcb66f1583378e6f72155db507e2?d=identicon&s=25 Hans Mackowiak (hanmac)
on 2014-04-23 14:51
i fixed the color bug ... the bad thing is that the constants are only
later available
8346d7f9cf627c168a179c2e31f57f8e?d=identicon&s=25 Jason Sandfield (jsandfield)
on 2014-04-24 00:19
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
D9ebdcb66f1583378e6f72155db507e2?d=identicon&s=25 Hans Mackowiak (hanmac)
on 2014-04-24 07:43
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
D9ebdcb66f1583378e6f72155db507e2?d=identicon&s=25 Hans Mackowiak (hanmac)
on 2014-04-24 07:46
PS also try wxtrunk, the packaged version from wx might be buggy
85991f138ede6236f35eb98da22b7b01?d=identicon&s=25 Marvin Gülker (quintus)
on 2014-04-24 08:44
(Received via mailing list)
Jason Sandfield <lists@ruby-forum.com> 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

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://gnupg.org/index.de.html
8346d7f9cf627c168a179c2e31f57f8e?d=identicon&s=25 Jason Sandfield (jsandfield)
on 2014-04-26 04:40
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.
D9ebdcb66f1583378e6f72155db507e2?d=identicon&s=25 Hans Mackowiak (hanmac)
on 2014-04-26 08:16
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
https://github.com/wxWidgets/wxWidgets
8346d7f9cf627c168a179c2e31f57f8e?d=identicon&s=25 Jason Sandfield (jsandfield)
on 2014-04-27 04:37
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
D9ebdcb66f1583378e6f72155db507e2?d=identicon&s=25 Hans Mackowiak (hanmac)
on 2014-04-27 05:16
so, should be fixed with RUBY_METHOD_FUNC ... funny that it seems
unnecessary on my system
8346d7f9cf627c168a179c2e31f57f8e?d=identicon&s=25 Jason Sandfield (jsandfield)
on 2014-04-29 05:19
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:
D9ebdcb66f1583378e6f72155db507e2?d=identicon&s=25 Hans Mackowiak (hanmac)
on 2014-05-05 09:00
sorry i had an error with unmerged code i didn't noticed yet,
i fixed it and added 26 new commits yesterday
8346d7f9cf627c168a179c2e31f57f8e?d=identicon&s=25 Jason Sandfield (jsandfield)
on 2014-05-06 01:31
Hi Hans,

Thanks for the update.

Did a rebuild, got errors:

compiling wxFontPicker.cpp
wxFontPicker.cpp:23:1: error: no member named 'GetSelectedColour' in
      'wxFontPickerCtrl'; did you mean 'GetSelectedFont'?
macro_attr(SelectedColour,wxColor)
^
./main.hpp:423:52: note: expanded from macro 'macro_attr'
#define macro_attr(attr,type)
macro_attr_func(attr,Get##attr(),Set##attr...
                                                   ^
<scratch space>:107:1: note: expanded from here
D9ebdcb66f1583378e6f72155db507e2?d=identicon&s=25 Hans Mackowiak (hanmac)
on 2014-05-06 08:30
hm ok GetSelectedColour seems new,
needed to write my own method for mkmf to check for its existence ...
(otherwise i would needed to check the wx version and this might not be
the right one)

hm or you test it against wxtrunk ...
E23087687a1dc09800922263cf1774c0?d=identicon&s=25 Alessandro Barracco (bomastudio)
on 2014-05-17 15:17
(Received via mailing list)
Hi, is there any update on WxRuby working with Ruby 2.x??


2014-05-06 8:30 GMT+02:00 Hans Mackowiak <lists@ruby-forum.com>:
This topic is locked and can not be replied to.