0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Railsのsass-railsインストール時にg++エラーが出る

Posted at

railsでsass-railsというgemをインストールする際、エラーが発生したので解決方法を残しておきます

環境

  • Amazon Linux 2
  • rails5.2.6

エラーの内容

どうやら依存しているsassというgemのインストール時にg++コマンドがなくてエラーになっている

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

    current directory: /root/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sassc-2.4.0/ext
/root/.rbenv/versions/2.6.1/bin/ruby -I /root/.rbenv/versions/2.6.1/lib/ruby/2.6.0 -r ./siteconf20210614-11958-gcrsst.rb extconf.rb
creating Makefile

current directory: /root/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sassc-2.4.0/ext
make "DESTDIR=" clean

current directory: /root/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sassc-2.4.0/ext
make "DESTDIR="
compiling ./libsass/src/ast.cpp
make: g++: コマンドが見つかりませんでした
make: *** [ast.o] エラー 127

make failed, exit code 2

Gem files will remain installed in /root/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/sassc-2.4.0 for inspection.
Results logged to /root/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0-static/sassc-2.4.0/gem_make.out

解決方法

  • yum install -y gcc-c++を実行
  • g++ --versionで確認

おまけ

  • gccとは「GNU Compiler Collection」の略でGNUが開発しているコンパイラ群のこと
  • g++とは、gccの中のc++コンパイラのこと
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?