安装sassc时出错,clang编译器不支持'-march=native',M1

2024-03-30

使用Apple Silicon M1机器。尝试安装 ruby​​ gemgem install sassc -v '2.1.0'.

问题是 clang 编译器还没有 Apple M1 的“native”标志。Related https://stackoverflow.com/questions/65966969/why-does-march-native-not-work-on-apple-m1

给出的错误:(注意我用“yournamehere”替换了我的名字)

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

    current directory: /Users/yournamehere/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/sassc-2.1.0/ext
/Users/yournamehere/.asdf/installs/ruby/2.7.2/bin/ruby -I /Users/yournamehere/.asdf/installs/ruby/2.7.2/lib/ruby/2.7.0 -r ./siteconf20210303-14183-1uwhwj4.rb extconf.rb
creating Makefile

current directory: /Users/yournamehere/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/sassc-2.1.0/ext
make "DESTDIR=" clean

current directory: /Users/yournamehere/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/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

Gem files will remain installed in /Users/yournamehere/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/gems/sassc-2.1.0 for inspection.
Results logged to /Users/yournamehere/.asdf/installs/ruby/2.7.2/lib/ruby/gems/2.7.0/extensions/arm64-darwin-20/2.7.0/sassc-2.1.0/gem_make.out

An error occurred while installing sassc (2.1.0), and Bundler cannot continue.
Make sure that `gem install sassc -v '2.1.0' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  sassc-rails was resolved to 2.1.2, which depends on
    sassc

根据这个答案 https://github.com/sass/sassc-ruby/issues/222#issuecomment-857092485在 sassc-ruby 上,这个标志作为当前的解决方法对我有用:

gem install sassc -- --disable-march-tune-native
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

安装sassc时出错,clang编译器不支持'-march=native',M1 的相关文章

随机推荐