I'm trying to run xv6-riscv. I'm on Ubuntu 22.04.2 LTS, so I needed to build the gnu-riscv-toolchain. Following these instructions, I ran sudo make
. Eventually, make produced the following output:
rm -rf stamps/build-newlib build-newlib
mkdir build-newlib
cd build-newlib && /mnt/c/Users/vrait/Documents/Code/OperatingSystems/riscv-gnu-toolchain/newlib/configure \
--target=riscv64-unknown-elf \
\
--prefix=/usr/local \
--enable-newlib-io-long-double \
--enable-newlib-io-long-long \
--enable-newlib-io-c99-formats \
--enable-newlib-register-fini \
CFLAGS_FOR_TARGET="-O2 -D_POSIX_MODE -ffunction-sections -fdata-sections -mcmodel=medlow" \
CXXFLAGS_FOR_TARGET="-O2 -D_POSIX_MODE -ffunction-sections -fdata-sections -mcmodel=medlow"
/bin/sh: 1: /mnt/c/Users/vrait/Documents/Code/OperatingSystems/riscv-gnu-toolchain/newlib/configure: not found
make: *** [Makefile:622: stamps/build-newlib] Error 127
Line 622 is the Makefile line that's producing the error:
rm -rf $@ $(notdir $@)
mkdir $(notdir $@)
cd $(notdir $@) && $</configure \
# some args
I don't have much experience with CMake, but my understanding is that this code deletes notdir
, creates a new notdir
directory, moves into it, and then tries to run /configure
with some arguments. I'm confused as to how this could work: you're trying to access a file in an empty directory you just created. How could there ever be a file there for you to access?
Changing /configure
to /../configure
allows me to hack past this error (there is a configure file in the root directory of the gnu-riscv-toolchain that I assume this causes the program to access), but Make stalls suddenly after outputting the following (no error message, it just stops producing output):
cd build-binutils-newlib && CC_FOR_TARGET=riscv64-unknown-elf-gcc /mnt/c/Users/vrait/Documents/Code/OperatingSystems/riscv-gnu-toolchain/newlib/../binutils/configure \
# some args
Which I assume is caused somehow by the change of /configure
to /../configure
.
How could the rm
, mkdir
, cd
, /configure
sequence work without always trying to access a file that doesn't exist? Also, what would be the correct approach to fixing the not found
error?