搭建以太坊私有网络,安装geth报错

  1. 安装geth报错
build/env.sh go run build/ci.go install ./cmd/geth
>>> /usr/lib/go-1.10/bin/go install -ldflags -X main.gitCommit=4e7dc34ff1a7469b95eb16f5b4084c26a0ab3662 -v ./cmd/geth
github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid
# github.com/ethereum/go-ethereum/vendor/github.com/karalabe/hid
/tmp/go-build654371927/b223/_x002.o:在函数‘get_usb_string’中:
vendor/github.com/karalabe/hid/hidapi/libusb/hid.c:444:对‘libiconv_open’未定义的引用
vendor/github.com/karalabe/hid/hidapi/libusb/hid.c:456:对‘libiconv’未定义的引用
vendor/github.com/karalabe/hid/hidapi/libusb/hid.c:471:对‘libiconv_close’未定义的引用
collect2: error: ld returned 1 exit status
util.go:45: exit status 2
exit status 1
Makefile:15: recipe for target 'geth' failed
make: *** [geth] Error 1

解决方案: 根据提示找到对应文件

sudo vim vendor/github.com/karalabe/hid/hid_enabled.go

安装libiconv,并添加链接参数:-liconv

#cgo linux,!android LDFLAGS: -lrt -liconv

你可能感兴趣的:(Go实战系列)