sassc-ruby: Saasc 2.4.0 installation error - #include
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.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 16
My issue was with how ruby was built when installing it with asdf. Two different versions of ruby had different output for compilers:
After some searching I came across ruby-build, which is used by
asdf-rubyplugin, and ability to specify compiler paths. So I reinstalled ruby:After that
sasscwas built properly.I am not sure how this works with different ruby managers like
rvmandrbenv.Error:
That worked for me:
@AJ-Ayush I resolved this by deleting the directory
/Library/Developer/CommandLineTools/on my iMac. After that, It automatically installs the new dev tool and then runbundle installThis fixed for me.
Though I did:
rm -rf /Library/Developer/CommandLineTools/xcode-select --installrbenv install 3.3.4bundle installI had the following situation
This fix but without
asdfworked for meI’m using mise. I am trying this:
But installing
sasscafter (andeventmachine) still both fail.sasscfails the same way than described above: https://github.com/sass/sassc-ruby/issues/225#issuecomment-2580196962How can I verify if the environment variables in my command were passed through the build correctly?
Edit: Never mind. I found a way, but passing env vars seems to have no effect with mise:
Edit 2: Even with
ruby-build,it doesn’t work:How come setting CXX works for the rest of you? 🤨
Edit 3: Well, huh. Found this bug filed just 15 days ago. It’s about
ruby-buildquietly settingCXXtofalsewhen something fails. Found out I also had to wipe my command-line tools:That also fixed the issue I was having with mise:
Sorry for updating my comments several times—didn’t want to notify everyone with a series of comments. I hope this helps someone stuck with the same problem using mise.
@shellandbull
rvmseems to provide the--with-gccoption. maybe you can give it a try. https://github.com/rvm/rvm/blob/e732b5a46aaab81fb0988c6292d526385d62052b/scripts/functions/build#L20I got the same error with:
libsassandgccalready installed via brewAlright, 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.Thank you! if you’re using rvm:
rvm reinstall 3.X.X --with-gccThis also works for me, thanks 🙏🏾. And installation via
rbenvis as same asasdf(rbenvusesruby-buildto install specific version ruby too).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.