【问题标题】:Installing xv6 on a macOSX 10.15在 macOSX 10.15 上安装 xv6
【发布时间】:2021-01-03 20:21:11
【问题描述】:

我一直在尝试通过终端在我的 macOSX 上安装 xv6。 我使用命令 brew install qemu 来安装 qemu 并点击了代码:

sudo port install i386-elf-gcc

在将 Makefile 从 i386-jos-elf 修改为 i386-elf 之后,当我点击代码时,我收到以下关于尝试运行 xv6 的消息:

cd xv6-public 
make

以下消息:

错误:找不到 GCC/binutils 的 i386--elf 版本。 PATH 中有 i386-jos-elf-gcc 的目录吗? 如果您的 i386--elf 工具链是使用命令安装的 'i386-jos-elf-' 以外的前缀,设置你的 TOOLPREFIX 环境变量添加到该前缀并再次运行“make”。 要关闭此错误,请运行“gmake TOOLPREFIX= ...”。

gcc -m32 -gdwarf-2 -Wa,-divide -c -o usys.o ussys.S

任何帮助将不胜感激。

【问题讨论】:

    标签: macos terminal operating-system cd xv6


    【解决方案1】:

    可能您下载的 xv6 版本已过期。我今天也遇到了这个问题。更新到最新版本后,即可成功编译。 用这个命令下载的版本好像更高级。

    git clone git://github.com/mit-pdos/xv6-riscv-fall19.git

    你可以试试这个教程。我今天用他的方法成功了。 This is the tutorial but written in Chinese

    【讨论】:

      【解决方案2】:
      • 安装必备库

        brew install python3 gawk gnu-sed gmp mpfr libmpc isl zlib expat
        
      • 安装 RISC-V GNU 工具链

        brew tap riscv/riscv
        brew install riscv-tools
        path=(/usr/local/opt/riscv-gnu-toolchain/bin ${path})
        
      • 安装 QEMU

        brew install qemu
        
      • 安装 xv6

        git clone --depth 1 --single-branch \
            https://github.com/mit-pdos/xv6-riscv.git \
            ./xv6
        
      • 运行 xv6:

        cd ./xv6
        make qemu
        

      【讨论】: