为eventmachine -v' 0.12.10'安装本机gem时编译错误

时间:2015-01-21 17:47:55

标签: ruby-on-rails ruby rake bundler eventmachine

我无法使用rake bundle_install设置项目:

$ rake bundle_install
cd nats && bundle install
rake aborted!
Command failed with status (5): [cd nats && bundle install...]

Tasks: TOP => bundle_install
(See full trace by running task with --trace)
Fetching gem metadata from http://rubygems.org/.........
Resolving dependencies...
Using rake (0.9.2.2) 
Using daemons (1.1.8) 
Using diff-lcs (1.1.3) 
Installing eventmachine (0.12.10) 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb 
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... yes
checking for writev() in sys/uio.h... yes
checking for rb_thread_check_ints()... yes
checking for rb_time_new()... yes
checking for sys/event.h... no
checking for epoll_create() in sys/epoll.h... yes
checking for main() in -lcrypto... no
creating Makefile

make
compiling sigs.cpp
compiling cplusplus.cpp
compiling files.cpp
compiling kb.cpp
kb.cpp: In member function ‘virtual void KeyboardDescriptor::Read()’:
kb.cpp:79:27: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
  read (GetSocket(), &c, 1);
                       ^
compiling rubymain.cpp
rubymain.cpp: In function ‘VALUE t_connect_server(VALUE, VALUE, VALUE)’:
rubymain.cpp:468:42: error: format not a string literal and no format arguments [-Werror=format-security]
   rb_raise (EM_eConnectionError, e.what());
                                          ^
rubymain.cpp: In function ‘VALUE t_bind_connect_server(VALUE, VALUE, VALUE, VALUE, VALUE)’:
rubymain.cpp:488:42: error: format not a string literal and no format arguments [-Werror=format-security]
   rb_raise (EM_eConnectionError, e.what());
                                          ^
cc1plus: some warnings being treated as errors
make: *** [rubymain.o] Error 1


Gem files will remain installed in /home/heavenize/.bundler/tmp/15236/gems/eventmachine-0.12.10 for inspection.
Results logged to /home/heavenize/.bundler/tmp/15236/gems/eventmachine-0.12.10/ext/gem_make.out
An error occurred while installing eventmachine (0.12.10), and Bundler cannot continue.
Make sure that `gem install eventmachine -v '0.12.10'` succeeds before bundling.

然后,当我尝试所需版本的eventmachine时,我得到了以下输出:

$  sudo gem install eventmachine -v '0.12.10'
ERROR:  Error installing eventmachine:
ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for rb_thread_blocking_region()... yes
checking for inotify_init() in sys/inotify.h... yes
checking for writev() in sys/uio.h... yes
checking for rb_thread_check_ints()... yes
checking for rb_time_new()... yes
checking for sys/event.h... no
checking for epoll_create() in sys/epoll.h... yes
checking for main() in -lcrypto... no
creating Makefile

make
compiling sigs.cpp
compiling cplusplus.cpp
compiling files.cpp
compiling kb.cpp
kb.cpp: In member function ‘virtual void KeyboardDescriptor::Read()’:
kb.cpp:79:27: warning: ignoring return value of ‘ssize_t read(int, void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result]
  read (GetSocket(), &c, 1);
                           ^
compiling rubymain.cpp
rubymain.cpp: In function ‘VALUE t_connect_server(VALUE, VALUE, VALUE)’:
rubymain.cpp:468:42: error: format not a string literal and no format arguments [-Werror=format-security]
   rb_raise (EM_eConnectionError, e.what());
                                          ^
rubymain.cpp: In function ‘VALUE t_bind_connect_server(VALUE, VALUE, VALUE, VALUE, VALUE)’:
rubymain.cpp:488:42: error: format not a string literal and no format arguments [-Werror=format-security]
   rb_raise (EM_eConnectionError, e.what());
                                          ^
cc1plus: some warnings being treated as errors
make: *** [rubymain.o] Error 1


Gem files will remain installed in /var/lib/gems/1.9.1/gems/eventmachine-0.12.10 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/eventmachine-0.12.10/ext/gem_make.out

我有以下设置:

$ rake --version
rake, version 0.9.2.2
$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

如何解决此问题?

1 个答案:

答案 0 :(得分:0)

据我所知,这个版本似乎存在问题,我找到解决此问题的唯一方法是thread。我的建议是查看Gemfile.lock并查看哪个gem需要该版本,并考虑是否确实需要它或检查该gem是否更新,因为这是一个非常旧版本的eventmachine。