sass / sassc-ruby

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

Installation fails on M1 Macbook (11.3) with `Could not fetch libsass` #222

Closed rstammer closed 3 years ago

rstammer commented 3 years ago

System: OSX 11.3, M1 architecture Ruby 2.6.5 Tested sassc-ruby versions: 2.1.0 and 2.2.1

While trying to bundle sassc-ruby together with either Ruby 2.6.5 I encountered the follwing issue:

clang compiler does not support '-march=native'

… but I escaped that situation (naively) by trying to compile the gem locally and stripping put the -march=native flags from the Makefile, inspired by this StackOverflow answer.

Unfortunately, I still end up having this problem (libsass not found):

➜ $ gem install --local ~/Downloads/sassc2/sassc-2.1.0.gem
Building native extensions. This could take a while...
ERROR:  Error installing /Users/robin/Downloads/sassc2/sassc-2.1.0.gem:
    ERROR: Failed to build gem native extension.

    current directory: /Users/robin/.rvm/gems/ruby-2.6.5@arbeitgeber-ranking/gems/sassc-2.1.0/ext
/Users/robin/.rvm/rubies/ruby-2.6.5/bin/ruby -I /Users/robin/.rvm/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0 -r ./siteconf20210430-3293-13mu83y.rb extconf.rb
fatal: not a git repository (or any of the parent directories): .git
extconf.rb:10:in `<main>': Could not fetch libsass (RuntimeError)

extconf failed, exit code 1

Is this a problem sassc-ruby needs to address or am I missing some external tooling to make it compile? 🤔 Thanks for any hints! ✌️

bbuchalter commented 3 years ago

Current work around: gem install sassc -- --disable-march-tune-native

bbuchalter commented 3 years ago

This seems to be the relevant code: https://github.com/sass/sassc-ruby/blob/4fce2b635ca5d616a8b1381c64846410bc785ea4/ext/extconf.rb#L22-L25

bbuchalter commented 3 years ago

https://github.com/sass/sassc-ruby/pull/223

rstammer commented 3 years ago

🥳 I think by adjusting the flag as described above to default to false I'm finally able to compile it on my machine. Thanks @bbuchalter for taking care 👍