Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ricvillagrana opened this issue Aug 13, 2021 · 8 comments
Open

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

ricvillagrana opened this issue Aug 13, 2021 · 8 comments

Comments

@ricvillagrana
Copy link

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
Copy link

ahorek commented Nov 4, 2021

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
Copy link

dersnek commented Mar 31, 2022

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
Copy link

dersnek commented Mar 31, 2022

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.

@dangquangthai
Copy link

I got the same error with:

  • rails 7.1.4
  • sass-rails (6.0.0)
  • ruby 3.1.2
  • MacOS Sequoia (Version 15.0)
  • libsass and gcc already installed via brew
Fetching gem metadata from https://rubygems.org/.........
Installing sassc 2.4.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/thaidang/.rvm/gems/ruby-3.1.2@sia/gems/sassc-2.4.0/ext
/Users/thaidang/.rvm/rubies/ruby-3.1.2/bin/ruby extconf.rb
creating Makefile

current directory: /Users/thaidang/.rvm/gems/ruby-3.1.2@sia/gems/sassc-2.4.0/ext
make DESTDIR\= sitearchdir\=./.gem.20240927-12423-ir9f8b sitelibdir\=./.gem.20240927-12423-ir9f8b clean

current directory: /Users/thaidang/.rvm/gems/ruby-3.1.2@sia/gems/sassc-2.4.0/ext
make DESTDIR\= sitearchdir\=./.gem.20240927-12423-ir9f8b sitelibdir\=./.gem.20240927-12423-ir9f8b
compiling ./libsass/src/ast.cpp
In file included from ./libsass/src/ast.cpp:3:
In file included from ./libsass/src/sass.hpp:55:
In file included from ./libsass/src/memory.hpp:8:
./libsass/src/memory/allocator.hpp:8:10: fatal error: 'vector' file not found
    8 | #include <vector>
      |          ^~~~~~~~
1 error generated.
make: *** [ast.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/thaidang/.rvm/gems/ruby-3.1.2@sia/gems/sassc-2.4.0 for inspection.
Results logged to /Users/thaidang/.rvm/gems/ruby-3.1.2@sia/extensions/arm64-darwin-23/3.1.0/sassc-2.4.0/gem_make.out

@AJ-Ayush
Copy link

AJ-Ayush commented Oct 3, 2024

same here. Did you find any fix @dangquangthai ?

@dangquangthai
Copy link

@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 run bundle install

@crnastena
Copy link

My issue was with how ruby was built when installing it with asdf. Two different versions of ruby had different output for compilers:

# ruby 3.3.3 compiler check
ruby -rrbconfig -e'p RbConfig::CONFIG["CC"]' -e'p RbConfig::CONFIG["CXX"]'
"usr/bin/clang"
"false"
# ruby 3.3.4 compiler check
ruby -rrbconfig -e'p RbConfig::CONFIG["CC"]' -e'p RbConfig::CONFIG["CXX"]'
"clang"
"clang++"

After some searching I came across ruby-build, which is used by asdf-ruby plugin, and ability to specify compiler paths. So I reinstalled ruby:

asdf uninstall ruby 3.3.3
CC="clang" CXX="clang++" asdf install ruby 3.3.3

After that sassc was built properly.

I am not sure how this works with different ruby managers like rvm and rbenv.

@ntritin62
Copy link

My issue was with how ruby was built when installing it with asdf. Two different versions of ruby had different output for compilers:

# ruby 3.3.3 compiler check
ruby -rrbconfig -e'p RbConfig::CONFIG["CC"]' -e'p RbConfig::CONFIG["CXX"]'
"usr/bin/clang"
"false"
# ruby 3.3.4 compiler check
ruby -rrbconfig -e'p RbConfig::CONFIG["CC"]' -e'p RbConfig::CONFIG["CXX"]'
"clang"
"clang++"

After some searching I came across ruby-build, which is used by asdf-ruby plugin, and ability to specify compiler paths. So I reinstalled ruby:

asdf uninstall ruby 3.3.3
CC="clang" CXX="clang++" asdf install ruby 3.3.3

After that sassc was built properly.

I am not sure how this works with different ruby managers like rvm and rbenv.

that works for me. thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants