riscv-software-src / riscv-tools

RISC-V Tools (ISA Simulator and Tests)
1.14k stars 447 forks source link

Error building binutils in riscv-gnu-toolchain target with GCC 7.2.0 and 4.9.4 #138

Open sherrbc1 opened 6 years ago

sherrbc1 commented 6 years ago

When building with either GCC version 7.2.0 or 4.9.4, both of which satisfy the requirement of GCC >= 4.8 for C++11 dependencies, I am met with a cascade of build-time errors. Most notably:

/home/user/riscv/riscv-tools/riscv-gnu-toolchain/riscv-binutils-gdb/gdb/guile/scm-ports.c:146:10:` error: ‘scm_new_port_table_entry’ was not declared in this scope

and

/home/user/riscv/riscv-tools/riscv-gnu-toolchain/riscv-binutils-gdb/gdb/guile/scm-ports.c:231:20: error: ‘SCM_PTAB_ENTRY’ was not declared in this scope

Host OS: Arch Linux 4.13.7 GCC: 7.2.0 Error Log: builderror_720.log

GCC: 4.9.4 Error Log: builderror_494.log

sherrbc1 commented 6 years ago

From what I gather online, this seems to have been an issue since upstream guile deprecated structures used by gdb.

https://sourceware.org/bugzilla/show_bug.cgi?id=21104 https://github.com/crosstool-ng/crosstool-ng/issues/799 http://archive.linuxfromscratch.org/mail-archives/blfs-dev/2017-March/033056.html https://github.com/crosstool-ng/crosstool-ng/issues/718

The suggested fix is to include --without-guile or --with-guile=no in GDB's configure scripts. My system has guile 2.2.2 installed, which explains the inability to find the missing types. It is likely that installing an earlier version of Guile would also remedy the situation.

This issue is more appropriately listed over at riscv-binutils-gdb and, as such, should likely be closed. However, a temporary fix from this repo can be had by changing this line to:

build_project riscv-gnu-toolchain --prefix=$RISCV --without-guile