提问人:Abhijith Ea 提问时间:11/13/2023 最后编辑:Abhijith Ea 更新时间:11/15/2023 访问量:466
在 Gemfile 中安装具有本机扩展的 unf_ext (0.0.9) 时出错
Error installing unf_ext (0.0.9) with native extensions in Gemfile
问:
我在使用以下 Gemfile 运行 Ruby 项目时遇到了问题:bundle install
ruby '2.3.1'
source 'http://www.rubygems.org'
gem 'aws-flow', '~> 2.4.0'
gem 'aws-sdk-core', '~> 3.65', '>= 3.65.1'
gem 'aws-sdk', '~> 3.0', '>= 3.0.1'
gem 'nokogiri', '~> 1.10.10'
gem 'activerecord', '~> 5.2', '>= 5.2.3'
gem 'sqlite3', '~> 1.3', '= 1.3.9'
gem 'rubyzip', '~> 1.2', '>= 1.2.3'
gem 'mechanize', '~> 2.7', '>= 2.7.5'
gem 'slack-notifier', '~> 1.5', '>= 1.5.1'
gem 'minitest', '~> 5.8.4'
gem 'connection_pool', '~> 2.2.5'
gem 'httparty', '~> 0.19.1'
gem 'webrick', '~> 1.7.0'
gem 'net-http-persistent', '= 4.0.1'
在安装 gem 期间发生错误,并显示以下消息:unf_ext
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.
Fetching gem metadata from http://www.rubygems.org/
Fetching version metadata from http://www.rubygems.org/
Fetching dependency metadata from http://www.rubygems.org/
Resolving dependencies..............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Using concurrent-ruby 1.2.2
Using minitest 5.8.5
Using thread_safe 0.3.6
Using arel 9.0.0
Using aws-eventstream 1.2.0
Using json 1.8.6
Using mini_portile2 2.4.0
Using lru_redux 0.8.4
Using aws-partitions 1.848.0
Using jmespath 1.6.2
Using aws-sigv2 1.1.0
Using connection_pool 2.2.5
Installing unf_ext 0.0.9 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.9/ext/unf_ext
/opt/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20231113-2866-7e5i1z.rb extconf.rb
checking for main() in -lstdc++... yes
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/unf_ext-0.0.9/mkmf.log
current directory: /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.9/ext/unf_ext
make "DESTDIR=" clean
current directory: /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.9/ext/unf_ext
make "DESTDIR="
compiling unf.cc
cc1plus: warning: command line option ‘-Wdeclaration-after-statement’ is valid for C/ObjC but not for C++ [enabled by default]
cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++ [enabled by default]
unf.cc:39:3: sorry, unimplemented: non-trivial designated initializers not supported
};
^
unf.cc:39:3: sorry, unimplemented: non-trivial designated initializers not supported
make: *** [unf.o] Error 1
make failed, exit code 2
Gem files will remain installed in /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/unf_ext-0.0.9 for inspection.
Results logged to /opt/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/unf_ext-0.0.9/gem_make.out
Using mime-types-data 3.2023.1003
Using multi_xml 0.6.0
Using net-http-digest_auth 1.4.1
Using ntlm-http 0.1.1
Using webrick 1.7.0
Using webrobots 0.1.2
Using rubyzip 1.3.0
Using slack-notifier 1.5.1
Using sqlite3 1.3.9
Using bundler 1.12.1
Using i18n 1.14.1
Using tzinfo 1.2.11
Using aws-sigv4 1.6.1
Using nokogiri 1.10.10
Using net-http-persistent 4.0.1
An error occurred while installing unf_ext (0.0.9), and Bundler cannot continue.
Make sure that `gem install unf_ext -v '0.0.9'` succeeds before bundling.
我已经按照建议检查了 mkmf.log 文件,但我无法确定安装宝石的原因以及可能导致此编译错误的原因。我没有明确包含在我的 Gemfile 中,它似乎是另一个 gem 的依赖项。unf_ext
unf_ext
有关如何解决此问题的任何指导或对安装原因的见解将不胜感激。此外,是否有特定版本的宝石需要调整?unf_ext
答:
0赞
Clintm
11/15/2023
#1
现在的解决方法是将其添加到您的 Gemfile 中,暂时固定旧版本,直到此票证的修复程序可用。https://github.com/knu/ruby-unf_ext/issues/74
gem 'unf_ext', '= 0.0.8'
评论
unf-ext 0.0.8
gem 'unf_ext', '~> 0.0.8'
~> 0.0.8
>= 0.0.8, < 0.1
= 0.0.8