系统:
在包含对本机扩展的sassc 2.0.0依赖项的Rails应用程序上运行bundle install
会导致编译错误。
Installing sassc 2.0.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: ~/.rvm/gems/ruby-2.5.3@hyrax-app-on-wings-2019-02-01-SDC/gems/sassc-2.0.0/ext
~/.rvm/rubies/ruby-2.5.3/bin/ruby -rrubygems ~/.rvm/gems/ruby-2.5.3@hyrax-app-on-wings-2019-02-01-SDC/gems/rake-12.3.2/exe/rake
RUBYARCHDIR=~/.rvm/gems/ruby-2.5.3@hyrax-app-on-wings-2019-02-01-SDC/extensions/x86_64-darwin-17/2.5.0/sassc-2.0.0
RUBYLIBDIR=~/.rvm/gems/ruby-2.5.3@hyrax-app-on-wings-2019-02-01-SDC/extensions/x86_64-darwin-17/2.5.0/sassc-2.0.0
cd libsass
make lib/libsass.so
mkdir lib
/usr/bin/clang -Wall -O2 -I ~/.rvm/gems/ruby-2.5.3@hyrax-app-on-wings-2019-02-01-SDC/gems/sassc-2.0.0/ext/libsass/include -stdlib=libc++ -fPIC -fPIC -c -o src/cencode.o src/cencode.c
src/cencode.c:50:5: warning: declaration does not declare anything [-Wmissing-declarations]
__attribute__ ((fallthrough));
^
src/cencode.c:64:5: warning: declaration does not declare anything [-Wmissing-declarations]
__attribute__ ((fallthrough));
^
2 warnings generated.
c++ -Wall -O2 -std=c++0x -I ~/.rvm/gems/ruby-2.5.3@hyrax-app-on-wings-2019-02-01-SDC/gems/sassc-2.0.0/ext/libsass/include -stdlib=libc++ -fPIC -fPIC -c -o src/ast.o src/ast.cpp
c++: warning: couldn't understand kern.osversion '17.7.0
c++: error: unrecognized command line option '-stdlib=libc++'
make: *** [src/ast.o] Error 1
rake aborted!
Command failed with status (2): [make lib/libsass.so...]
~/.rvm/gems/ruby-2.5.3@hyrax-app-on-wings-2019-02-01-SDC/gems/sassc-2.0.0/lib/tasks/libsass.rb:31:in `block (2 levels) in <top (required)>'
~/.rvm/gems/ruby-2.5.3@hyrax-app-on-wings-2019-02-01-SDC/gems/sassc-2.0.0/lib/tasks/libsass.rb:13:in `block (3 levels) in <top (required)>'
~/.rvm/gems/ruby-2.5.3@hyrax-app-on-wings-2019-02-01-SDC/gems/sassc-2.0.0/lib/tasks/libsass.rb:12:in `block (2 levels) in <top (required)>'
~/.rvm/gems/ruby-2.5.3@hyrax-app-on-wings-2019-02-01-SDC/gems/rake-12.3.2/exe/rake:27:in `<main>'
Tasks: TOP => lib/libsass.so
(See full trace by running task with --trace)
rake failed, exit code 1
Gem files will remain installed in ~/.rvm/gems/ruby-2.5.3@hyrax-app-on-wings-2019-02-01-SDC/gems/sassc-2.0.0 for inspection.
Results logged to ~/.rvm/gems/ruby-2.5.3@hyrax-app-on-wings-2019-02-01-SDC/extensions/x86_64-darwin-17/2.5.0/sassc-2.0.0/gem_make.out
An error occurred while installing sassc (2.0.0), and Bundler cannot continue.
Make sure that `gem install sassc -v '2.0.0' --source 'https://rubygems.org/'` succeeds before bundling.
关于如何解决的研究
尝试-基于github sassc中的建议
最终,此建议建议与捆绑程序分开进行编译,并解决所有编译错误,然后再次尝试捆绑程序。按照上一个参考文件(build-on-darwin)中的说明进行操作,我可以直接进行构建,但是仍然使用bundler遇到相同的编译器错误。
参考:
答案 0 :(得分:0)
需要更新gcc。我尝试使用Homebrew进行更新,并在/usr/local
中遇到权限错误。
解决方案:
$ sudo chown -R $(whoami) $(brew --prefix)/*
$ brew upgrade gcc
$ bundle install
答案 1 :(得分:-1)
这就解决了:
gem install sassc --version=2.1.0 -- --disable-march-tune-native