xv6-riscv icon indicating copy to clipboard operation
xv6-riscv copied to clipboard

riscv64-linux-gnu-gcc: error: unrecognized command line option ‘-mno-relax’; did you mean ‘-Wno-vla’?

Open Phlip opened this issue 4 years ago • 4 comments

I can't compile on Ubuntu. My procedure was:

git clone ... sudo apt install pkg-config-riscv64-linux-gnu libstdc++6-7-dbg-riscv64-cross gobjc-riscv64-linux-gnu libgcc-8-dev-riscv64-cross cd xv6-riscv make

And I get that gnarly error message.

The next question, if I build, will be how to emulate RISC-V on a lowly x86_64?

Phlip avatar Mar 08 '20 13:03 Phlip

Changing the Makefile to CFLAGS += -ffreestanding -fno-common -nostdlib -Wno-vla worked, but I feel like a chimp with a machine gun here...

Phlip avatar Mar 09 '20 13:03 Phlip

@Phlip Try use riscv64-linux-gnu-gcc with version 8. For emulate RISC-V on a lowly x86_64, you can use qemu.

mrmitzh avatar Apr 30 '20 21:04 mrmitzh

For quick reference:

sudo apt install gcc-8-riscv64-linux-gnu
sudo apt remove gcc-riscv64-linux-gnu

and then replace CC = $(TOOLPREFIX)gcc with CC = $(TOOLPREFIX)gcc-8 in the Makefile

aaronslin avatar Jan 11 '21 02:01 aaronslin

quick reference: sudo apt install gcc-8-riscv64-linux-gnu sudo update-alternatives --install /usr/bin/riscv64-linux-gnu-gcc riscv64-linux-gnu-gcc /usr/bin/riscv64-linux-gnu-gcc-8 8

cscli avatar Dec 13 '22 06:12 cscli