KevinR
KevinR

Reputation: 41

Error building riscv-tools (gcc newlib first file: genmddeps)

[Update 20150825: It appears the there's a compiler--assembler mismatch when compiling genmddeps.o; the compiler used is g++ which is the installed version Ubuntu 4.9.2-10ubuntu13 but the assembler used is in the build directory ./as which is configured as riscv64-unknown-elf, hence the error with the option --64 being passed in from the compiler. The full command is in the final code block at the end of this post. I'm not clear (yet) as to why there's a local copy of as and why g++ isn't smart enough not to use it....]

Perhaps there's something simple that I've misconfigured, but if so it's slipped through multiple attempts. Any help would be appreciated.

I'm stuck trying to build the rocket-chip tree and things are going wrong while building the riscv-tools. What appears to be happening is that an illegal option is being passed to the riscv assembler which causes the failure:

/home/kevin/Working/rocket-chip/riscv/riscv64-unknown-elf/bin/as: unrecognized option '--64'
make[3]: *** [build/genmddeps.o] Error 1
make[2]: *** [all-gcc] Error 2
make[1]: *** [all] Error 2
make: *** [stamps/build-gcc-newlib] Error 2

Configure doesn't seem to think that it's cross compiling which I would have expected given the use of the riscv as binary rather than the system x86_64 as binary:

Configuring in ./gcc
...
checking whether we are cross compiling... no

The paths seem to be set up correctly:

> echo $TOP
/home/kevin/Working/rocket-chip
> echo $RISCV
/home/kevin/Working/rocket-chip/riscv
> echo $PATH
.:~/bin:~/scripts:.:~/bin:~/scripts:/home/kevin/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/kevin/Working/rocket-chip/riscv/bin

(On a side note, I see some shell test errors in the build process after downloading gcc-5.2.0:

/bin/sh: 1: test: false: unexpected operator

Not sure if that's a symptom or if it's known behavior.)

The system is Ubuntu 15.04 running under VMware player on a Win* box. I'm running in tcsh but the same thing happens running from bash as well. From poking around the riscv changes, it seems that the required option is --m64 instead of --64 but I'm not sure where the --64 is coming from in the build/configuration files as it's not showing in the actual build command for the compiler. The complete sequence of build instructions from the build log is:

make[3]: Entering directory '/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/build-gcc-newlib/gcc'
TARGET_CPU_DEFAULT="" \
HEADERS="auto-host.h ansidecl.h" DEFINES="" \
/bin/bash /home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/mkconfig.sh config.h
TARGET_CPU_DEFAULT="" \
HEADERS="options.h insn-constants.h config/elfos.h config/newlib-stdint.h config/riscv/riscv.h config/riscv/elf.h config/initfini-array.h defaults.h" DEFINES="LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3" \
/bin/bash /home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/mkconfig.sh tm.h
TARGET_CPU_DEFAULT="" \
HEADERS="config/riscv/riscv-protos.h tm-preds.h" DEFINES="" \
/bin/bash /home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/mkconfig.sh tm_p.h
TARGET_CPU_DEFAULT="" \
HEADERS="auto-host.h ansidecl.h" DEFINES="" \
/bin/bash /home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/mkconfig.sh bconfig.h
g++ -c   -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE  -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -DGENERATOR_FILE -I. -Ibuild -I/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc -I/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/build -I/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/../include  -I/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/../libcpp/include  \
    -o build/genmddeps.o /home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/src/newlib-gcc/gcc/genmddeps.c
Makefile:2428: recipe for target 'build/genmddeps.o' failed
make[3]: Leaving directory '/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/build-gcc-newlib/gcc'
Makefile:4112: recipe for target 'all-gcc' failed
make[2]: Leaving directory '/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/build-gcc-newlib'
Makefile:867: recipe for target 'all' failed
make[1]: Leaving directory '/home/kevin/Working/rocket-chip/riscv-tools/riscv-gnu-toolchain/build/build-gcc-newlib'
Makefile:214: recipe for target 'stamps/build-gcc-newlib' failed

Upvotes: 1

Views: 1939

Answers (1)

KevinR
KevinR

Reputation: 41

Removing . from my PATH solved this problem: it turns out that the way the build process and directories are structured, g++ (installed for x86_64) was running as (just built for RISC-V). I'll automate this hack to work around the problem when I'm building rocket_chip in the future.

Upvotes: 3

Related Questions