使用RVM在Ubuntu上安装Ruby-Gnome2

时间:2010-08-09 12:57:14

标签: ruby gtk rvm ruby-gnome2

我有RVM正在运行并且它运行良好,但我似乎无法弄清楚如何安装ruby-gnome2。我已按照this tutorial上的步骤操作,这些步骤为:

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

这不会产生任何错误,所以我认为它有效。所以我试着用它来测试它:

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

这给了我这个错误:

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

为什么我无法安装ruby-gnome2?

4 个答案:

答案 0 :(得分:2)

安装系统依赖:

  

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

安装gtk2 gem,它是ruby-gnome2:

  

gem install gtk2

您可以运行这个小脚本来验证是否已安装gtk2:

  

要求'gtk2'

     

win = Gtk :: Window.new(“我的ruby-gnome2项目”)

     

win.show_all

     

Gtk.main

答案 1 :(得分:0)

我希望,当你按照这些说明行事时,就行了:

ruby extconf.rb —ruby=`which ruby`

你实际上:

  • 使用了两个破折号 - (页面中的代码用长的破折号替换了这两个破折号)
  • 用操作系统上运行该命令的实际输出替换了`which ruby​​`(注意反引号)(没有反引号)

如果没有,那就是你的错误。

如果你真的做了所有这些,请发布你从ruby extconf.rb ...行获得的输出。

答案 2 :(得分:0)

为了为所有依赖项的RVM构建ruby-gnome2,请确保在构建ruby二进制文件之前安装了以下软件包:

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

使用以下命令安装后,您可以再次重建它:

rvm install 1.9.1

然后,按照您发布的说明进行操作:

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

答案 3 :(得分:0)

我需要gtk2 rvm ubuntu 14.04.1 ruby 2.1.2 <{1}}

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

因此得到所有要求

sudo apt-get install ruby-gtk2

观看安装

(~)$ 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) ...

弹入RVM

rvm use 2.1.2
gem install gtk2

观看安装发生

(~)$ 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

点火您的应用。

pdfwalker