mit-pdos / xv6-riscv

Xv6 for RISC-V
Other
6.92k stars 2.56k forks source link

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

Open Phlip opened 4 years ago

Phlip commented 4 years ago

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 commented 4 years ago

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

mrmitzh commented 4 years ago

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

aaronslin commented 3 years ago

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

cscli commented 1 year ago

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