# Problems installing/running svn-code

**URL:** <https://www.ruby-forum.com/t/problems-installing-running-svn-code/121523>\
**Category:** wxRuby\
**Created:** [November 28, 2007, 6:00pm UTC](https://www.ruby-forum.com/t/problems-installing-running-svn-code/121523 "2007-11-28T18:00:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [November 28, 2007, 6:00pm UTC](https://www.ruby-forum.com/t/problems-installing-running-svn-code/121523/1 "2007-11-28T18:00:53Z")

</div>

Hi,

The last couple of days I’ve been trying to get back on the wxRuby-horse  
however I’ve ran into some problems while compiling/testing the  
subversion sources. Mind, the 1.9.2 official release works fine.  
Absolutely no problems whatsoever.

The first hurdle was that the rake install target doesn’t work. It fails  
on rakewx.rb:145. Looking into it I found that $target\_lib wasn’t set to  
anything. Searching the sources I couldn’t find where it is supposed to  
be set.

Still the rake gem command works fine so I installed the newly created  
gem. However when trying to run the minimal sample (only one I tried) it  
segfaults. After recompiling both wxGTK and wxRuby with debug enabled I  
decided to run it through gdb.

I couldn’t find anything, it’s just a wee bit too complex for me to  
handle right now. Don’t think this is useful for the developers but just  
in case it might be this is the error I got: undefined symbol:  
_Z10wxOnAssertPKwiPKcS0\_S0_

I am running wxGTK-2.8.6, Ruby 1.8.6, RubyGems 0.9.4 and the wxruby  
subversion archive is up-to-date (rev 1450). I compiled wxGTK with the  
following configure command:  
./configure --disable-shared --with-gtk --enable-monolithic   
–enable-unicode --enable-debug --enable-catch\_segvs  
–enable-graphics\_ctx   
–enable-mediactrl --with-opengl --with-libjpeg=builtin  
–with-libpng=builtin   
–with-libtiff=builtin --with-zlib=builtin --with-expat=builtin  
–enable-gui   
–enable-xrc --enable-mdi --enable-gif   
–enable-pcx --enable-iff --enable-pnm --enable-xpm

With kind regards,  
Jonathan M.

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [December 8, 2007, 11:51am UTC](https://www.ruby-forum.com/t/problems-installing-running-svn-code/121523/2 "2007-12-08T11:51:05Z")

</div>

Hi Jonathan

Thanks for the reports, sorry to be slow in following up.

Jonathan M. wrote:

> The first hurdle was that the rake install target doesn’t work. It fails  
> on rakewx.rb:145. Looking into it I found that $target\_lib wasn’t set to  
> anything. Searching the sources I couldn’t find where it is supposed to  
> be set.

Should now be fixed in SVN. With most people using gems, we’ve kind of  
slipped on maintenance of the tar.gz/install route, so please do report  
any probs.

> I couldn’t find anything, it’s just a wee bit too complex for me to  
> handle right now. Don’t think this is useful for the developers but just  
> in case it might be this is the error I got: undefined symbol:  
> _Z10wxOnAssertPKwiPKcS0\_S0_

Hmm, I think I’ve seen that error if I’ve mistakenly compiled a debug  
wxRuby against a release wxWidgets, or vice versa. I think all the  
object files in wxRuby need to have been compiled with the  
“WXRUBY\_DEBUG” environment variable set.

The configuration for wxWidgets looks appropriate for this.

cheers  
alex

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [December 11, 2007, 12:00am UTC](https://www.ruby-forum.com/t/problems-installing-running-svn-code/121523/3 "2007-12-11T00:00:59Z")

</div>

Hello Jonathan,

I’ve ran into the same problem myself, compiling from SVN on Linux,  
using  
wxGTK, and Ruby 1.8.6. I was able to get wxRuby and wxGTK to compile  
with  
Debug support, and from what I can see, running through gdb (Which was a  
trick and a half), it shows that it’s segfaulting on rb\_hash\_aref(),  
which  
is comming from /usr/lib/libruby.so.1.8 So I have a couple of questions  
for  
you.

1.) Which Distro are you using?

2.) Did you install Ruby from Source, or from your Distro’s Package  
Manager?

3.) Do you have the same problems if you take out the --with-opengl?

These are just a few questions / ideas to get an idea of where the  
problem  
lies.

L8ers,

Mario S.

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [December 12, 2007, 7:00pm UTC](https://www.ruby-forum.com/t/problems-installing-running-svn-code/121523/4 "2007-12-12T19:00:09Z")

</div>

I’ve put together a GUI with WxRuby that works fine (under Windows XP).  
Now  
I’m adding another component, a UDP server, which runs in a separate  
thread.  
What I’m seeing is that the UDP server runs for a little while when I do  
something in the GUI, but then stops processing UDP packets until I do  
something else on the GUI. My UDP server thread spends most of its time  
waiting for a UDP packet, so it should be able to run at a high priority  
without interfering with the GUI operation.

So what do I need to know about the interaction between WxRuby and other  
Ruby threads? Does WxRuby have threads running to implement GUI events?  
Are there known problems with running other threads in a WxRuby app?

Thanks,

Eric R.

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [December 12, 2007, 7:12pm UTC](https://www.ruby-forum.com/t/problems-installing-running-svn-code/121523/5 "2007-12-12T19:12:17Z")

</div>

Hi Eric

Eric R. wrote:

> other Ruby threads? Does WxRuby have threads running to implement GUI  
> events? Are there known problems with running other threads in a  
> WxRuby app?

As with other GUI toolkits, wxRuby doesn’t play so well with Ruby 1.8’s  
lightweight threads. The main GUI event loop runs constantly, and when  
it’s in there (in C-based code) Ruby’s thread scheduler won’t switch  
execution to subsidiary threads.

Fortunately, it’s not hard to work around by using a Wx::Timer to  
schedule switches of Ruby’s thread execution. The recommended workaround  
is described here:

[http://rubyforge.org/pipermail/wxruby-users/2007-April/003055.html](http://rubyforge.org/pipermail/wxruby-users/2007-April/003055.html)

You will probably want to tweak the parameter to Timer#start to get the  
best responsiveness off your UDP server whilst still keeping the GUI  
reactive.

hth  
alex

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [December 13, 2007, 4:07pm UTC](https://www.ruby-forum.com/t/problems-installing-running-svn-code/121523/6 "2007-12-13T16:07:19Z")

</div>

Alex’s fix did the trick. Thanks.

Here’s the relevant part of my code. The UDP server, VIP102Comm, has to  
receive on a multicast address. I found some code for this online, but  
had  
to make a couple of changes to get it to run under Windows. One is that  
Socket::IP\_ADD\_MEMBERSHIP is not defined in Windows. Also in Windows  
the  
setsockopt call has to come after the bind call. (It the code I copied  
it  
came before and produced an error.)

There also seems to be a problem with recvfrom. (Don’t know if it’s  
only in  
Windows.) When I used recvfrom it worked, but each recvfrom call took  
about  
5 seconds. The problem went away when I switched to recv (but now I  
can’t  
get the source IP address).

Eric

require “soft\_phone\_frame”

require “vip102comm”

class SoftPhoneApp \< App

def on\_init

```
tmr = Wx::Timer.new(self, 55)

evt_timer(55) { Thread.pass }

tmr.start(100)

frame = SoftPhoneFrame.new()

Thread.new { VIP102Comm.new(frame) }

```

end

end

SoftPhoneApp.new.main\_loop

class VIP102Comm

def initialize(parent)

```
Thread.current.priority = 100

@parent = parent # soft_phone_frame

@control_addr = "239.1.1.2"

@control_port = 4097

begin

  ip = IPAddr.new(@control_addr).hton + IPAddr.new("0.0.0.0").hton

  @sock = UDPSocket.new

  @sock.bind(Socket::INADDR_ANY, @control_port) # in Windows 

```

setsockopt  
must follow bind

```
  if Socket::const_defined?('IP_ADD_MEMBERSHIP')

    @sock.setsockopt(Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, 

```

ip)

```
  else # workaround for Ruby bug where Socket::IP_ADD_MEMBERSHIP is 

```

not  
defined in Windows

```
    @sock.setsockopt(Socket::IPPROTO_IP, 12, ip)

  end

rescue ArgumentError => a

  puts "Argument error: " + a

rescue Exception => e

  puts "error: " + e

end

loop do

  packet = @sock.recv(1350)

```

# packet, sender = @sock.recvfrom(1350)

# srcIPAddr = sender[3]

```
  process_packet(packet)

end

```

end

---

<div class="post-metadata">

**Author:** ![jonathan2000](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/fbc32d/32.png) [@jonathan2000](https://www.ruby-forum.com/u/jonathan2000)\
**Post date:** [December 12, 2007, 7:33pm UTC](https://www.ruby-forum.com/t/problems-installing-running-svn-code/121523/7 "2007-12-12T19:33:08Z")

</div>

Hello Eric,

As pointed out by Alex, it is a bit of a side trip to get things to work  
properly for wxRuby, with Ruby’s Soft-Threading control. As mentioned  
above, Timer + Thread.pass is the best method in which to do this. You  
should be able to find in the SVN an example of a wxRuby program  
utilizing  
Sockets within Threads, that I created myself.  
[http://wxruby.rubyforge.org/svn/trunk/wxruby2/samples/sockets/](http://wxruby.rubyforge.org/svn/trunk/wxruby2/samples/sockets/) is the  
url to  
the svn lookup, and you should look at wxServer.rb. This is geared for  
Connection Based sockets, not Connectionless Sockets like what your  
Implementing. I would actually like to look at your code, once you’ve  
implemented the Timer + Thread.pass, to get an Idea of how UDP Sockets  
would  
work with the method, so that I can further investigate creating a  
library  
that will do this for us.

Thanks,

Mario S.
