Build problems, part III, and runtime problems, part I

After decoding the unresolved symbols from wxruby2.so using c++filt, and
comparing with the symbols provided by wxGTK, it became clear that wxGTK
was
using wchar_t whereas wxruby2.so was using char. So I rebuilt wxGTK,
turning off unicode. That worked. No more unresolved symbols. What
gives? Should the wxruby code have been built using wchar_t, and if so,
how?

However, now I get the following:

% ruby -rubygems nothing.rb
/home/rwa/linux-packages/ruby-1.8.6/lib/ruby/site_ruby/1.8/i686-linux/wxruby2.so:
[BUG] Segmentation fault

the crash is in rb_hash_aref. I saw that I was not the only one to run
into
this from recent mailing list discussion.

The issue appears to be that swig_ruby_trackings has a bogus value. In
my
case it always happens to be 4. It appears it is supposed to point to
valid
storage.

The relevant function appears to be this one:

SWIGRUNTIME void SWIG_RubyInitializeTrackings(void)

where swig_ruby_trackings is looked up, and if it comes back nil, a new
one
is created. Except that, for reasons I don’t understand, it comes back
4,
not 0. When this gets dereferenced after a series of calls from
Init_wxRubyConstants, segfault. Any help? This seems like a real bug,
and
I’m starting to wonder if this package is usable at all.

Robert A. wrote:

So I rebuilt wxGTK, turning off unicode. That worked. No more
unresolved symbols. What gives? Should the wxruby code have been
built using wchar_t, and if so, how?
I’m sorry but I don’t understand this. Unfortunately I’m away and don’t
have a Linux box here - but, wxruby2 should only work with a unicode
build; all of the conversions from wxString to ruby Strings assume that
wxGTK has been built with unicode support.
However, now I get the following:

% ruby -rubygems nothing.rb
/home/rwa/linux-packages/ruby-1.8.6/lib/ruby/site_ruby/1.8/i686-linux/wxruby2.so:
[BUG] Segmentation fault

the crash is in rb_hash_aref. I saw that I was not the only one to
run into this from recent mailing list discussion.
Could you refer me the discussion please?

The issue appears to be that swig_ruby_trackings has a bogus value.
In my case it always happens to be 4. It appears it is supposed to
point to valid storage.

The relevant function appears to be this one:

SWIGRUNTIME void SWIG_RubyInitializeTrackings(void)
This is code that’s generated by SWIG, not immediately part of wxRuby.
What version of SWIG are you using? (swig -version) The most recently
released version of SWIG came out after wxRuby 1.9.2 in November and
hasn’t yet been tested with it. I’d strongly suggest using version
1.3.31 for now.
This seems like a real bug, and I’m starting to wonder if this package
is usable at all.
Clearly not for you, clearly yes for lots of other people. There’s
something that’s different about your environment that’s causes serious
bugs; let’s figure out what it is.

alex

On Dec 27, 2007 2:36 PM, Alex F. [email protected] wrote:

Robert A. wrote:

So I rebuilt wxGTK, turning off unicode. That worked. No more
unresolved symbols. What gives? Should the wxruby code have been
built using wchar_t, and if so, how?
I’m sorry but I don’t understand this. Unfortunately I’m away and don’t
have a Linux box here - but, wxruby2 should only work with a unicode
build; all of the conversions from wxString to ruby Strings assume that
wxGTK has been built with unicode support.

Somehow my build is configured otherwise. I don’t understand the
mechanisms
for how this is configure, so I don’t know how it got out of whack.

Here’s the evidence:

nm obj/App.o | grep wxStringBase8InitWithEPK | c++filt
U wxStringBase::InitWith(char const*, unsigned int, unsigned
int)

whereas I would assume a unicode build would be using wchar_t instead of
char.

Could you refer me the discussion please?
Sure, here’s a link:

http://rubyforge.org/pipermail/wxruby-users/2007-December/003497.html

What version of SWIG are you using? (swig -version) The most recently
released version of SWIG came out after wxRuby 1.9.2 in November and
hasn’t yet been tested with it. I’d strongly suggest using version
1.3.31 for now.

% swig -version

SWIG Version 1.3.33

Should I downgrade?

Robert A. wrote:

Somehow my build is configured otherwise. I don’t understand the
mechanisms for how this is configure, so I don’t know how it got out
of whack.

wxRuby doesn’t even try to configure this; it simply depends on there
being a unicode not ANSI build. I am wondering whether SWIG is the issue
here…

Here’s the evidence:

nm obj/App.o | grep wxStringBase8InitWithEPK | c++filt
U wxStringBase::InitWith(char const*, unsigned int, unsigned int)

whereas I would assume a unicode build would be using wchar_t instead
of char.

So would I; here’s what my build (OS X) says:

Abaddon:wxruby2 alex$ nm obj/App.o | grep wxStringBase8InitWithEPK |
c++filt
U wxStringBase::InitWith(wchar_t const*, unsigned long,
unsigned long)

http://rubyforge.org/pipermail/wxruby-users/2007-December/003497.html
Thanks. Will follow this up.

% swig -version

SWIG Version 1.3.33

Should I downgrade?

Yes, definitely, to 1.3.31 please. SWIG versions are notoriously
incompatible even between minor versions, and wxRuby hincludesas
numerous hacks to work around SWIG bugs.

Then you should be able to do
rake reswig && rake

If this improves things I will update the wiki to make it clearer that
there is the specific version dependency

Thanks
alex

On Dec 27, 2007 3:12 PM, Alex F. [email protected] wrote:

Then you should be able to do
rake reswig && rake

If this improves things I will update the wiki to make it clearer that
there is the specific version dependency

Unfortunately this gives the same result for the 1.9.2 tarball:
segfault in
rb_hash_aref, when the hash has address 0x4.

I tried to build the svn sources, but ended up here:

g++ -c
-I/home/rwa/linux-packages/wxGTK-2.8.7-static/lib/wx/include/gtk2-
ansi-release-static-2.8 -I/home/rwa/linux-packages/wxGTK-2.8.7-static
/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
-D_LARGEFILE_SOURCE=1
-D__WXGTK__ -g -O2 -Wno-unused-function -I
/home/rwa/linux-packages/gems/rake-0.8.0/bin -I
/home/rwa/linux-packages/gems/rake-0.8.0/lib -I
/home/rwa/linux-packages/ruby-1.8.6/lib/ruby/site_ruby/1.8 -I
/home/rwa/linux-packages/ruby-1.8.6/lib/ruby/site_ruby/1.8/i686-linux -I
/home/rwa/linux-packages/ruby-1.8.6/lib/ruby/site_ruby -I
/home/rwa/linux-packages/ruby-1.8.6/lib/ruby/1.8 -I
/home/rwa/linux-packages/ruby-1.8.6/lib/ruby/1.8/i686-linux -I . -I
/home/rwa/Distributions/wxruby-svn/doc/lib -o obj/URLDataObject.o
src/URLDataObject.cpp
In file included from src/URLDataObject.cpp:2092:
src/URLDataObject.h:19: base `Swig::Director’ with only non-default
constructor
in class without a constructor
rake aborted!
Command failed with status (1): [g++ -c
-I/home/rwa/linux-packages/wxGTK-…]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs