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

**URL:** <https://www.ruby-forum.com/t/build-problems-part-iii-and-runtime-problems-part-i/124355>\
**Category:** wxRuby\
**Created:** [December 27, 2007, 10:57pm UTC](https://www.ruby-forum.com/t/build-problems-part-iii-and-runtime-problems-part-i/124355 "2007-12-27T22:57:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ratkins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bcef8e/32.png) [@ratkins](https://www.ruby-forum.com/u/ratkins)\
**Post date:** [December 27, 2007, 10:57pm UTC](https://www.ruby-forum.com/t/build-problems-part-iii-and-runtime-problems-part-i/124355/1 "2007-12-27T22:57:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ratkins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bcef8e/32.png) [@ratkins](https://www.ruby-forum.com/u/ratkins)\
**Post date:** [December 27, 2007, 11:39pm UTC](https://www.ruby-forum.com/t/build-problems-part-iii-and-runtime-problems-part-i/124355/2 "2007-12-27T23:39:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ratkins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bcef8e/32.png) [@ratkins](https://www.ruby-forum.com/u/ratkins)\
**Post date:** [December 27, 2007, 11:55pm UTC](https://www.ruby-forum.com/t/build-problems-part-iii-and-runtime-problems-part-i/124355/3 "2007-12-27T23:55:35Z")

</div>

On Dec 27, 2007 2:36 PM, Alex F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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](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?

---

<div class="post-metadata">

**Author:** ![ratkins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bcef8e/32.png) [@ratkins](https://www.ruby-forum.com/u/ratkins)\
**Post date:** [December 28, 2007, 12:15am UTC](https://www.ruby-forum.com/t/build-problems-part-iii-and-runtime-problems-part-i/124355/4 "2007-12-28T00:15:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ratkins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bcef8e/32.png) [@ratkins](https://www.ruby-forum.com/u/ratkins)\
**Post date:** [December 28, 2007, 12:52am UTC](https://www.ruby-forum.com/t/build-problems-part-iii-and-runtime-problems-part-i/124355/5 "2007-12-28T00:52:59Z")

</div>

On Dec 27, 2007 3:12 PM, Alex F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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-…]
