RyanScottLewis
RyanScottLewis

Reputation: 14046

Installing Ruby-Gnome2 on Ubuntu with RVM

I have RVM running and it is working brilliantly, but I can't seem to figure out how to install ruby-gnome2. I have followed the steps on this tutorial, which are:

rvm use 1.9.1 # I use 1.9.1 which should work with ruby-gnome2
wget http://downloads.sourceforge.net/ruby-gnome2/ruby-gnome2-all-0.19.4.tar.gz
tar zxf ruby-gnome2-all-0.19.4.tar.gz
cd ruby-gnome2-all-0.19.4/
ruby extconf.rb —ruby=`which ruby`
make
make install

This produces no errors, so I assume it worked. So I try to test it with:

$ irb
irb(main):001:0> require 'gtk2'

Which gives me this error:

irb(main):001:0> require 'gtk2'
LoadError: no such file to load -- gtk2

Why am I not able to install ruby-gnome2?

Upvotes: 3

Views: 2595

Answers (4)

shadowbq
shadowbq

Reputation: 1459

I need gtk2 in rvm on ubuntu 14.04.1 with ruby 2.1.2

(~)$ pdfwalker 
Error: you need to install ruby-gtk2 to run this application

So get all the requirements

sudo apt-get install ruby-gtk2

Watch it install

(~)$ sudo apt-get install ruby-gtk2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gambas3-gb-form-stock kde-l10n-engb libp11-kit-gnome-keyring:i386
  wine-gecko2.21 wine-gecko2.21:i386 wine-mono0.0.8
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  libruby1.9.1 libruby2.0 ruby ruby-atk ruby-cairo ruby-gdk-pixbuf2 ruby-glib2
  ruby-gobject-introspection ruby-pango ruby1.9.1 ruby2.0 rubygems-integration
Suggested packages:
  ri ruby-dev ruby1.9.1-examples ri1.9.1 graphviz ruby1.9.1-dev ruby-switch
  bundler
The following NEW packages will be installed:
  libruby1.9.1 libruby2.0 ruby ruby-atk ruby-cairo ruby-gdk-pixbuf2 ruby-glib2
  ruby-gobject-introspection ruby-gtk2 ruby-pango ruby1.9.1 ruby2.0
  rubygems-integration
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 6,579 kB of archives.
After this operation, 31.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/main ruby all 1:1.9.3.4 [5,334 B]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/main ruby1.9.1 amd64 1.9.3.484-2ubuntu1 [35.6 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu/ trusty/main libruby1.9.1 amd64 1.9.3.484-2ubuntu1 [2,667 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu/ trusty/main rubygems-integration all 1.5 [5,340 B]
Get:5 http://us.archive.ubuntu.com/ubuntu/ trusty/main ruby2.0 amd64 2.0.0.484-1ubuntu2 [66.5 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu/ trusty/main libruby2.0 amd64 2.0.0.484-1ubuntu2 [2,807 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu/ trusty/universe ruby-glib2 amd64 2.1.0-1 [133 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu/ trusty/universe ruby-atk amd64 2.1.0-1 [26.4 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu/ trusty/universe ruby-cairo amd64 1.12.8-1 [96.5 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu/ trusty/universe ruby-gdk-pixbuf2 amd64 2.1.0-1 [25.9 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu/ trusty/universe ruby-gobject-introspection amd64 2.1.0-1 [38.9 kB]
Get:12 http://us.archive.ubuntu.com/ubuntu/ trusty/universe ruby-pango amd64 2.1.0-1 [53.0 kB]
Get:13 http://us.archive.ubuntu.com/ubuntu/ trusty/universe ruby-gtk2 amd64 2.1.0-1 [619 kB]
Fetched 6,579 kB in 17s (367 kB/s)                                             
Selecting previously unselected package ruby.
(Reading database ... 277672 files and directories currently installed.)
Preparing to unpack .../ruby_1%3a1.9.3.4_all.deb ...
Unpacking ruby (1:1.9.3.4) ...
Selecting previously unselected package ruby1.9.1.
Preparing to unpack .../ruby1.9.1_1.9.3.484-2ubuntu1_amd64.deb ...
Unpacking ruby1.9.1 (1.9.3.484-2ubuntu1) ...
Selecting previously unselected package libruby1.9.1.
Preparing to unpack .../libruby1.9.1_1.9.3.484-2ubuntu1_amd64.deb ...
Unpacking libruby1.9.1 (1.9.3.484-2ubuntu1) ...
Selecting previously unselected package rubygems-integration.
Preparing to unpack .../rubygems-integration_1.5_all.deb ...
Unpacking rubygems-integration (1.5) ...
Selecting previously unselected package ruby2.0.
Preparing to unpack .../ruby2.0_2.0.0.484-1ubuntu2_amd64.deb ...
Unpacking ruby2.0 (2.0.0.484-1ubuntu2) ...
Selecting previously unselected package libruby2.0:amd64.
Preparing to unpack .../libruby2.0_2.0.0.484-1ubuntu2_amd64.deb ...
Unpacking libruby2.0:amd64 (2.0.0.484-1ubuntu2) ...
Selecting previously unselected package ruby-glib2.
Preparing to unpack .../ruby-glib2_2.1.0-1_amd64.deb ...
Unpacking ruby-glib2 (2.1.0-1) ...
Selecting previously unselected package ruby-atk.
Preparing to unpack .../ruby-atk_2.1.0-1_amd64.deb ...
Unpacking ruby-atk (2.1.0-1) ...
Selecting previously unselected package ruby-cairo.
Preparing to unpack .../ruby-cairo_1.12.8-1_amd64.deb ...
Unpacking ruby-cairo (1.12.8-1) ...
Selecting previously unselected package ruby-gdk-pixbuf2.
Preparing to unpack .../ruby-gdk-pixbuf2_2.1.0-1_amd64.deb ...
Unpacking ruby-gdk-pixbuf2 (2.1.0-1) ...
Selecting previously unselected package ruby-gobject-introspection.
Preparing to unpack .../ruby-gobject-introspection_2.1.0-1_amd64.deb ...
Unpacking ruby-gobject-introspection (2.1.0-1) ...
Selecting previously unselected package ruby-pango.
Preparing to unpack .../ruby-pango_2.1.0-1_amd64.deb ...
Unpacking ruby-pango (2.1.0-1) ...
Selecting previously unselected package ruby-gtk2.
Preparing to unpack .../ruby-gtk2_2.1.0-1_amd64.deb ...
Unpacking ruby-gtk2 (2.1.0-1) ...
Processing triggers for man-db (2.6.7.1-1) ...
Setting up ruby (1:1.9.3.4) ...
Setting up libruby1.9.1 (1.9.3.484-2ubuntu1) ...
Setting up rubygems-integration (1.5) ...
Setting up ruby2.0 (2.0.0.484-1ubuntu2) ...
Setting up libruby2.0:amd64 (2.0.0.484-1ubuntu2) ...
Setting up ruby-glib2 (2.1.0-1) ...
Setting up ruby-atk (2.1.0-1) ...
Setting up ruby-cairo (1.12.8-1) ...
Setting up ruby-gdk-pixbuf2 (2.1.0-1) ...
Setting up ruby-gobject-introspection (2.1.0-1) ...
Setting up ruby-pango (2.1.0-1) ...
Setting up ruby-gtk2 (2.1.0-1) ...
Setting up ruby1.9.1 (1.9.3.484-2ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.3) ...

Pop into RVM

rvm use 2.1.2
gem install gtk2

Watch the install happen

(~)$ gem install gtk2
Fetching: pkg-config-1.1.5.gem (100%)
Successfully installed pkg-config-1.1.5
Fetching: glib2-2.2.0.gem (100%)
Building native extensions.  This could take a while...
Successfully installed glib2-2.2.0
Fetching: atk-2.2.0.gem (100%)
Building native extensions.  This could take a while...
Successfully installed atk-2.2.0
Fetching: cairo-1.12.9.gem (100%)
Building native extensions.  This could take a while...
Successfully installed cairo-1.12.9
Fetching: pango-2.2.0.gem (100%)
Building native extensions.  This could take a while...
Successfully installed pango-2.2.0
Fetching: gdk_pixbuf2-2.2.0.gem (100%)
Building native extensions.  This could take a while...
Successfully installed gdk_pixbuf2-2.2.0
Fetching: gtk2-2.2.0.gem (100%)
Building native extensions.  This could take a while...
Successfully installed gtk2-2.2.0
7 gems installed

Fireup your app.

pdfwalker

Upvotes: 0

Serhii Potapov
Serhii Potapov

Reputation: 3990

Install system dependecies:

sudo apt-get install libglib2.0-dev libatk1.0-dev libcairo-dev libsqlite3-dev libpango1.0-dev libgtk2.0-dev libgdk-pixbuf2.0

Install gtk2 gem which is ruby-gnome2:

gem install gtk2

You can run this tiny script to verify that gtk2 is installed:

require 'gtk2'

win = Gtk::Window.new("My ruby-gnome2 project")

win.show_all

Gtk.main

Upvotes: 2

TrinitronX
TrinitronX

Reputation: 5223

In order to build ruby-gnome2 for RVM with all dependencies, ensure the following packages are installed before you build your ruby binary:

sudo apt-get install libatk1.0-dev libpanel-applet-4-dev libgtksourceview2.0-dev libvte-dev libgstreamer0.10-dev libbonobo2-dev libbonoboui2-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libgtksourceview2.0-dev libpango1.0-dev libpoppler-dev libglade2-dev libart-2.0-dev libgnomeprint2.2-dev libgnomecanvas2-dev libgtkglext1-dev libgnomeprintui2.2-dev libgoocanvas-dev libgnomevfs2-dev libgconf2-dev  librsvg2-dev

You can rebuild it again after installing these with:

rvm install 1.9.1

Then, follow the instructions you posted:

rvm use 1.9.1 # I use 1.9.1 which should work with ruby-gnome2
wget http://downloads.sourceforge.net/ruby-gnome2/ruby-gnome2-all-0.19.4.tar.gz
tar zxf ruby-gnome2-all-0.19.4.tar.gz
cd ruby-gnome2-all-0.19.4/
ruby extconf.rb —ruby=`which ruby`
#   Alternatively you may use the following line
#   to install into rvm's dir and avoid conflict with system libs
# ruby extconf.rb --ruby=`which ruby` --prefix=$MY_RUBY_HOME
make
make install

Upvotes: 0

Porta
Porta

Reputation: 1

I hope that, when you followed those instructions, on the line:

ruby extconf.rb —ruby=`which ruby`

You actually:

  • used two dashes -- (the code in the page replaced those two dashes with a long one)
  • replaced the `which ruby` (note the backticks) with the actual output of running that command on your OS (with no backticks)

If not, that's your error.

If you actually did all those, please post the output you got from the ruby extconf.rb ... line.

Upvotes: 0

Related Questions