Compilation and Building FAQ

Invalid -- w option

  • Problem

    The compilation fails, and usr/sbin/ninja: invalid option -- w is displayed.

  • Cause

    The Ninja version in the compilation environment is outdated and does not support the --w option.

  • Solution

    Uninstall Ninja and GN and follow the instructions provided in Acquiring Tools to obtain the provided compilation toolchain.

Ncurses library not found

  • Problem

    The compilation fails, and /usr/bin/ld: cannot find -lncurses is displayed.

  • Cause

    The ncurses library is not installed.

  • Solution

    sudo apt-get install lib32ncurses5-dev
    

Mcopy not found

  • Problem

    The compilation fails, and line 77: mcopy: command not found is displayed.

  • Cause

    Mcopy is not installed.

  • Solution

    ​sudo apt-get install dosfstools mtools
    

No riscv file or directory

  • Problem

    The compilation fails, and the following information is displayed: riscv32-unknown-elf-gcc: error trying to exec 'cc1': execvp: No such file or directory.

  • Cause

    Permission is required to access files in the riscv compiler path.

  • Solution

    1. Run the following command to query the directory where gcc_riscv32 is located:

      which riscv32-unknown-elf-gcc
      
    2. Run the chmod command to change the directory permission to 755.

No Crypto

  • Problem

    The compilation fails, and No module named'Crypto loaded is displayed.

  • Cause

    Crypto is not installed in Python 3.

  • Solution

    1. Run the following command to query the Python version:

      python3 --version
      
    2. Ensure that Python 3.7 or later is installed, and then run the following command to install pycryptodome:

      sudo pip3 install pycryptodome
      

Unexpected operator

  • Problem

    The compilation fails, and xx.sh [: xx unexpected operator is displayed.

  • Cause

    The compilation environment is shell instead of bash.

  • Solution

    sudo rm -rf /bin/sh
    sudo ln -s /bin/bash /bin/sh