安装 sassc 时出错,clang 编译器不支持“-march=native",M1 [英] Error installing sassc, clang compiler does not support '-march=native', M1

查看:399
本文介绍了安装 sassc 时出错,clang 编译器不支持“-march=native",M1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Using Apple Silicon M1 machine. Attempting to install ruby gem gem install sassc -v '2.1.0'.

问题在于,clang 编译器还没有 Apple M1 的本机"标志.相关

The problem is that clang compiler does not have flag 'native' for Apple M1 yet. Related

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

Error given: (note I replaced my name with '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

推荐答案

根据 this answer 在 sassc-ruby 上,这个标志对我有用,作为当前的解决方法:

According to this answer on sassc-ruby, this flag worked for me as a current workaround:

gem install sassc -- --disable-march-tune-native

这篇关于安装 sassc 时出错,clang 编译器不支持“-march=native",M1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆