Ruby无法找到gem,但gem存在

时间:2017-09-28 15:15:31

标签: ruby rubygems ubuntu-16.04 fluentd

我正在尝试通过插入控制台在fluentD项目中执行单元测试:

bundle exec rake test test/plugin/test_out_foo.rb

但它返回以下内容:

fatal: Not a git repository (or any parent up to mount point 
/var/lib/gems/2.3.0/gems/fluentd-0.12.40)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Could not find gem 'parallel_tests (~> 0.15.3)' in any of the gem sources 
listed in your Gemfile.
Run `bundle install` to install missing gems.

我并不担心“不是git存储库”,因为我读到它并不会影响这个测试的结果。然后,如果我尝试按照建议进入“捆绑安装”,则返回:

Installing cool.io 1.5.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /var/lib/gems/2.3.0/gems/fluentd-
0.12.40/vendor/bundle/ruby/2.3.0/gems/cool.io-1.5.1/ext/cool.io
/usr/bin/ruby2.3 -r ./siteconf20170928-2385-ss02z5.rb extconf.rb
checking for rb_thread_blocking_region()... no
...
checking for sys/event.h... no
checking for port.h... no
checking for sys/resource.h... yes
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which 
can be found here:

/var/lib/gems/2.3.0/gems/fluentd-
0.12.40/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/cool.io-
1.5.1/mkmf.log

...

Make sure that `gem install cool.io -v '1.5.1'` succeeds before bundling.
An error occurred while installing cool.io (1.5.1), and Bundler cannot 
continue.

在mkmf.log中,第一个(但不仅仅是)错误是:

conftest.c:13:57: error: ‘rb_thread_blocking_region’ undeclared (first use 
in this function)
int t(void) { void ((*volatile p)()); p = (void ((*)
()))rb_thread_blocking_region; return !p; }

如果我在控制台中输入'gem list',它会显示parallel_tests(2.7.1)和cool.io(1.5.1),所以我不明白为什么会出现这些错误。

我也看到了这个链接https://github.com/phusion/passenger/issues/1314。使用动态libraby而不是静态libraby编译Ruby可以解决问题。但是,既然我安装了Ruby,我就不需要编译它,对吧?

操作系统是Ubuntu 16.04,Ruby版本是2.3.1,FluentD版本是0.12.40。

感谢您的帮助!

0 个答案:

没有答案
相关问题