Compiling the RISC-V GNU Compiler Toolchain on OS X - Printable Version +- PULP Community (https://pulp-platform.org/community) +-- Forum: PULP's Community forum (https://pulp-platform.org/community/forumdisplay.php?fid=1) +--- Forum: PULP General questions (https://pulp-platform.org/community/forumdisplay.php?fid=2) +--- Thread: Compiling the RISC-V GNU Compiler Toolchain on OS X (/showthread.php?tid=280) |
Compiling the RISC-V GNU Compiler Toolchain on OS X - Coderitter GmbH - 02-04-2022 Hello everyone, i want the RISC-V GNU Compiler Toolchain to work on OS X. Here are my steps so far and what goes wrong. Code: brew install gawk gnu-sed gmp mpfr libmpc isl zlib Code: git clone --recursive https://github.com/pulp-platform/pulp-riscv-gnu-toolchain Code: ./configure --prefix=/opt/riscv --with-arch=rv32imfdc --with-cmodel=medlow --enable-multilib make Then i created a disk image of 8 GiB with a case sensitive APFS file system and copied all the files into that disk image. Inside that disk image i run make. Code: make Make returns the following error message which is the same error message if i do not run make inside the disk image. Code: /Users/rene/code/pulp-riscv-gnu-toolchain/riscv-binutils-gdb/readline/rltty.c:83:7: error: implicit declaration of function 'ioctl' is invalid in C99 RE: Compiling the RISC-V GNU Compiler Toolchain on OS X - fconti - 02-04-2022 Hi, you should do Code: brew install g++ gcc Then, before building, run Code: export CXX=g++-9 CC=gcc-9 It did work for me. If you are building for MacOS on ARM64 instead of Intel look here: https://github.com/riscv-software-src/homebrew-riscv/issues/47#issuecomment-772306695 Finally, the RISC-V toolchain will work fine on MacOS, but the other PULP SDK tools, in particular GVSoC, are Linux-only as far as I know, so you will need to use a container or VM to make it work. RE: Compiling the RISC-V GNU Compiler Toolchain on OS X - Coderitter GmbH - 02-04-2022 Hello fconti, thank you very much for the very quick reply. This helps a lot because we need to work with the PULP platform in a real production environment. I did `brew install g++ gcc`. Here is the reply from HomeBrew. Code: Warning: No available formula with the name "g++". RE: Compiling the RISC-V GNU Compiler Toolchain on OS X - fconti - 02-04-2022 Probably I noted it down wrong, and GCC is enough to install both GCC and G++. Anyways, better to use the Homebrew version than the one provided by MacOS, which is actually Clang+LLVM. On the other hand, if you need this for production, I strongly suggest you use a Ubuntu 20.04 virtual machine (or a container if you prefer). Everything will work out of the box and you'll save yourself a lot of trouble. RE: Compiling the RISC-V GNU Compiler Toolchain on OS X - Coderitter GmbH - 02-08-2022 We created a Dockerfile for the toolchain. I will create a new post to publish it. Apart from that, personally i think it is better if PULP either removes the content on how to compile for Mac or correct it. It is pretty annoying wasting time with instructions that do not work. |