vagrant で環境構築後、CentOS6 上で rails new
を実行するとエラーが発生します。
rails new ディレクトリ名
以下エラーメッセージ
create
create README.md
create Rakefile
create .ruby-version
create config.ru
create .gitignore
create Gemfile
run git init from "."
Initialized empty Git repository in /home/vagrant/railslessons/mytest/.git/
create package.json
create app
create app/assets/config/manifest.js
create app/assets/stylesheets/application.css
create app/channels/application_cable/channel.rb
create app/channels/application_cable/connection.rb
create app/controllers/application_controller.rb
create app/helpers/application_helper.rb
create app/javascript/channels/consumer.js
create app/javascript/channels/index.js
create app/javascript/packs/application.js
create app/jobs/application_job.rb
create app/mailers/application_mailer.rb
create app/models/application_record.rb
create app/views/layouts/application.html.erb
create app/views/layouts/mailer.html.erb
create app/views/layouts/mailer.text.erb
create app/assets/images
create app/assets/images/.keep
create app/controllers/concerns/.keep
create app/models/concerns/.keep
create bin
create bin/rails
create bin/rake
create bin/setup
create bin/yarn
create config
create config/routes.rb
create config/application.rb
create config/environment.rb
create config/cable.yml
create config/puma.rb
create config/spring.rb
create config/storage.yml
create config/environments
create config/environments/development.rb
create config/environments/production.rb
create config/environments/test.rb
create config/initializers
create config/initializers/application_controller_renderer.rb
create config/initializers/assets.rb
create config/initializers/backtrace_silencers.rb
create config/initializers/content_security_policy.rb
create config/initializers/cookies_serializer.rb
create config/initializers/cors.rb
create config/initializers/filter_parameter_logging.rb
create config/initializers/inflections.rb
create config/initializers/mime_types.rb
create config/initializers/new_framework_defaults_6_0.rb
create config/initializers/wrap_parameters.rb
create config/locales
create config/locales/en.yml
create config/master.key
append .gitignore
create config/boot.rb
create config/database.yml
create db
create db/seeds.rb
create lib
create lib/tasks
create lib/tasks/.keep
create lib/assets
create lib/assets/.keep
create log
create log/.keep
create public
create public/404.html
create public/422.html
create public/500.html
create public/apple-touch-icon-precomposed.png
create public/apple-touch-icon.png
create public/favicon.ico
create public/robots.txt
create tmp
create tmp/.keep
create tmp/pids
create tmp/pids/.keep
create tmp/cache
create tmp/cache/assets
create vendor
create vendor/.keep
create test/fixtures
create test/fixtures/.keep
create test/fixtures/files
create test/fixtures/files/.keep
create test/controllers
create test/controllers/.keep
create test/mailers
create test/mailers/.keep
create test/models
create test/models/.keep
create test/helpers
create test/helpers/.keep
create test/integration
create test/integration/.keep
create test/channels/application_cable/connection_test.rb
create test/test_helper.rb
create test/system
create test/system/.keep
create test/application_system_test_case.rb
create storage
create storage/.keep
create tmp/storage
create tmp/storage/.keep
remove config/initializers/cors.rb
remove config/initializers/new_framework_defaults_6_0.rb
run bundle install
The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
Fetching gem metadata from https://rubygems.org/............
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 13.0.1
Using concurrent-ruby 1.1.7
Using i18n 1.8.5
Using minitest 5.14.1
Using thread_safe 0.3.6
Using tzinfo 1.2.7
Using zeitwerk 2.4.0
Using activesupport 6.0.3.2
Using builder 3.2.4
Using erubi 1.9.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.10
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Using loofah 2.7.0
Using rails-html-sanitizer 1.3.0
Using actionview 6.0.3.2
Using rack 2.2.3
Using rack-test 1.1.0
Using actionpack 6.0.3.2
Using nio4r 2.5.2
Using websocket-extensions 0.1.5
Using websocket-driver 0.7.3
Using actioncable 6.0.3.2
Using globalid 0.4.2
Using activejob 6.0.3.2
Using activemodel 6.0.3.2
Using activerecord 6.0.3.2
Using mimemagic 0.3.5
Using marcel 0.3.3
Using activestorage 6.0.3.2
Using mini_mime 1.0.2
Using mail 2.7.1
Using actionmailbox 6.0.3.2
Using actionmailer 6.0.3.2
Using actiontext 6.0.3.2
Using public_suffix 4.0.5
Using addressable 2.7.0
Using bindex 0.8.1
Using msgpack 1.3.3
Using bootsnap 1.4.8
Using bundler 1.17.2
Using byebug 11.1.3
Using regexp_parser 1.7.1
Using xpath 3.2.0
Using capybara 3.33.0
Using childprocess 3.0.0
Using ffi 1.13.1
Using jbuilder 2.10.0
Using rb-fsevent 0.10.4
Using rb-inotify 0.10.1
Using listen 3.2.1
Using method_source 1.0.0
Using puma 4.3.5
Using rack-proxy 0.6.5
Using thor 1.0.1
Using railties 6.0.3.2
Using sprockets 4.0.2
Using sprockets-rails 3.2.1
Using rails 6.0.3.2
Using rubyzip 2.3.0
Fetching sassc 2.4.0
Installing sassc 2.4.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.4.0/ext
/home/vagrant/.rbenv/versions/2.6.5/bin/ruby -I
/home/vagrant/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r
./siteconf20200827-7966-4bspp5.rb extconf.rb
creating Makefile
current directory:
/home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.4.0/ext
make "DESTDIR=" clean
current directory:
/home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.4.0/ext
make "DESTDIR="
compiling ./libsass/src/ast.cpp
cc1plus: error: unrecognized command line option "-std=c++11"
make: *** [ast.o] エラー 1
make failed, exit code 2
Gem files will remain installed in
/home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.4.0 for
inspection.
Results logged to
/home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/sassc-2.4.0/gem_make.out
An error occurred while installing sassc (2.4.0), and Bundler cannot
continue.
Make sure that `gem install sassc -v '2.4.0' --source 'https://rubygems.org/'`
succeeds before bundling.
In Gemfile:
sass-rails was resolved to 6.0.0, which depends on
sassc-rails was resolved to 2.1.2, which depends on
sassc
run bundle binstubs bundler
Could not find gem 'sqlite3 (~> 1.4)' in any of the gem sources listed in your
Gemfile.
run bundle exec spring binstub --all
bundler: command not found: spring
Install missing gem executables with `bundle install`
rails webpacker:install
Could not find gem 'sqlite3 (~> 1.4)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
エラー内容の通り
gem install sassc -v '2.4.0' --source 'https://rubygems.org/'
を実行すると
Building native extensions. This could take a while...
ERROR: Error installing sassc:
ERROR: Failed to build gem native extension.
current directory: /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.4.0/ext
/home/vagrant/.rbenv/versions/2.6.5/bin/ruby -I /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20200827-8009-1scbkg5.rb extconf.rb
creating Makefile
current directory: /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.4.0/ext
make "DESTDIR=" clean
current directory: /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.4.0/ext
make "DESTDIR="
compiling ./libsass/src/ast.cpp
cc1plus: error: unrecognized command line option "-std=c++11"
make: *** [ast.o] エラー 1
make failed, exit code 2
Gem files will remain installed in /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sassc-2.4.0 for inspection.
Results logged to /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/sassc-2.4.0/gem_make.out
以上のエラーが発生します。
railsでサーバーが立ち上がらず、sassc でエラーが出る: cc1plus: error: unrecognized command line option “-std=c++11”
この質問の回答を参考に、
cc1plus: error: unrecognized command line option "-std=c++11"
が主原因(C++コンパイラの導入失敗かバージョンが古い)のではないかとのことで
XcodeのCommand Line Toolsをインストールをしてclang++ を更新しようとしましたが、
インストール しても clang++ --version
が実行できず、
-bash: clang++: コマンドが見つかりません
とでてしまいます。
補足
- CentOS release 6.10 (Final)
- Rails 6.0.3.2