gpt4 book ai didi

ruby - 安装 unf_ext 时出错

转载 作者:行者123 更新时间:2023-12-05 05:19:20 30 4
gpt4 key购买 nike

我昨天安装了 MacOS High Sierra,我正在测试我的 ruby​​ 代码,但由于我的一个 gem 没有安装,所以它失败了。我今天尝试安装它并得到了它:

Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/.
Using bundler 1.15.4
Fetching unf_ext 0.0.7.4


Your user account isn't allowed to install to the system RubyGems.
You can cancel this installation and run:

bundle install --path vendor/bundle

to install the gems into ./vendor/bundle/, or you can enter your password
and install the bundled gems to RubyGems using sudo.

Password:
Installing unf_ext 0.0.7.4 with native extensions
Using mime-types-data 3.2016.0521
Using net-http-digest_auth 1.4.1
Using net-http-persistent 2.9.4
Using mini_portile2 2.1.0
Using ntlm-http 0.1.1
Using webrobots 0.1.2
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/private/var/folders/lq/mdp176gx3b90j7_mvygpydmr0000gn/T/bundler20170927-4407-1gh3fizunf_ext-0.0.7.4/gems/unf_ext-0.0.7.4/ext/unf_ext
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r
./siteconf20170927-4407-1twnwgt.rb extconf.rb
checking for main() in -lstdc++... *** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME)
--with-static-libstdc++
--without-static-libstdc++
--with-stdc++lib
--without-stdc++lib
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:456:in
`try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:535:in
`block in try_link0'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tmpdir.rb:89:in
`mktmpdir'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:532:in
`try_link0'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:556:in
`try_link'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:765:in
`try_func'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:997:in
`block in have_library'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:942:in
`block in checking_for'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:350:in
`block (2 levels) in postpone'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:320:in
`open'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:350:in
`block in postpone'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:320:in
`open'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:346:in
`postpone'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:941:in
`checking_for'
from
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:992:in
`have_library'
from extconf.rb:6:in `<main>'

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

/var/folders/lq/mdp176gx3b90j7_mvygpydmr0000gn/T/bundler20170927-4407-1gh3fizunf_ext-0.0.7.4/extensions/universal-darwin-17/2.3.0/unf_ext-0.0.7.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in
/var/folders/lq/mdp176gx3b90j7_mvygpydmr0000gn/T/bundler20170927-4407-1gh3fizunf_ext-0.0.7.4/gems/unf_ext-0.0.7.4
for inspection.
Results logged to
/var/folders/lq/mdp176gx3b90j7_mvygpydmr0000gn/T/bundler20170927-4407-1gh3fizunf_ext-0.0.7.4/extensions/universal-darwin-17/2.3.0/unf_ext-0.0.7.4/gem_make.out

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

In Gemfile:
mechanize was resolved to 2.7.5, which depends on
http-cookie was resolved to 1.0.3, which depends on
domain_name was resolved to 0.5.20170404, which depends on
unf was resolved to 0.1.4, which depends on
unf_ext

然后当我尝试安装 unf_ext 时发生了这种情况

sudo gem install unf_ext -v '0.0.7.4'
Building native extensions. This could take a while...
ERROR: Error installing unf_ext:
ERROR: Failed to build gem native extension.

current directory: /Library/Ruby/Gems/2.3.0/gems/unf_ext-0.0.7.4/ext/unf_ext
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20170927-4629-13u5zrr.rb extconf.rb
checking for main() in -lstdc++... *** 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=/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/$(RUBY_BASE_NAME)
--with-static-libstdc++
--without-static-libstdc++
--with-stdc++lib
--without-stdc++lib
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:535:in `block in try_link0'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/tmpdir.rb:89:in `mktmpdir'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:532:in `try_link0'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:556:in `try_link'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:765:in `try_func'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:997:in `block in have_library'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:942:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:350:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:350:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:320:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:346:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:941:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/mkmf.rb:992:in `have_library'
from extconf.rb:6:in `<main>'

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

/Library/Ruby/Gems/2.3.0/extensions/universal-darwin-17/2.3.0/unf_ext-0.0.7.4/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/unf_ext-0.0.7.4 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-17/2.3.0/unf_ext-0.0.7.4/gem_make.out

我不知道问题是什么。我安装了 ruby​​ 和 rbenv,但是一旦我安装了新的 MacOs,我就无法安装任何 gem。

最佳答案

我将“extconf.rb”复制到我的工作文件夹并再次运行“ruby extconf.rb”,得到一个 mkmf.log,原来它是一个丢失的“ruby/config.h”。然后问题被“xcode-select --install”解决了。见:

macOS Mojave 'ruby/config.h' file not found

我的机器运行 10.13.6 macOS High Sierra。

关于ruby - 安装 unf_ext 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46453845/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com