go-filecoin源码编译可能出现的error

未安装LLVM

……………………………
……………………………
……………………………
warning: couldn't execute `llvm-config --prefix` (error: No such file or directory (os error 2))
warning: set the LLVM_CONFIG_PATH environment variable to a valid `llvm-config` executable

error: Could not compile `sector-builder-ffi`.

To learn more, run the command again with --verbose.
make: *** [.install-rust-fil-sector-builder] Error 101
Command './scripts/install-go-sectorbuilder.sh' failed: exit status 2
exit status 1
:go-filecoin $

显示缺少llvm-config配置,需要安装llvm。
由于系统不同,配置不同,编译方法不同,这个问题很少出现。不出现就不用管,出现的时候安装即可。

未安装gcc

Mac一般自带了gcc,不用自己安装,Linux系统一般需要手动安装,不过安装也很简单,一行命令即可
命令sudo yum install gcc

[centos@ip-172-37-13-154 ~]$ sudo yum install gcc
已加载插件:fastestmirror
Determining fastest mirrors
 * base: mirror.cc.columbia.edu
 * extras: mirror.math.princeton.edu
 * updates: mirror.cisp.com
base                                                                         | 3.6 kB  00:00:00     
extras                                                                       | 2.9 kB  00:00:00     
updates                                                                      | 2.9 kB  00:00:00     
(1/4): base/7/x86_64/group_gz                                                | 165 kB  00:00:00     
(2/4): extras/7/x86_64/primary_db                                            | 152 kB  00:00:00                                             
正在解决依赖关系
--> 正在检查事务
……………………………
……………………………
……………………………
作为依赖被升级:
  glibc.x86_64 0:2.17-292.el7    glibc-common.x86_64 0:2.17-292.el7  libgcc.x86_64 0:4.8.5-39.el7 
  libgomp.x86_64 0:4.8.5-39.el7 
  
完毕!
[centos@ip-172-35-21-122 ~]$ 

未安装blibc-2.18

直接运行官方的release包,可能会报如下错误

./paramcache: /lib64/libc.so.6: version 'GLIBC_2.18' not found (required by ./paramcache)
[centos@ip-172-41-16-181 filecoin]$ 

出现这个错误就需要,安装glibc_2.18。
先下载glibc源码包
curl -O http://ftp.gnu.org/gnu/glibc/glibc-2.18.tar.gz,用tar解压,再进入解压后的文件夹,在其中新建一个名为build的文件夹,

tar zxf glibc-2.18.tar.gz
[centos@ip-173-21-19-221 ~]$ cd glibc-2.18/
[centos@ip-173-21-19-221 glibc-2.18]$ mkdir build
[centos@ip-173-21-19-221 glibc-2.18]$ cd build/
[centos@ip-173-21-19-221 build]$ 

进入build文件夹,依次执行命令

../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make -j 8
sudo make install
这几步花费的时间会比较长,需要耐心等待。

文件下载失败

~/go/src/github.com/filecoin-project/go-filecoin$ FILECOIN_USE_PRECOMPILED_RUST_PROOFS=true go run ./build deps
pkg-config --version
0.29.2
Installing dependencies...
go mod download
go: finding bou.ke/monkey v1.0.1
go: finding cloud.google.com/go v0.43.0
……………………………
……………………………
……………………………
./scripts/install-filecoin-parameters.sh: line 5: 21145 Killed                  RUST_LOG=info ./go-sectorbuilder/paramcache --test-only
Command './scripts/install-filecoin-parameters.sh' failed: exit status 137
exit status 1
aliyun@iZ2zefi9hv762dghju8ej4Z:~/go/src/github.com/filecoin-project/go-filecoin$ 

内存分配失败

~/go/src/github.com/filecoin-project/go-filecoin$ FILECOIN_USE_PRECOMPILED_RUST_PROOFS=true go run ./build deps
pkg-config --version
0.29.2
Installing dependencies...
go mod download
………………………………
………………………………
………………………………
memory allocation of 320 bytes failed./scripts/install-filecoin-parameters.sh: line 5: 24350 Aborted                 RUST_LOG=info ./go-sectorbuilder/paramcache --test-only
Command './scripts/install-filecoin-parameters.sh' failed: exit status 134
exit status 1
~/go/src/github.com/filecoin-project/go-filecoin$ 

依赖包标签识别错误

FILECOIN_USE_PRECOMPILED_RUST_PROOFS=true go run ./build deps
pkg-config --version
0.29.2
Installing dependencies...
go mod download
go: finding bou.ke/monkey v1.0.1
go: finding cloud.google.com/go v0.43.0
go: finding contrib.go.opencensus.io/exporter/jaeger v0.1.0
go: finding contrib.go.opencensus.io/exporter/prometheus v0.1.0
……………………………
……………………………
……………………………
……………………………
jq: error (at <stdin>:4): Cannot iterate over null (null)
failed to download release (tag URL: https://api.github.com/repos/filecoin-project/bls-signatures/releases/tags/@:bls-signatures, response: {
  "message": "Not Found",
  "documentation_url": "https://developer.github.com/v3/repos/releases/#get-a-release-by-tag-name"
})
failed to find or obtain precompiled assets for bls-signatures, falling back to local build
fatal: Invalid object name '@'.
make: *** [.install-bls] 错误 128
Command './scripts/install-go-bls-sigs.sh' failed: exit status 1
exit status 1
[centos@ip-171-32-21-124 go-filecoin]$ 
发布了75 篇原创文章 · 获赞 33 · 访问量 8万+

猜你喜欢

转载自blog.csdn.net/Charliewolf/article/details/101276352