1

当我尝试在 Jruby 中安装 GTk2 gem 时,谁能帮我解决这个问题?

Check http://kenai.com/projects/jruby/pages/Home for alternatives.

checking for -Wall option to compiler... no

checking for -Waggregate-return option to compiler... no

checking for -Wcast-align option to compiler... no


checking for -Wextra option to compiler... no

checking for -Wformat=2 option to compiler... no

checking for -Winit-self option to compiler... no

checking for -Wlarger-than-65500 option to compiler... no

checking for -Wmissing-declarations option to compiler... no

checking for -Wmissing-format-attribute option to compiler... no

checking for -Wmissing-include-dirs option to compiler... no

checking for -Wmissing-noreturn option to compiler... no

checking for -Wmissing-prototypes option to compiler... no

checking for -Wnested-externs option to compiler... no

checking for -Wold-style-definition option to compiler... no

checking for -Wpacked option to compiler... no

checking for -Wp,-D_FORTIFY_SOURCE=2 option to compiler... no

checking for -Wpointer-arith option to compiler... no

checking for -Wswitch-default option to compiler... no

checking for -Wswitch-enum option to compiler... no

checking for -Wundef option to compiler... no

checking for -Wunsafe-loop-optimizations option to compiler... no

checking for -Wwrite-strings option to compiler... no

checking for rb_define_alloc_func() in ruby.h... IOError: Cannot run program "cc" (in directory "C:\jruby-1.6.8\lib\ruby\gems\1.8\gems\glib2-1.1.5\ext\glib2"):
CreateProcess error=2, The system cannot find the file specified

            popen at org/jruby/RubyIO.java:3613

           xpopen at C:/jruby-1.6.8/lib/ruby/site_ruby/shared/mkmf.rb:323

             open at C:/jruby-1.6.8/lib/ruby/site_ruby/shared/mkmf.rb:260

           xpopen at C:/jruby-1.6.8/lib/ruby/site_ruby/shared/mkmf.rb:316

        egrep_cpp at C:/jruby-1.6.8/lib/ruby/site_ruby/shared/mkmf.rb:538

        have_func at C:/jruby-1.6.8/lib/ruby/site_ruby/shared/mkmf.rb:758

     checking_for at C:/jruby-1.6.8/lib/ruby/site_ruby/shared/mkmf.rb:652

         postpone at C:/jruby-1.6.8/lib/ruby/site_ruby/shared/mkmf.rb:286

             open at C:/jruby-1.6.8/lib/ruby/site_ruby/shared/mkmf.rb:260

         postpone at C:/jruby-1.6.8/lib/ruby/site_ruby/shared/mkmf.rb:286

             open at C:/jruby-1.6.8/lib/ruby/site_ruby/shared/mkmf.rb:260

         postpone at C:/jruby-1.6.8/lib/ruby/site_ruby/shared/mkmf.rb:282

     checking_for at C:/jruby-1.6.8/lib/ruby/site_ruby/shared/mkmf.rb:651

        have_func at C:/jruby-1.6.8/lib/ruby/site_ruby/shared/mkmf.rb:755

  check_ruby_func at C:/jruby-1.6.8/lib/ruby/gems/1.8/gems/glib2-1.1.5/lib/mkmf-gnome2.rb:369

           (root) at C:/jruby-1.6.8/lib/ruby/gems/1.8/gems/glib2-1.1.5/lib/mkmf-
gnome2.rb:558

          require at org/jruby/RubyKernel.java:1062

           (root) at extconf.rb:15
*** extconf.rb failed ***

Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers.  Check the mkmf.log file for more details.  You may need configuration options.


Provided configuration options:

        --with-opt-dir

        --without-opt-dir

        --with-opt-include

        --without-opt-include=${opt-dir}/include

        --with-opt-lib

        --without-opt-lib=${opt-dir}/lib

        --with-make-prog

        --without-make-prog

        --srcdir=.

        --curdir

        --ruby=C:/jruby-1.6.8/bin/jruby    

Gem files will remain installed in C:/jruby-1.6.8/lib/ruby/gems/1.8/gems/glib2-1.1.5 for inspection.

Results logged to C:/jruby-1.6.8/lib/ruby/gems/1.8/gems/glib2-1.1.5/ext/glib2/gem_make.out

我被这个问题毁了……实际上我想在 ruby​​ 中运行真正的多线程……我已经编写了一个在 ruby​​ 中使用 GTk 的应用程序……现在我想将该应用程序移植到 JRuby…… .

请帮帮我......之前有人把这个弄短了>>?提前致谢

4

2 回答 2

1

这里的错误是你要么没有安装 C 编译器,要么如果你安装了它就找不到它

IOError:无法运行程序“cc”

所以看起来 GTK 正在尝试构建原生扩展,而 Jruby 不太支持这些扩展。这篇博文讨论了他为使用来自 Jruby https://wordpress.kaspernj.org/?p=85的 gtk+ 而编写的一些代码

由于您要移植到 Jruby,因此您也可以直接使用 Java GTK 或直接使用 SWT。SWT https://github.com/danlucraft/swt有一个 gem,其中包括一些简单的示例,但不确定它有多完整。

作为旁注,Redcar 编辑器是用 Jruby + SWT 编写的

于 2012-09-21T07:14:00.853 回答
1

您可以尝试 Gtk3 的 FFI 绑定。我自己从普通的 Ruby 和 JRuby 中都使用过它们。这些宝石被命名为“gir_ffi”和“gir_ffi-gtk”。

但是,您应该知道,目前在 MRI Ruby 下存在一些线程问题,您将不得不自己解决这些问题,就像我在这里所做的那样:

https://github.com/kaspernj/gtk3assist/blob/master/lib/gtk3assist_threadding.rb

此外,这个库基本上是直接从 C 库中提取的,因此比普通的 Ruby GTK 库要复杂得多。我试图让它变得更简单一些,但要让它像 Ruby GTK2 库一样简单和简单,还有很长的路要走:

https://github.com/kaspernj/gtk3assist/tree/master/lib

这可能是我们一直在等待的多 Ruby 和多操作系统 GUI 库 :-) 我已经让它在 Linux 和 Mac 下工作(还没有在 Windows 上尝试过)。

于 2013-02-27T10:37:50.660 回答