Skip to content

build "go-ethereum" with -linkshared failed: /usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1 #37080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SperaxHwy opened this issue Feb 6, 2020 · 2 comments

Comments

@SperaxHwy
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.14rc1 linux/amd64

Does this issue reproduce with the latest release?

go1.13 had a panic . Duplicate of #35759

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ubuntu/.cache/go-build"
GOENV="/home/ubuntu/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ubuntu/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build723368800=/tmp/go-build -gno-record-gcc-switches"/pre>

What did you do?

I tried to build go-ethereum using dynamic linking with command -linkshared.
I downlaoded the go-ethereum, and compiled with command go build -v -linkshared ./cmd/geth

What did you expect to see?

It compiles.

What did you see instead?

ubuntu@VM-0-8-ubuntu:~/go/src/github.com/ethereum/go-ethereum$ go build  -v -linkshared ./cmd/geth
github.com/ethereum/go-ethereum/common/hexutil
github.com/ethereum/go-ethereum/common
github.com/ethereum/go-ethereum/common/math
github.com/ethereum/go-ethereum/rlp
github.com/ethereum/go-ethereum/crypto
github.com/ethereum/go-ethereum/params
github.com/ethereum/go-ethereum/common/mclock
github.com/ethereum/go-ethereum/common/prque
github.com/ethereum/go-ethereum/ethdb
github.com/ethereum/go-ethereum/log
github.com/ethereum/go-ethereum/metrics
github.com/ethereum/go-ethereum/trie
github.com/ethereum/go-ethereum/core/types
github.com/ethereum/go-ethereum
github.com/ethereum/go-ethereum/event
github.com/ethereum/go-ethereum/accounts
github.com/ethereum/go-ethereum/accounts/keystore
github.com/ethereum/go-ethereum/core/state
github.com/ethereum/go-ethereum/p2p/netutil
github.com/ethereum/go-ethereum/rpc
github.com/ethereum/go-ethereum/consensus
github.com/ethereum/go-ethereum/consensus/misc
github.com/ethereum/go-ethereum/consensus/clique
github.com/ethereum/go-ethereum/consensus/ethash
github.com/ethereum/go-ethereum/ethdb/leveldb
github.com/ethereum/go-ethereum/ethdb/memorydb
github.com/ethereum/go-ethereum/core/rawdb
github.com/ethereum/go-ethereum/crypto/blake2b
github.com/ethereum/go-ethereum/crypto/bn256/cloudflare
github.com/ethereum/go-ethereum/crypto/bn256
github.com/ethereum/go-ethereum/core/vm
github.com/ethereum/go-ethereum/core
github.com/ethereum/go-ethereum/accounts/abi
github.com/ethereum/go-ethereum/accounts/scwallet
github.com/ethereum/go-ethereum/core/bloombits
github.com/ethereum/go-ethereum/eth/downloader
github.com/ethereum/go-ethereum/crypto/ecies
github.com/ethereum/go-ethereum/p2p/enr
github.com/ethereum/go-ethereum/p2p/enode
github.com/ethereum/go-ethereum/p2p/discover
github.com/ethereum/go-ethereum/p2p/discv5
github.com/ethereum/go-ethereum/p2p/nat
github.com/ethereum/go-ethereum/p2p
github.com/ethereum/go-ethereum/internal/ethapi
github.com/ethereum/go-ethereum/accounts/usbwallet/trezor
github.com/ethereum/go-ethereum/accounts/usbwallet
github.com/ethereum/go-ethereum/signer/storage
github.com/ethereum/go-ethereum/signer/core
github.com/ethereum/go-ethereum/accounts/external
github.com/ethereum/go-ethereum/accounts/abi/bind
github.com/ethereum/go-ethereum/core/forkid
github.com/ethereum/go-ethereum/eth/fetcher
github.com/ethereum/go-ethereum/eth/filters
github.com/ethereum/go-ethereum/eth/gasprice
github.com/ethereum/go-ethereum/eth/tracers
github.com/ethereum/go-ethereum/miner
github.com/ethereum/go-ethereum/metrics/prometheus
github.com/ethereum/go-ethereum/metrics/exp
github.com/ethereum/go-ethereum/internal/debug
github.com/ethereum/go-ethereum/node
github.com/ethereum/go-ethereum/eth
github.com/ethereum/go-ethereum/accounts/abi/bind/backends
github.com/ethereum/go-ethereum/contracts/checkpointoracle/contract
github.com/ethereum/go-ethereum/contracts/checkpointoracle
github.com/ethereum/go-ethereum/les/checkpointoracle
github.com/ethereum/go-ethereum/les/flowcontrol
github.com/ethereum/go-ethereum/light
github.com/ethereum/go-ethereum/les
github.com/ethereum/go-ethereum/ethstats
github.com/ethereum/go-ethereum/graphql
github.com/ethereum/go-ethereum/metrics/influxdb
github.com/ethereum/go-ethereum/whisper/whisperv6
github.com/ethereum/go-ethereum/cmd/utils
github.com/ethereum/go-ethereum/internal/jsre
github.com/ethereum/go-ethereum/internal/jsre/deps
github.com/ethereum/go-ethereum/internal/web3ext
github.com/ethereum/go-ethereum/console
github.com/ethereum/go-ethereum/ethclient
github.com/ethereum/go-ethereum/cmd/geth
# github.com/ethereum/go-ethereum/cmd/geth
/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: /tmp/go-link-883345696/000008.o: undefined reference to symbol 'pthread_key_delete@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
@ianlancetaylor
Copy link
Member

This error is coming from the C linker, not from Go. It looks like you need to add -pthread to #cgo CFLAGS somewhere.

@SperaxHwy
Copy link
Author

@ianlancetaylor Thanks. It compiles well by adding #cgo LDFLAGS: -lpthread at secp256.go

@golang golang locked and limited conversation to collaborators Feb 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants