3

我正在运行RVM,它运行良好,但我似乎无法弄清楚如何安装 ruby​​-gnome2。我已按照本教程中的步骤进行操作,它们是:

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

4 回答 4

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:

宝石安装gtk2

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

需要'gtk2'

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

win.show_all

gtk.main

于 2012-06-11T19:35:42.813 回答
0

我希望,当您按照这些说明进行操作时,就可以:

ruby extconf.rb —ruby=`which ruby`

你实际上:

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

如果不是,那是你的错误。

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

于 2010-08-17T16:40:08.387 回答
0

我需要继续gtk2_rvmubuntu 14.04.1ruby 2.1.2

(~)$ 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
于 2014-09-29T19:32:31.180 回答
0

为了构建ruby-gnome2具有所有依赖项的 RVM,请确保在构建 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
于 2011-11-10T00:43:37.617 回答