Hello,
I’ve installed the riscv64-unknown-elf toolchain on my MAC M2, and successfully tested it.
For the example hello-world I’ve modified two lines in the envsetup.sh:
TOOLCHAIN_DIR=${MILKV_DUO_SDK}/riscv64-linux-musl-x86_64
to
TOOLCHAIN_DIR=/opt/homebrew/opt/riscv-gnu-toolchain
(this is the place of my toolchain)
and
export TOOLCHAIN_PREFIX=${TOOLCHAIN_DIR}/bin/riscv64-unknown-linux-musl-
to
export TOOLCHAIN_PREFIX=${TOOLCHAIN_DIR}/bin/riscv64-unknown-elf-
(I’m still using the duo-sdk/rootfs)
So far so good
But the problem I’m facing is this error when I make the program:
/opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/…/…/…/…/riscv64-unknown-elf/bin/ld: /opt/homebrew/Cellar/riscv-gnu-toolchain/main/lib/gcc/riscv64-unknown-elf/12.2.0/…/…/…/…/riscv64-unknown-elf/lib/crt0.o: in function
.L0 ': (.text+0x2a): undefined reference to
__libc_init_array’
I’ve already searched for this issue but can’t find any clue.
Can you help me?