前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >CentOS 7 安装ror出现的问题

CentOS 7 安装ror出现的问题

作者头像
天地一小儒
发布2022-12-28 14:40:26
6410
发布2022-12-28 14:40:26
举报
文章被收录于专栏:信且诚心之动
  1. bundle install 执行时出现错误:
代码语言:javascript
复制
$ bundle install
...
...
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.7.0/gems/sassc-2.4.0/ext
/usr/local/bin/ruby -I /usr/local/lib/ruby/2.7.0 -r
./siteconf20200902-61293-x9nl2q.rb extconf.rb
creating Makefile

current directory: /usr/local/lib/ruby/gems/2.7.0/gems/sassc-2.4.0/ext
make "DESTDIR=" clean

current directory: /usr/local/lib/ruby/gems/2.7.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
/usr/local/lib/ruby/gems/2.7.0/gems/sassc-2.4.0 for inspection.
Results logged to
/usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0-static/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

看提示,需要执行 gem install sassc -v '2.4.0' --source 'https://rubygems.org/'

  1. gem install sassc -v '2.4.0' --source 'https://rubygems.org/'

执行时出现错误:

代码语言:javascript
复制
$ 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: /usr/local/lib/ruby/gems/2.7.0/gems/sassc-2.4.0/ext
/usr/local/bin/ruby -I /usr/local/lib/ruby/2.7.0 -r ./siteconf20200902-61353-1tfcwms.rb extconf.rb
creating Makefile

current directory: /usr/local/lib/ruby/gems/2.7.0/gems/sassc-2.4.0/ext
make "DESTDIR=" clean

current directory: /usr/local/lib/ruby/gems/2.7.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 /usr/local/lib/ruby/gems/2.7.0/gems/sassc-2.4.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0-static/sassc-2.4.0/gem_make.out

解决方法:sudo yum group install "Development Tools" 该命令安装了一堆新的软件包,包括gcc,g++和make

再次执行:

代码语言:javascript
复制
$ gem install sassc -v '2.4.0' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
Successfully installed sassc-2.4.0
Parsing documentation for sassc-2.4.0
Installing ri documentation for sassc-2.4.0
Done installing documentation for sassc after 0 seconds
1 gem installed

通过!

  1. bundle install时提示sqlite有点问题,于是执行gem install sqlite3 -v '1.4.2' --source 'https://rubygems.org/'
代码语言:javascript
复制
$ gem install sqlite3 -v '1.4.2' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
ERROR:  Error installing sqlite3:
    ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.7.0/gems/sqlite3-1.4.2/ext/sqlite3
/usr/local/bin/ruby -I /usr/local/lib/ruby/2.7.0 -r ./siteconf20200902-92796-gu5dhy.rb extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'brew install sqlite3',
'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
and check your shared library search path (the
location where your sqlite3 shared library is located).
*** 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)
    --with-sqlcipher
    --without-sqlcipher
    --with-sqlite3-config
    --without-sqlite3-config
    --with-pkg-config
    --without-pkg-config
    --with-sqlcipher
    --without-sqlcipher
    --with-sqlite3-dir
    --without-sqlite3-dir
    --with-sqlite3-include
    --without-sqlite3-include=${sqlite3-dir}/include
    --with-sqlite3-lib
    --without-sqlite3-lib=${sqlite3-dir}/lib

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

  /usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0-static/sqlite3-1.4.2/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.7.0/gems/sqlite3-1.4.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0-static/sqlite3-1.4.2/gem_make.out

看提示,sudo yum install sqlite-devel 安装后,重新执行命令,解决。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020-09-02,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档