【发布时间】:2020-03-21 08:51:54
【问题描述】:
我想使用 riscv-gcc 在 Arty-A7 上实现 Ibex(RISCV 核心)示例,但我无法正确构建它。 在“制作”阶段之后它一直在失败。它似乎与 zlib 有关,但我不太确定,因为这是我第一次从源代码构建任何东西。我从https://github.com/riscv/riscv-gcc得到了源代码
我已将其配置为 make as
../riscv-gcc/configure --enable-multilib
make
然后退出并出现以下错误
checking whether the gcc -m32 linker (ld -m elf_x86_64 -m elf_i386) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
make[2]: *** [configure-stage1-zlib] Error 1
make[2]: Leaving directory `/home/alfred/Desktop/Work/riscv_gcc_install'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/alfred/Desktop/Work/riscv_gcc_install'
make: *** [all] Error 2
我也尝试过使用
运行 make(相同的配置)make all-gcc
但它会产生此错误
checking if gcc -m32 supports -fno-rtti -fno-exceptions... no
checking for gcc -m32 option to produce PIC... -fPIC -DPIC
checking if gcc -m32 PIC flag -fPIC -DPIC works... yes
checking if gcc -m32 static flag -static works... no
checking if gcc -m32 supports -c -o file.o... yes
checking if gcc -m32 supports -c -o file.o... (cached) yes
checking whether the gcc -m32 linker (ld -m elf_x86_64 -m elf_i386) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
make: *** [configure-zlib] Error 1
除了按照https://gcc.gnu.org/install/prerequisites.html 的建议检查必备库之外,我不确定目前该做什么。谁能帮帮我?
[27/11/19 更新]
我尝试从 https://github.com/riscv/riscv-gnu-toolchain> 安装完整的 riscv-gnu-toolchain 以避免丢失依赖项,但是我仍然遇到错误。我确实运行了建议的 apt-get 命令来安装先决条件。
我运行了建议以 riscv32 为目标的配置,并按如下方式进行了 make
./configure --prefix=/opt/riscv --with-arch=rv32gc --with-abi=ilp32d
make linux
然后我得到了这个错误
make[3]: Entering directory `/home/alfred/Desktop/Work/riscv-gnu-toolchain/build-binutils-linux/binutils'
/bin/bash /home/alfred/Desktop/Work/riscv-gnu-toolchain/riscv-binutils/binutils/../ylwrap /home/alfred/Desktop/Work/riscv-gnu-toolchain/riscv-binutils/binutils/arparse.y y.tab.c arparse.c y.tab.h `echo arparse.c | sed -e s/cc$/hh/ -e s/cpp$/hpp/ -e s/cxx$/hxx/ -e s/c++$/h++/ -e s/c$/h/` y.output arparse.output -- bison -y -d
m4: unrecognized option '--gnu'
Try `m4 --help' for more information.
make[4]: Entering directory `/home/alfred/Desktop/Work/riscv-gnu-toolchain/build-binutils-linux/binutils'
/bin/bash /home/alfred/Desktop/Work/riscv-gnu-toolchain/riscv-binutils/binutils/../ylwrap /home/alfred/Desktop/Work/riscv-gnu-toolchain/riscv-binutils/binutils/arparse.y y.tab.c arparse.c y.tab.h `echo arparse.c | sed -e s/cc$/hh/ -e s/cpp$/hpp/ -e s/cxx$/hxx/ -e s/c++$/h++/ -e s/c$/h/` y.output arparse.output -- bison -y -d
m4: unrecognized option '--gnu'
Try `m4 --help' for more information.
make[4]: Leaving directory `/home/alfred/Desktop/Work/riscv-gnu-toolchain/build-binutils-linux/binutils'
/bin/bash /home/alfred/Desktop/Work/riscv-gnu-toolchain/riscv-binutils/binutils/../ylwrap /home/alfred/Desktop/Work/riscv-gnu-toolchain/riscv-binutils/binutils/sysinfo.y y.tab.c sysinfo.c y.tab.h `echo sysinfo.c | sed -e s/cc$/hh/ -e s/cpp$/hpp/ -e s/cxx$/hxx/ -e s/c++$/h++/ -e s/c$/h/` y.output sysinfo.output -- bison -y -d
/home/alfred/Desktop/Work/riscv-gnu-toolchain/riscv-binutils/binutils/sysinfo.y: warning: 1 shift/reduce conflict [-Wconflicts-sr]
m4: unrecognized option '--gnu'
Try `m4 --help' for more information.
if [ -r sysinfo.c ]; then \
gcc -c -I. -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -I/home/alfred/Desktop/Work/riscv-gnu-toolchain/riscv-binutils/binutils/../zlib -g -O2 sysinfo.c ; \
else \
gcc -c -I. -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -I/home/alfred/Desktop/Work/riscv-gnu-toolchain/riscv-binutils/binutils/../zlib -g -O2 /home/alfred/Desktop/Work/riscv-gnu-toolchain/riscv-binutils/binutils/sysinfo.c ; \
fi
gcc: error: /home/alfred/Desktop/Work/riscv-gnu-toolchain/riscv-binutils/binutils/sysinfo.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
make[3]: *** [sysinfo.o] Error 4
make[3]: Leaving directory `/home/alfred/Desktop/Work/riscv-gnu-toolchain/build-binutils-linux/binutils'
make[2]: *** [all-binutils] Error 2
make[2]: Leaving directory `/home/alfred/Desktop/Work/riscv-gnu-toolchain/build-binutils-linux'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/alfred/Desktop/Work/riscv-gnu-toolchain/build-binutils-linux'
make: *** [stamps/build-binutils-linux] Error 2
我注意到 m4 无法识别某个参数
--gnu
我应该关心这个吗?
[2019 年 16 月 12 日更新]
按照建议,我尝试在 Ubuntu 18.04.03 中构建工具链(最初我是在 14.04 上),它似乎已经很好地解决了这个问题!事实证明,当涉及到操作系统依赖项时,工具链确实是“脆弱的”。非常感谢您的帮助!
【问题讨论】:
-
你好。您拥有哪个版本的 Arty A7 板 - -35T 或 -100T?您使用哪个指令来构建 gcc?我认为您不应该搜索仅 gcc 的变体,而应该搜索完整的工具链指令,例如 github.com/riscv/riscv-gnu-toolchain 或来自 Ibex 作者网站的内容(ibex-core.readthedocs.io/en/latest/… - GCC 设置)。错误“不允许链接测试”与不完整的工具链(ld、binutils、libc)有关,就像在gcc.gnu.org/ml/gcc-help/2012-07/msg00018.html 中一样。
-
你好@osgx,我使用的是Arty-A7的--35T版本。我尝试构建 riscv-gnu-toolchain 而不仅仅是 riscv-gcc 但是我仍然遇到问题。我会更新帖子。