riscv-gnu-toolchain下载安装

Posted 王万林 Ben

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了riscv-gnu-toolchain下载安装相关的知识,希望对你有一定的参考价值。

克隆riscv-gnu-toolchain源码

riscv-gnu-toolchain项目在github上,在国内的主机上clone会出现很慢的问题。幸好gitee帮我们想到了这一点,可以从gitee clone下来。

[tools_adm@computing-host-001 tmp]$ git clone https://gitee.com/mirrors/riscv-gnu-toolchain.git

然后,也需要将submodules也clone下来。但由于这个仓库是从github直接mirror过来的,submodule的配置文件也指向了github地址,直接clone的话也会遇到慢的问题。我们将它修改指向gitee mirror对应的地址。

[tools_adm@computing-host-001 tmp]$ cd riscv-gnu-toolchain/
[tools_adm@computing-host-001 riscv-gnu-toolchain]$ sed -i 's#https://github.com/riscv-collab/#https://gitee.com/mirrors/#g' .gitmodules
[tools_adm@computing-host-001 riscv-gnu-toolchain]$ 

编译安装

按照文档,执行编译安装命令。

 

[tools_adm@computing-host-001 riscv-gnu-toolchain]$ ./configure --prefix=/sdata/tools/opensrc/riscv-gnu-toolchain/2022.06.10
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for grep that handles long lines and -e... /bin/grep
checking for fgrep... /bin/grep -F
checking for grep that handles long lines and -e... (cached) /bin/grep
checking for bash... /bin/sh
checking for __gmpz_init in -lgmp... no
checking for mpfr_init in -lmpfr... no
checking for mpc_init2 in -lmpc... no
checking for curl... /bin/curl
checking for wget... /bin/wget
checking for ftp... no
configure: creating ./config.status
config.status: creating Makefile
config.status: creating scripts/wrapper/awk/awk
config.status: creating scripts/wrapper/sed/sed
[tools_adm@computing-host-001 riscv-gnu-toolchain]$ make linux
cd /sdata/tools/opensrc/riscv-gnu-toolchain/tmp/riscv-gnu-toolchain && \\
flock `git rev-parse --git-dir`/config git submodule init /sdata/tools/opensrc/riscv-gnu-toolchain/tmp/riscv-gnu-toolchain/riscv-gcc/ && \\
flock `git rev-parse --git-dir`/config git submodule update /sdata/tools/opensrc/riscv-gnu-toolchain/tmp/riscv-gnu-toolchain/riscv-gcc/
Submodule 'riscv-gcc' (https://gitee.com/mirrors/riscv-gcc.git) registered for path 'riscv-gcc'
Cloning into 'riscv-gcc'...
remote: Enumerating objects: 2710459, done.
remote: Counting objects: 100% (26222/26222), done.
remote: Compressing objects: 100% (10576/10576), done.
remote: Total 2710459 (delta 18081), reused 20135 (delta 15430), pack-reused 2684237
Receiving objects: 100% (2710459/2710459), 1.43 GiB | 4.69 MiB/s, done.
Resolving deltas: 100% (2109107/2109107), done.
Submodule path 'riscv-gcc': checked out '5964b5cd72721186ea2195a7be8d40cfe6554023'
cd /sdata/tools/opensrc/riscv-gnu-toolchain/tmp/riscv-gnu-toolchain && \\
flock `git rev-parse --git-dir`/config git submodule init /sdata/tools/opensrc/riscv-gnu-toolchain/tmp/riscv-gnu-toolchain/glibc/ && \\
flock `git rev-parse --git-dir`/config git submodule update /sdata/tools/opensrc/riscv-gnu-toolchain/tmp/riscv-gnu-toolchain/glibc/
Submodule 'glibc' (git://sourceware.org/git/glibc.git) registered for path 'glibc'
Cloning into 'glibc'...
remote: Enumerating objects: 7010, done.
remote: Counting objects: 100% (7010/7010), done.
remote: Compressing objects: 100% (2761/2761), done.
Receiving objects:   0% (1763/676255), 692.01 KiB | 17.00 KiB/s   

后记

还有几个submodule是外网的,需要手动mirror一下,再指向mirror地址。

以上是关于riscv-gnu-toolchain下载安装的主要内容,如果未能解决你的问题,请参考以下文章

git riscv-gnu-toolchain

如何构建RISC-V的交叉编译工具链?

Python 安装环境搭建看这一篇就够了(Windows+Mac+Linux)

Python 安装环境搭建看这一篇就够了(Windows+Mac+Linux)

ubuntu的输入法

Jmeter软件测试,这一篇就够了