安装失败 install racc -v '1.6.0'

问题描述 投票:0回答:1

我正在尝试使用 Ruby 2.7.5p203 在 Alpine 3.13 中安装 racc gem v1.6.0。 但抛出以下错误:

Building native extensions. This could take a while...
ERROR:  Error installing racc:
    ERROR: Failed to build gem native extension.

    current directory: /usr/local/bundle/gems/racc-1.6.0/ext/racc/cparse
/usr/local/bin/ruby -I /usr/local/lib/ruby/2.7.0 -r ./siteconf20220617-518-10udcz7.rb extconf.rb
checking for rb_block_call()... *** 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/local/bin/$(RUBY_BASE_NAME)
/usr/local/lib/ruby/2.7.0/mkmf.rb:471:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/local/lib/ruby/2.7.0/mkmf.rb:564:in `try_link0'
    from /usr/local/lib/ruby/2.7.0/mkmf.rb:582:in `try_link'
    from /usr/local/lib/ruby/2.7.0/mkmf.rb:794:in `try_func'
    from /usr/local/lib/ruby/2.7.0/mkmf.rb:1083:in `block in have_func'
    from /usr/local/lib/ruby/2.7.0/mkmf.rb:971:in `block in checking_for'
    from /usr/local/lib/ruby/2.7.0/mkmf.rb:361:in `block (2 levels) in postpone'
    from /usr/local/lib/ruby/2.7.0/mkmf.rb:331:in `open'
    from /usr/local/lib/ruby/2.7.0/mkmf.rb:361:in `block in postpone'
    from /usr/local/lib/ruby/2.7.0/mkmf.rb:331:in `open'
    from /usr/local/lib/ruby/2.7.0/mkmf.rb:357:in `postpone'
    from /usr/local/lib/ruby/2.7.0/mkmf.rb:970:in `checking_for'
    from /usr/local/lib/ruby/2.7.0/mkmf.rb:1082:in `have_func'
    from extconf.rb:6:in `<main>'

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

  /usr/local/bundle/extensions/x86_64-linux-musl/2.7.0/racc-1.6.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/bundle/gems/racc-1.6.0 for inspection.
Results logged to /usr/local/bundle/extensions/x86_64-linux-musl/2.7.0/racc-1.6.0/gem_make.out

这是上面指出的日志文件的内容:

"gcc -o conftest -I/usr/local/include/ruby-2.7.0/x86_64-linux-musl -I/usr/local/include/ruby-2.7.0/ruby/backward -I/usr/local/include/ruby-2.7.0 -I.    -g -O2 -fPIC conftest.c  -L. -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic     -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lruby  -lm   -lc"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

尝试更新 Gemfile 中的任何 gem 时也会发生该错误。

ruby-on-rails ruby rubygems ruby-on-rails-5
1个回答
0
投票

您需要安装构建基础包。

apk add -y build-base
安装racc之前

© www.soinside.com 2019 - 2024. All rights reserved.