我想使用riscv-gcc在ArtyA7上实现一个Ibex (RISCV核心)示例,但是我还不能正确地构建它。在“制造”阶段之后,它一直在失败。这似乎与zlib有关,但我不太确定,因为这是我第一次从源代码构建任何东西。我从https://github.com/riscv/riscv-gcc得到消息来源
我已经将它配置为
../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-工具链,以避免缺少依赖项,但是我仍然有一个错误。我确实运行了建议的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我应该关心这个吗?
更新16/12/2019
按照建议,我尝试在Ubuntu18.04.03中构建工具链(最初是14.04),它似乎很好地解决了这个问题!结果发现,当涉及到操作系统依赖时,工具链确实是“脆弱的”。非常感谢你的帮助!
发布于 2019-12-02 22:06:00
我发现RISC-V工具链在操作系统依赖性方面非常脆弱。工具链团队使用的是Ubuntu 16,很多错误都是人们看到的,这些错误都是因为Linux生态系统自那个版本以来的变化而产生的。
我通过创建一个配置为使用Ubuntu 16的Vagrantfile来解决这个问题,并完成了正式的步骤,至少对我来说,它很好地构建了工具。如果你感兴趣,它被张贴在the stackoverflow question I asked along these lines里面。如果您需要以不同的方式配置这些工具,那么在Vagrantfile中这样做是很简单的。
发布于 2019-11-26 03:05:02
“不允许链接测试”是连接到不完整工具链(如ld、binutils、libc)的错误,类似于https://gcc.gnu.org/ml/gcc-help/2012-07/msg00018.html中的报告。
从你的问题中,我们不清楚你是用哪条指令来培养gcc的。我认为你不应该只搜索gcc的构建,而应该搜索完整的工具链指令,比如https://github.com/riscv/riscv-gnu-toolchain或者Ibex作者网站上的东西。https://ibex-core.readthedocs.io/en/latest/verification.html#getting-started页面中的Ibex文档有一些链接到"GCC设置“,但是它是供验证的,并且没有完整的说明。
在https://github.com/riscv/riscv-gcc/issues/143问题上,有这样的信息:“没有二进制文件,你就无法构建gcc。”“没有C库你就不能建一个有用的gcc”,所以试着构建完整的工具链,而不仅仅是gcc。
在早期由lowrisc编写的项目中,有构建工具链的指令(组合为gcc + binutils + newlib):https://www.lowrisc.org/blog/2017/09/building-upstream-risc-v-gccbinutilsnewlib-the-quick-and-dirty-way/ -您可能想用另一个git修改指令(riscv-gcc)。或者只需尝试https://github.com/riscv/riscv-gnu-toolchain
发布于 2021-10-17 17:01:52
尝试这个版本的整数上升。我已经试过了而且通过了。
git clone https://github.com/riscv/riscv-gnu-toolchain
git checkout 411d134
git submodule update --init --recursive
mkdir build
cd build
../configure --prefix=/opt/riscv32i --with-arch=rv32i --with-abi=ilp32
make -j8 如果您的riscv有mul/div模块,则添加M标准扩展。
../configure --prefix=/opt/riscv32im --with-arch=rv32im --with-abi=ilp32如果您的riscv是64位整数核心:
../configure --prefix=/opt/riscv64i --with-arch=riscv64i --with-abi=lp64 选择要生成的选项:
整数乘除法的"M“标准推广
"A“原子指令的标准扩展
单精度浮点的"F“标准扩展
双精度浮点的"D“标准扩展
准精度浮点的"Q“标准扩展
压缩指令的"C“标准扩展
I,M,A,F和D的"G“组合。
ilp32 32/ilp32f/ilp32d int-32位长-32位指针-32位
lp64 64/lp64f/lp64d int-32位长-64位指针-64位
vexrisc整个项目在arty a7 35t上实现了riscv,包括工具链编译和使用IntelliJ IDE构建riscv项目和内部using调试可能对您有帮助。
https://fatalfeel.blogspot.com/2013/12/risc-v-on-arty-a7-35t.html
也许您想在riscv上尝试Linux。它是基于烦恼
https://stackoverflow.com/questions/59042413
复制相似问题