【问题标题】:gem install ffi-yajl causes `undefined method include_path` errorgem install ffi-yajl 导致“未定义的方法 include_path”错误
【发布时间】:2021-09-11 14:26:32
【问题描述】:

我在尝试安装 ffi-yajl 时遇到以下错误

Using berkshelf 4.3.3
Installing ffi-yajl 2.4.0 with native extensions
STDERR: Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/var/lib/gems/2.5.0/gems/ffi-yajl-2.4.0/ext/ffi_yajl/ext/encoder
/usr/bin/ruby2.5 -r ./siteconf20210628-15489-1ggpxn5.rb extconf.rb
*** 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=/usr/bin/$(RUBY_BASE_NAME)2.5
extconf.rb:9:in <main>': undefined method include_path' for Libyajl2:Module
(NoMethodError)
Did you mean? include

extconf failed, exit code 1

似乎是这条线失败了:

https://github.com/chef/ffi-yajl/blob/master/ext/ffi_yajl/ext/encoder/extconf.rb#L9

不幸的是,我对 Ruby 的了解非常有限,我不知道是否应该定义 'include_path' 以及是否应该定义它的原因。

谢谢

【问题讨论】:

  • 你的操作系统是什么?,根据错误似乎你需要安装C编译器,检查你是否有gcc。该库是用 C 编写的 lloyd.github.io/yajl
  • 我在树莓派上的 Debian Buster 上运行它。我很确定我有 gcc,但会检查。

标签: ruby bundler


【解决方案1】:

这应该对您有所帮助。 步骤如下:

  1. sudo apt remove ruby​​
  2. 安装红宝石https://tecadmin.net/install-ruby-latest-stable-centos/#
  3. 再次尝试 gem 安装

来源:https://github.com/chef/ffi-yajl/issues/91

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-01
    • 2012-05-21
    • 1970-01-01
    • 2012-10-28
    相关资源
    最近更新 更多