sass / sassc-ruby

Use libsass with Ruby!
MIT License
363 stars 157 forks source link

Sassc gem is not installing on Ubuntu 18.04 LTS #204

Open vigneshrams opened 4 years ago

vigneshrams commented 4 years ago

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

current directory: /home/ubuntu/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sassc-2.3.0/ext

/home/ubuntu/.rbenv/versions/2.7.1/bin/ruby -I /home/ubuntu/.rbenv/versions/2.7.1/lib/ruby/2.7.0 -r ./siteconf20200522-11294-c5h69d.rb extconf.rb creating Makefile

current directory: /home/ubuntu/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sassc-2.3.0/ext make "DESTDIR=" clean

current directory: /home/ubuntu/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sassc-2.3.0/ext make "DESTDIR=" compiling ./libsass/src/ast.cpp compiling ./libsass/src/ast2c.cpp compiling ./libsass/src/ast_fwd_decl.cpp compiling ./libsass/src/ast_sel_cmp.cpp compiling ./libsass/src/ast_sel_super.cpp compiling ./libsass/src/ast_sel_unify.cpp compiling ./libsass/src/ast_sel_weave.cpp compiling ./libsass/src/ast_selectors.cpp compiling ./libsass/src/ast_supports.cpp compiling ./libsass/src/ast_values.cpp compiling ./libsass/src/backtrace.cpp compiling ./libsass/src/base64vlq.cpp compiling ./libsass/src/bind.cpp compiling ./libsass/src/c2ast.cpp compiling ./libsass/src/c99func.c compiling ./libsass/src/cencode.c compiling ./libsass/src/check_nesting.cpp compiling ./libsass/src/color_maps.cpp compiling ./libsass/src/constants.cpp compiling ./libsass/src/context.cpp compiling ./libsass/src/cssize.cpp compiling ./libsass/src/emitter.cpp compiling ./libsass/src/environment.cpp compiling ./libsass/src/error_handling.cpp compiling ./libsass/src/eval.cpp compiling ./libsass/src/eval_selectors.cpp compiling ./libsass/src/expand.cpp compiling ./libsass/src/extender.cpp compiling ./libsass/src/extension.cpp compiling ./libsass/src/file.cpp compiling ./libsass/src/fn_colors.cpp compiling ./libsass/src/fn_lists.cpp compiling ./libsass/src/fn_maps.cpp compiling ./libsass/src/fn_miscs.cpp compiling ./libsass/src/fn_numbers.cpp compiling ./libsass/src/fn_selectors.cpp compiling ./libsass/src/fn_strings.cpp compiling ./libsass/src/fn_utils.cpp compiling ./libsass/src/inspect.cpp compiling ./libsass/src/json.cpp compiling ./libsass/src/lexer.cpp compiling ./libsass/src/listize.cpp compiling ./libsass/src/memory/SharedPtr.cpp compiling ./libsass/src/operators.cpp compiling ./libsass/src/output.cpp compiling ./libsass/src/parser.cpp g++: internal compiler error: Killed (program cc1plus) Please submit a full bug report, with preprocessed source if appropriate. See file:///usr/share/doc/gcc-7/README.Bugs for instructions. Makefile:236: recipe for target 'parser.o' failed make: *** [parser.o] Error 4

make failed, exit code 2

Gem files will remain installed in /home/ubuntu/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/gems/sassc-2.3.0 for inspection. Results logged to /home/ubuntu/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.0/sassc-2.3.0/gem_make.out

Please help me with it. ./Thanks

claasz commented 4 years ago

We've experienced similar problems when installing an a server with 0.5GB RAM only. Looks like installation requires at least 1GB of RAM.

g++: internal compiler error: Killed (program cc1plus)

Could be an out-of-memory error.

weili-git commented 4 years ago

Same problem on Ubuntu 18.04 LTS, hope someone could help. Thanks.

weili-git commented 4 years ago

Temporarily, I try to modify the Gemfile and set "gem 'sass-rails', '= 5.1.0'".

ceilingrat commented 4 years ago

I'm having this issue as well.

I'm using Repl.it and the environment is running Ubuntu 18.04.

I've detailed my troubleshooting efforts on a post in the Repl.it support forum: https://repl.it/talk/ask/Package-Installation-failing-on-SASSC/53457

My test environment is available online and the output of bundler can be found here: https://repl.it/@ceilingrat/jekyll-1

arianitu commented 3 years ago

Running into this as well, does anyone know if there is a way to compile sassc without so much memory?

Edit:

Temporary solution is to change your Gemfile.lock to point to saasc 2.1.0 instead of saasc 2.4.0, it seems 2.1.0 has pre-built binaries, but 2.4.0 requires building from source which can take a long time + require a lot of resources (1GB of RAM at least it appears and minutes of compilation time, some people it takes 7+ minutes.)

See https://github.com/sass/sassc-ruby/issues/189

ceilingrat commented 3 years ago

point to saasc 2.1.0 instead of saasc 2.4.0

This sounds like a really great solution.
However, in case anyone really needs the latest version, here's an alternative workaround that I had some success with:

Instead of relying on RubyGems to install the saasc package, I just cloned the saasc git repo. (in my experiments, I forked the repo prior to cloning it to my environment, but I only did so because it was quick using my tools & workflow. I suspect the fork is probably unnecessary. Your mileage may vary.)

ryankopf commented 3 years ago

Seconding this as an ongoing issue.

jathayde commented 3 years ago

Still persisting on a new 18.04 LTS instance on Azure. locking the gem to 2.1 does work.

tekpriest commented 3 years ago

Facing this issue locally on an Arch

KevinTriplett commented 2 years ago

Same issue with x86_64 Debian 11 on a 0.5GB production server (small run app) and sassc 2.4.0 -- bundle is killed while building native extensions.

hegwin commented 1 year ago

I met the same issue on a 18.04 LTS with 1GB memory.

When it's Building native extensions..., I can see the CPU Utilization is just around 15%. Meanwhile, I can't see the memory usage, but I can see the Disk Read BPS is extremely high and Disk Write is almost 0. So is this a thrash?

I tried to lock back to 2.1.0 but then I can't do bundle install in my M1 Mac:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/hegwin/.rvm/gems/ruby-2.7.3/gems/sassc-2.1.0/ext
/Users/hegwin/.rvm/rubies/ruby-2.7.3/bin/ruby -I /Users/hegwin/.rvm/rubies/ruby-2.7.3/lib/ruby/2.7.0 -r ./siteconf20230321-79567-o5x5e7.rb extconf.rb
creating Makefile

current directory: /Users/hegwin/.rvm/gems/ruby-2.7.3/gems/sassc-2.1.0/ext
make "DESTDIR=" clean

current directory: /Users/hegwin/.rvm/gems/ruby-2.7.3/gems/sassc-2.1.0/ext
make "DESTDIR="
compiling ./libsass/src/units.cpp
clang: error: the clang compiler does not support '-march=native'
make: *** [units.o] Error 1

make failed, exit code 2

I'm in a dilemma

timokleemann commented 1 year ago

If you happen to be at a host such as DigitalOcean, the solution is fairly simple:

Just resize your droplet from 1 GB to 2 GB, then run bundle again and the installation should complete without any problems. After that just resize your droplet back to 1 GB.

I've already done this with two different Ruby on Rails projects in the past weeks and it worked both times.