sassc-ruby
sassc-ruby copied to clipboard
Rails 6: compiling error
Unable to update gem file using rails 6.0.0.rc2 to 6.0.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/xxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sassc-2.2.0/ext
/home/xxx/.rbenv/versions/2.6.3/bin/ruby -I /home/xxx/.rbenv/versions/2.6.3/lib/ruby/2.6.0 -r ./siteconf20190908-29341-3apbo8.rb extconf.rb
creating Makefile
current directory: /home/xxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sassc-2.2.0/ext
make "DESTDIR=" clean
current directory: /home/xxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sassc-2.2.0/ext
make "DESTDIR="
compiling ./libsass/src/expand.cpp
In file included from ./libsass/src/ast.hpp:19:0,
from ./libsass/src/expand.cpp:8:
./libsass/src/util.hpp: In function 'T Sass::absmod(const T&, const T&)':
./libsass/src/util.hpp:28:11: error: 'fmod' is not a member of 'std'
T m = std::fmod(n, r);
^
./libsass/src/util.hpp:28:11: note: suggested alternative:
In file included from /usr/include/features.h:424:0,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_4/include/c++/5.5.0/x86_64-unknown-linux-gnu/bits/os_defines.h:39,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_4/include/c++/5.5.0/x86_64-unknown-linux-gnu/bits/c++config.h:489,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/5.5.0_4/include/c++/5.5.0/string:38,
from ./libsass/src/sass.hpp:55,
from ./libsass/src/expand.cpp:3:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:168:1: note: 'fmod'
__MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
^
Makefile:235: recipe for target 'expand.o' failed
make: *** [expand.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/xxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sassc-2.2.0 for inspection.
Results logged to /home/xxx/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0-static/sassc-2.2.0/gem_make.out
An error occurred while installing sassc (2.2.0), and Bundler cannot continue.
Make sure that `gem install sassc -v '2.2.0' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
bootstrap was resolved to 4.3.1, which depends on
sassc-rails was resolved to 2.1.2, which depends on
sassc
I've got the same situation! I was fighting for several days, but haven't solve it yet! Just felt back to bootstrap 4.0.0, which doesn't use sassc ... But it's risky to use the outdated version of bootstrap gem... ((((
@ForeverYoung1208 I tried revert it back to version 2.1.0 for temporary fix until issue resolved and patched in release.
In Gemfile, try to add sassc with version
gem 'sassc', '~> 2.1.0'
and in terminal, run
bundle update sassc
to update Gemfile.lock
and run again
bundle
I was using debian jessie and had issues with compiling sassc 2.1.0 / 2.2.0 (raspberry pi arch). The problem was old gcc version (4.9.2). Changing docker image to debian strech with gcc 6+ solved the problem.
@ForeverYoung1208 I tried revert it back to version 2.1.0 for temporary fix until issue resolved and patched in release.
In
Gemfile, try to addsasscwith versiongem 'sassc', '~> 2.1.0'
Thanks for the Help, this solved an error in my app
I feel like i had an issue of similar nature that got solved by
@ForeverYoung1208 I tried revert it back to version 2.1.0 for temporary fix until issue resolved and patched in release.
In
Gemfile, try to addsasscwith versiongem 'sassc', '~> 2.1.0'and in terminal, run
bundle update sasscto update
Gemfile.lockand run againbundle
This too solved my issue, although the error I got was not the same:
Building native extensions. This could take a while...
ERROR: Error installing sassc:
ERROR: Failed to build gem native extension.
current directory: /usr/local/rvm/gems/ruby-2.6.3/gems/sassc-2.2.1/ext
/usr/local/rvm/rubies/ruby-2.6.3/bin/ruby -I /usr/local/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0 -r ./siteconf20200306-8736-6yh1v3.rb extconf.rb
creating Makefile
current directory: /usr/local/rvm/gems/ruby-2.6.3/gems/sassc-2.2.1/ext
make "DESTDIR=" clean
current directory: /usr/local/rvm/gems/ruby-2.6.3/gems/sassc-2.2.1/ext
make "DESTDIR="
compiling ./libsass/src/ast_sel_cmp.cpp
compiling ./libsass/src/fn_maps.cpp
compiling ./libsass/src/ast_sel_unify.cpp
Assembler messages:
Fatal error: can't create ast_sel_unify.o: No such file or directory
Makefile:235: recipe for target 'ast_sel_unify.o' failed
make: *** [ast_sel_unify.o] Error 1
make failed, exit code 2
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.6.3/gems/sassc-2.2.1 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.6.3/extensions/x86_64-linux/2.6.0/sassc-2.2.1/gem_make.out```
I had the same diagnostic but a different cause. I'm commenting in case it helps others searching.
In fact it was an out of memory error in an EC2 instance under Elastic Beanstalk. I do not know why a deployment step includes bundle install but this is apparently just how EB rolls (I do not under any circumstances recommend this product):
compiling ./libsass/src/parser.cpp
virtual memory exhausted: Cannot allocate memory
make: *** [parser.o] Error 1
make failed, exit code 2
Gem files will remain installed in
/var/app/staging/vendor/bundle/ruby/2.7.0/gems/sassc-2.4.0 for inspection.
Results logged to
/var/app/staging/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/sassc-2.4.0/gem_make.out
/opt/rubies/ruby-2.7.6/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:95:in
`run'
... SNIP ...
/opt/rubies/ruby-2.7.6/lib/ruby/gems/2.7.0/gems/bundler-2.3.15/exe/bundle:36:in
`<top (required)>'
/opt/elasticbeanstalk/.rbenv/versions/2.7.6/bin/bundle:25:in `load'
/opt/elasticbeanstalk/.rbenv/versions/2.7.6/bin/bundle:25:in `<main>'
An error occurred while installing sassc (2.4.0), and Bundler cannot continue.
In Gemfile:
bootstrap-sass was resolved to 3.4.1, which depends on
sassc
@toby5box how much free memory do you have?
disabling LTO could save some memory for very memory-constrained environments (no promises)
bundle config build.sassc --disable-lto
shipping pre-build binaries would be an ultimate solution, but I don't expect any progress here, because the gem is pretty abandoned for years.
@ahorek That's a great suggestion. I monitored free memory during the build; it's a 1GB instance and it definitely easily runs out of memory during g++ etc. Unclear if it's LTO; compiles themselves are very memory hungry.
My first resort is trying to forestall the build by passing in a prebuilt vendor from the CodeBuild phase, but I am not sure if this will work with the EB environment yet. Clearly it's almost never correct to do native builds in the deployed environment for many reasons so I hope it can be avoided.
1GB is definitely too low. Most operating systems eat 1GB just for themselves. Building the binary on a different (but compatible) system and shipping it via vendor could in theory work, but I didn't test it.
Of course, and it's ridiculous EB is designed this way. People have attempted to work around this and I'll be attempting the last recommendation here https://github.com/aws/elastic-beanstalk-roadmap/issues/139
Update This workaround seems to have worked, added details here: https://github.com/aws/elastic-beanstalk-roadmap/issues/139#issuecomment-1168976784
or switch to https://github.com/ntkme/sass-embedded-host-ruby if your project allows it.