Home Home > 2010 > 09 > 04 > Recompiling wxRuby
Sign up | Login

Deprecation notice: openSUSE Lizards user blog platform is deprecated, and will remain read only for the time being. Learn more...

Recompiling wxRuby

September 4th, 2010 by

Who uses Ruby might be interested to try this interesting multiplatform library that allows the development of GUI (Graphic User Interface) with a considerable visual impact and compatible with the three most popular Operating Systems: Linux (via GTK) Windows (with Native controls) and OSX (via Aqua). (This article is also available for italian users)

Usually need install the wxGTK libraries and the gem wxruby (or wxruby-ruby19 if using ruby 1.9) and start creating your own scripts.

$ sudo zypper in wxGTK wxGTK-gl
$ sudo gem install wxruby

But sometimes we could find an Error for a wrong compatibilty between the installed version of the wxGTK libraries and the wrapper library included in the gem.

/usr/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-linux/lib/wxruby2.so:
symbol _ZN13wxAuiNotebook14ShowWindowMenuEv, version WXU_2.8.5 not defined in file libwx_gtk2u_aui-2.8.so.0 with link time reference -
/usr/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-linux/lib/wxruby2.so

When an error like this appear, the unique solution is recompile the gem.

What we need:

  • rubygems: Tool for manage the ruby’s gems;
  • rake: the Ruby’s version of the popular make, will help us to compile wxRuby;
  • wxGTK, wxGTK-gl, wxGTK-devel: Library and headers needed for run our scripts and produce the object’s file;
  • SWIG: Build the wrapper classes in Ruby from the C++ sources, wxRuby 2.0.1 need the version 1.3.8;
  • gcc-c++: The C++ compiler used for build the wrapper library;
  • wxRuby: We have to download the source’s package directly from Rubyforge.

Added the repository which contains the Ruby extensions (warning to the portion of the address that refers the version of openSUSE), we can proceed with the installation confirming the request of the dependent packages:

$ sudo zypper ar http://download.opensuse.org/repositories/devel:/languages:/ruby:/extensions/openSUSE_11.3/ RubyExtensions
$ sudo zypper ref
$ sudo zypper install rubygems rubygem-rake gcc-c++ wxGTK-devel rubygem-ffi-swig-generator make

It’s time to download the sources of SWIG version 1.3.38 from sourceforge, then uncompress and install it:

tar -xvf swig-1.3.38.tar.gz
cd swig-1.3.38
./configure && make
sudo make install

All the packages are ready, we have to set some environment variables before continue:

export SWIG_CMD=/usr/local/bin/swig
export WXRUBY_EXCLUDED=GLCanvas
export WXRUBY_VERSION=2.0.1

The second instruction is important for ignore all the references to the openGL library, which are not availables in unicode version.

The next step is download the wxRuby’s source from Rubyforge and start to compile

tar -xvf wxruby-2.0.1.tar.gz
cd wxruby-2.0.1
rake

After this procedure end you can remove the old gem and build & install the new:

rake gem
sudo gem install wxruby-2.0.1-x86-linux.gem

Personally, I needed recompile wxRuby in openSUSE 11.2; with the new version (11.3) standard packages work fine, anyway i wished share my experience for someone could meet the same trouble in the future :))

Both comments and pings are currently closed.

Comments are closed.