Gem:::Ext::BuildError: ERROR:未能构建Gem本机扩展。Archlinux

时间:2021-03-02 00:19:04

I'm trying to run jekyll locally on my laptop. I followed the guide of Github to do that, https://help.github.com/articles/using-jekyll-with-pages Unfortunaly I'm stuck when I have typed $bundle install I get the following error:

我想在我的笔记本电脑上运行jekyll。我按照Github的指南去做,https://help.github.com/articles/using-jekyll-withpages不幸的是,当我输入$bundle install时,我遇到了以下错误:

Fetching gem metadata from https://rubygems.org/.........Failed to load /etc/gemrc due to permissions problem.
Resolving dependencies...

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/usr/bin/ruby extconf.rb 
checking for main() in -lc... *** 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
--with-redcloth_scan-dir
--without-redcloth_scan-dir
--with-redcloth_scan-include
--without-redcloth_scan-include=${redcloth_scan-dir}/include
--with-redcloth_scan-lib
--without-redcloth_scan-lib=${redcloth_scan-dir}/lib
--with-clib
--without-clib
 /usr/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an         executable file. (RuntimeError)
You have to install development tools first.
from /usr/lib/ruby/2.1.0/mkmf.rb:541:in `try_link0'
from /usr/lib/ruby/2.1.0/mkmf.rb:556:in `try_link'
from /usr/lib/ruby/2.1.0/mkmf.rb:742:in `try_func'
from /usr/lib/ruby/2.1.0/mkmf.rb:973:in `block in have_library'
from /usr/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /usr/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /usr/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /usr/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /usr/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /usr/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /usr/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /usr/lib/ruby/2.1.0/mkmf.rb:968:in `have_library'
from extconf.rb:5:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /tmp/bundler20140903-2231-pkzqqj/RedCloth-4.2.9/gems /RedCloth-4.2.9 for inspection.
Results logged to /tmp/bundler20140903-2231-pkzqqj/RedCloth-4.2.9/extensions/x86_64-linux/2.1.0/RedCloth-4.2.9/gem_make.out
An error occurred while installing RedCloth (4.2.9), and Bundler cannot
continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.

I tryed to install ruby multiple times but it's not solving my problem. Do you have any hints?

我曾多次尝试安装ruby,但这并不能解决我的问题。你有什么提示吗?

3 个解决方案

#1


5  

I had this problem on MacOS and it was fixed by agreeing to the Xcode License. I had recently updated Xcode and it turns out that I needed to re-agree to the license in order to use the command line tools successfully.

我在MacOS上遇到了这个问题,通过同意Xcode许可协议解决了这个问题。我最近更新了Xcode,结果发现我需要重新同意许可才能成功地使用命令行工具。

Just run:

运行:

xcodebuild -license

#2


1  

This worked for me:

这工作对我来说:

bundle config build.nokogiri --use-system-libraries
bundle install

#3


0  

brew install qt

then

然后

gem install RedCloth -v '4.2.9'

then

然后

bundle install

#1


5  

I had this problem on MacOS and it was fixed by agreeing to the Xcode License. I had recently updated Xcode and it turns out that I needed to re-agree to the license in order to use the command line tools successfully.

我在MacOS上遇到了这个问题,通过同意Xcode许可协议解决了这个问题。我最近更新了Xcode,结果发现我需要重新同意许可才能成功地使用命令行工具。

Just run:

运行:

xcodebuild -license

#2


1  

This worked for me:

这工作对我来说:

bundle config build.nokogiri --use-system-libraries
bundle install

#3


0  

brew install qt

then

然后

gem install RedCloth -v '4.2.9'

then

然后

bundle install