Go-ethereum: GOOS=linux GOARCH=amd64 go build go build github.com/ethereum/go-ethereum/crypto/secp256k1: build constraints exclude allGo files in /Users/mac/Documents/project/src/github.com/ethereum/go-ethereum/crypto/secp256k1

Created on 28 May 2018  ·  8Comments  ·  Source: ethereum/go-ethereum

Version: 1.8.8-stable
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10.2
Operating System: darwin

GOOS=linux GOARCH=amd64 go build

go build github.com/ethereum/go-ethereum/crypto/secp256k1: build constraints exclude allGo files in /Users/mac/Documents/project/src/github.com/ethereum/go-ethereum/crypto/secp256k1

Most helpful comment

I fixed the problem with xgo --targets=linux/amd64 ./ in my project root path. thanks @karalabe !

All 8 comments

Geth contains some C libraries. To build it, you need a full C cross compilation toolkit. Also you need to run with CGO_ENABLED=1.

I run with CGO_ENABLED=1 but have error:

Undefined symbols for architecture x86_64:
"__cgo_topofstack", referenced from:
__cgo_f7895c2c5a3a_C2func_getnameinfo in 000002.o
__cgo_f7895c2c5a3a_Cfunc_getnameinfo in 000002.o
__cgo_f7895c2c5a3a_C2func_getaddrinfo in 000004.o
__cgo_f7895c2c5a3a_Cfunc_gai_strerror in 000004.o
__cgo_f7895c2c5a3a_Cfunc_getaddrinfo in 000004.o
__cgo_4df9d77381d7_Cfunc_secp256k1_ext_scalar_mul in 000018.o
__cgo_4df9d77381d7_Cfunc_secp256k1_context_create_sign_verify in 000020.o
...
"__cgoexp_4df9d77381d7_secp256k1GoPanicError", referenced from:
_secp256k1GoPanicError in 000017.o
"__cgoexp_4df9d77381d7_secp256k1GoPanicIllegal", referenced from:
_secp256k1GoPanicIllegal in 000017.o
"_crosscall2", referenced from:
_secp256k1GoPanicIllegal in 000017.o
_secp256k1GoPanicError in 000017.o
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I fixed the problem with xgo --targets=linux/amd64 ./ in my project root path. thanks @karalabe !

@zhangshp 完整的命令是怎样的

@suifengqjn 你可以看看这个地址 xgo,需要安装Docker,通过xgo编译成对应的平台

@suifengqjn 你可以看看这个地址 xgo,需要安装Docker,通过xgo编译成对应的平台
每次build都好花时间...

I fixed the problem with xgo --targets=linux/amd64 ./ in my project root path. thanks @karalabe !

Hey @zhangshp I run into same issue as you show above.
Could you please specify where exactly you add that string?
I'm trying this: env GOOS=linux env GOARCH=arm64 go build
do I add it like this: env GOOS=linux env GOARCH=arm64 go build xgo --targets=linux/arm64 ./

..after closer thought that path should probably be in the go env? But how do I add it there?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leonzhao picture leonzhao  ·  3Comments

bgrieder picture bgrieder  ·  3Comments

carver picture carver  ·  3Comments

freshonline picture freshonline  ·  3Comments

phpsamsb picture phpsamsb  ·  3Comments