Ruby on Rails(Arch Linux)のインストール中にエラーが発生しました

Ruby on Rails(Arch Linux)のインストール中にエラーが発生しました

現在、Arch Linux ARMシステムにRuby on Railsをインストールする際に問題があります。しかし、私が使用しようとしているのは、インストールに失敗したRailsだけではありませんgem。以下は、いくつかの追加情報です。

一般的なシステム情報: [alarm@alarm ~]$ uname -a Linux alarm 3.8.11-4-ARCH #1 SMP Sat Oct 22 11:59:55 MDT 2016 armv7l GNU/Linux

ジュエリー出力:

[alarm@alarm ~]$ gem install rails
WARNING:  You don't have /home/alarm/.gem/ruby/2.4.0/bin in your PATH,
      gem executables will not run.
Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    current directory: /home/alarm/.gem/ruby/2.4.0/gems/nokogiri-1.8.0/ext/nokogiri
/usr/bin/ruby -r ./siteconf20170828-1999-1wpxia.rb extconf.rb
checking if the C compiler accepts ... *** 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)
    --help
    --clean
/usr/lib/ruby/2.4.0/mkmf.rb:457:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/lib/ruby/2.4.0/mkmf.rb:572:in `block in try_compile'
    from /usr/lib/ruby/2.4.0/mkmf.rb:523:in `with_werror'
    from /usr/lib/ruby/2.4.0/mkmf.rb:572:in `try_compile'
    from extconf.rb:138:in `nokogiri_try_compile'
    from extconf.rb:162:in `block in add_cflags'
    from /usr/lib/ruby/2.4.0/mkmf.rb:630:in `with_cflags'
    from extconf.rb:161:in `add_cflags'
    from extconf.rb:407:in `<main>'

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

  /home/alarm/.gem/ruby/2.4.0/extensions/armv7l-linux/2.4.0/nokogiri-1.8.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/alarm/.gem/ruby/2.4.0/gems/nokogiri-1.8.0 for inspection.
Results logged to /home/alarm/.gem/ruby/2.4.0/extensions/armv7l-linux/2.4.0/nokogiri-1.8.0/gem_make.out

mkmf.logファイルの内容:

[alarm@alarm ~]$ cat /home/alarm/.gem/ruby/2.4.0/extensions/armv7l-linux/2.4.0/nokogiri-1.8.0/mkmf.log
"gcc -o conftest -I/usr/include/ruby-2.4.0/armv7l-linux-eabihf -I/usr/include/ruby-2.4.0/ruby/backward -I/usr/include/ruby-2.4.0 -I. -D_FORTIFY_SOURCE=2 -D_FILE_OFFSET_BITS=64  -march=armv7-a -mfloat-abi=hard -mfpu=vfpv3-d16 -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -fPIC  conftest.c  -L. -L/usr/lib -L. -Wl,-O1,--sort-common,--as-needed,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic     -lruby  -lpthread -lgmp -ldl -lcrypt -lm   -lc "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

ベストアンサー1

エラーメッセージで手がかりを確認してください。

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 have to install development tools first.

そして:

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

  /home/alarm/.gem/ruby/2.4.0/extensions/armv7l-linux/2.4.0/nokogiri-1.8.0/mkmf.log

したがって、通常、Arch Linuxのライブラリにバンドルされているいくつかのヘッダーファイル(「開発ツール」など)がありません。エラーメッセージで述べたように、このファイルを見ると、/home/alarm/.gem/ruby/2.4.0/extensions/armv7l-linux/2.4.0/nokogiri-1.8.0/mkmf.logビルドプロセスが探しているヘッダーファイルが何であるかがわかり、インストールする必要があるライブラリパッケージを見つけることができます。

おすすめ記事