# Require 'wx' fails

**URL:** <https://www.ruby-forum.com/t/require-wx-fails/191083>\
**Category:** wxRuby\
**Created:** [July 5, 2010, 12:29am UTC](https://www.ruby-forum.com/t/require-wx-fails/191083 "2010-07-05T00:29:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [July 5, 2010, 12:29am UTC](https://www.ruby-forum.com/t/require-wx-fails/191083/1 "2010-07-05T00:29:38Z")

</div>

I’ve recently reloaded my system. For some reason, I can’t get wxruby to  
initialize. In irb, I see the following

require ‘rubygems’  
require ‘wx’  
LoadError: libwx\_gtk2u\_media-2.8.so.0: cannot open shared object file:  
No such file or directory -  
/usr/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-linux/lib/wxruby2.so  
from /usr/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-linux/lib/wxruby2.so  
from /usr/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:31:in  
`require' from /usr/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-linux/lib/wx.rb:12 from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in`gem\_original\_require’  
from /usr/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:36:in  
`require’  
from (irb):1

This seems to say that a file is missing. When I list the directory,  
though, I see

[michael@photon ~]$ ls  
/usr/lib/ruby/gems/1.8/gems/wxruby-2.0.1-x86-linux/lib -l  
total 9732  
drwxr-xr-x 3 root root 4096 2010-07-04 17:18 wx/  
-rw-r–r-- 1 root root 1715 2010-07-04 17:18 wx.rb  
-rwxr-xr-x 1 root root 9939967 2010-07-04 17:18 wxruby2.so\*

Which seems clean. Can anyone offer any help here?  
Thanks in advance  
—Michael

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [July 5, 2010, 9:13am UTC](https://www.ruby-forum.com/t/require-wx-fails/191083/2 "2010-07-05T09:13:30Z")

</div>

Are you using ubuntu?  
if so, perhaps you download wrong gem  
because for new ubuntu, there is a special gem  
or if you want to be sure, check previous post  
about repo for wxruby

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [July 5, 2010, 1:41pm UTC](https://www.ruby-forum.com/t/require-wx-fails/191083/3 "2010-07-05T13:41:01Z")

</div>

On 04/07/2010 23:29, Michael S. wrote:

> I’ve recently reloaded my system. For some reason, I can’t get wxruby to  
> initialize. In irb, I see the following
> 
> ```
> require 'rubygems'
> require 'wx'
> 
> ```
> 
> LoadError: libwx\_gtk2u\_media-2.8.so.0: cannot open shared object file:  
> No such file or directory -

It looks like the wx library you are using hasn’t got support for  
wxMediaCtrl included, whereas the wxRuby gem is expecting this class to  
be supported.

It may be that this extra C++ library can be installed via your package  
manager. Have a look for wx-2.8-xxx packages that are available but not  
installed.

If not, the easiest way may to be compile your own wxRuby from source.  
You’ll need SWIG and the wx-2.8-dev files. The compile process should  
adapt and pick up the local configuration of wx.

alex

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [July 6, 2010, 6:25pm UTC](https://www.ruby-forum.com/t/require-wx-fails/191083/4 "2010-07-06T18:25:56Z")

</div>

Alex F. wrote:

> If not, the easiest way may to be compile your own wxRuby from source.  
> You’ll need SWIG and the wx-2.8-dev files. The compile process should  
> adapt and pick up the local configuration of wx.

It was a good idea, but it doesn’t work. The build of wxruby fails at  
link with

```
 /usr/bin/ld: cannot find -lwx_gtk2u_media-2.8
 collect2: ld returned 1 exit status
 rake aborted!

```

I think I’m going to have to remove the version of wxwidgets supplied by  
PCLinuxOS and do a source install. If anyone knows another way around  
this, I’m certainly listening.

Thanks  
—Michael

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [July 6, 2010, 6:54pm UTC](https://www.ruby-forum.com/t/require-wx-fails/191083/5 "2010-07-06T18:54:03Z")

</div>

Alex F. wrote:

> Before going that more drastic step, you could try force-ignoring  
> MediaCtrl
> 
> rake WXRUBY\_EXCLUDED=MediaCtrl,MediaEvent

Alex, I owe you. That solved the problem and wxruby seems to be working.  
At least  
require ‘wx’

returns true.

THANK YOU VERY MUCH!  
—Michael

---

<div class="post-metadata">

**Author:** ![wickie](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/ba9def/32.png) [@wickie](https://www.ruby-forum.com/u/wickie)\
**Post date:** [July 6, 2010, 6:31pm UTC](https://www.ruby-forum.com/t/require-wx-fails/191083/6 "2010-07-06T18:31:03Z")

</div>

Michael S. wrote:

> It was a good idea, but it doesn’t work. The build of wxruby fails at  
> link with
> 
> ```
> /usr/bin/ld: cannot find -lwx_gtk2u_media-2.8
> collect2: ld returned 1 exit status
> rake aborted!
> 
> ```
> 
> I think I’m going to have to remove the version of wxwidgets supplied by  
> PCLinuxOS and do a source install. If anyone knows another way around  
> this, I’m certainly listening.

That should work, following the compile flags given on the wiki.

Before going that more drastic step, you could try force-ignoring  
MediaCtrl

rake WXRUBY\_EXCLUDED=MediaCtrl,MediaEvent

alex
