Ruby on rails 安装eventmachine-v'的本机gem时发生编译错误;0.12.10';
我无法使用Ruby on rails 安装eventmachine-v'的本机gem时发生编译错误;0.12.10';,ruby-on-rails,ruby,rake,bundler,eventmachine,Ruby On Rails,Ruby,Rake,Bundler,Eventmachine,我无法使用rake bundle\u 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
rake bundle\u 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]
如何解决此问题?据我所知,此版本似乎存在问题,我发现解决此问题的唯一方法是这样。我的建议是查看Gemfile.lock,看看哪个gem需要这个版本,考虑一下您是否真的需要它,或者检查这个gem是否是更新的,因为它是eventmachine的一个非常旧的版本 为什么要使用这样一个旧版本的gem?原因是在rake bundle\u install
的输出结束时,它要求在尝试设置项目之前尝试gem install eventmachine-v'0.12.10'
。我试图通过以下方法解决这个问题,这是一个ruby版本的问题。我最终安装了ruby1.9.3p551
和rvm
。