TL;DR
根据课程中提供的教程安装,踩了几个坑,下面说下解决方法。
出现的问题
环境 MAC AMD macos 11.3.1
- xcode-select --install失败
xcode-select: note: install requested for command line developer tools
弹出的界面安装command line tools,但提示网络问题安装失败。
- 安装riscv-tools失败
==> Installing riscv-tools from riscv/riscv
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force
If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
Alternatively, manually download them from:
https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 13.1.
作死选择了删掉重装的方式,然并卵。
解决方案
根据homebrew的提示,升级系统。
softwareupdate --all --install --force
把系统升级到了Monterey,非常爽,下面安装riscv-tools变得非常快。
升级完之后从命令行安装command line tool。因为我的xcode升级到了13.2,从苹果官方的下载库下载13.2版本的command line tool。
然后安装依赖项
brew install libusb dtc gawk gnu-sed gmp mpfr libmpc isl wget automake md5sha1sum
然后安装riscv-tools,使用官方推荐的方式。
brew tap riscv-software-src/riscv
brew install riscv-tools
最后安装的riscv64-unknown-elf-gcc版本是11.1.0。