sass / sassc-ruby

Use libsass with Ruby!
MIT License
367 stars 156 forks source link

Saasc 2.4.0 installation error - #include <vector> #225

Open ricvillagrana opened 2 years ago

ricvillagrana commented 2 years ago

Hi, when I try to do bundle install this dependency is unable to be installed. How can I solve this issue?

OS: macOS Big Sur v11.5.2 Ruby version: ruby 2.7.4p191 (2021-07-07 revision a21a3b7d23) [x86_64-darwin20] Rails version: 5.2.6

Installing sassc 2.4.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/ricardo/.rvm/gems/ruby-2.7.4/gems/sassc-2.4.0/ext
/Users/ricardo/.rvm/rubies/ruby-2.7.4/bin/ruby -I /Users/ricardo/.rvm/rubies/ruby-2.7.4/lib/ruby/2.7.0 -r ./siteconf20210813-15067-5gceb3.rb extconf.rb
creating Makefile

current directory: /Users/ricardo/.rvm/gems/ruby-2.7.4/gems/sassc-2.4.0/ext
make "DESTDIR=" clean

current directory: /Users/ricardo/.rvm/gems/ruby-2.7.4/gems/sassc-2.4.0/ext
make "DESTDIR="
compiling ./libsass/src/ast.cpp
In file included from ./libsass/src/memory.hpp:8,
                 from ./libsass/src/sass.hpp:55,
                 from ./libsass/src/ast.cpp:3:
./libsass/src/memory/allocator.hpp:8:10: fatal error: vector: No such file or directory
    8 | #include <vector>
      |          ^~~~~~~~
compilation terminated.
make: *** [ast.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/ricardo/.rvm/gems/ruby-2.7.4/gems/sassc-2.4.0 for inspection.
Results logged to /Users/ricardo/.rvm/gems/ruby-2.7.4/extensions/x86_64-darwin-20/2.7.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:
  bootstrap-email was resolved to 1.0.0.alpha4, which depends on
    sassc

Thanks in advance for the help. Let me know if you need more information.

ahorek commented 2 years ago

I'm not familiar with the Mac ecosystem, but the error is definitely related to their specific compiler. Maybe they need some special build flags or the compiler version is simply outdated. Try to use a different one if possible.

dersnek commented 2 years ago

Getting the same error on Debian running in WSL. OS: Windows 11 21H2 build 22000.556 WSL OS: Pengwin 11 v. 21.12.0 (basically Debian) Ruby version: 2.7.1 [x86_64-linux] Rails version: 6.1.4.6

My error:

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

    current directory: /home/dersnek/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/sassc-2.4.0/ext
/home/dersnek/.asdf/installs/ruby/2.7.1/bin/ruby -I /home/dersnek/.asdf/installs/ruby/2.7.1/lib/ruby/2.7.0
creating Makefile

current directory: /home/dersnek/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/sassc-2.4.0/ext
make "DESTDIR=" clean

current directory: /home/dersnek/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/sassc-2.4.0/ext
make "DESTDIR="
compiling ./libsass/src/ast.cpp
make: g++: Permission denied
make: *** [Makefile:237: ast.o] Error 127

make failed, exit code 2

Gem files will remain installed in /home/dersnek/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/gems/sassc-2.4.0 for
inspection.
Results logged to
/home/dersnek/.asdf/installs/ruby/2.7.1/lib/ruby/gems/2.7.0/extensions/x86_64-linux/2.7.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:
  bootstrap was resolved to 4.6.0, which depends on
    sassc-rails was resolved to 2.1.2, which depends on
      sassc

It was building fine on Rails 5.2.2.1, started failing after upgrade to 6.1.

dersnek commented 2 years ago

Alright, it was pretty easy to solve. If someone stumbles upon this, just run sudo apt install g++ and you're good to go. My error was a bit different from OP's though, a permission error.