You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
go get -u github.com/whyrusleeping/gx
go get -u github.com/whyrusleeping/gx-go
gx-go rw
gx install --global
go build -buildmode=plugin -o=ethereum.so
mv ethereum.so ~/.ipfs/plugins/
chmod +x ~/.ipfs/plugins/ethereum.so
ipfs daemon
What did you expect to see?
ipfs should be started.
What did you see instead?
error message
Error: loading plugin /home/suyu/ipfs/data/plugins/ethereum.so: plugin.Open: /home/ipfs//plugins/ethereum.so: invalid ELF header
readelf -h ethereum.so
File: ethereum.so(__.PKGDEF )
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
File: ethereum.so(go.o )
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
The text was updated successfully, but these errors were encountered:
ianlancetaylor
changed the title
invalid ELF header in build output
cmd/go: -buildmode=plugin generated Go archive, not ELF shared object
Nov 10, 2017
I don't see how this is possible. Are you absolutely certain that you are looking at the same ethereum.so file in both cases? Can you show us the output of go build -buildmode=plugin -x -o=ethereum.so?
If you run go build -buildmode=plugin, gc complains:
$ go build -buildmode=plugin
-buildmode=plugin requires exactly one main package
but if you use -o, it doesn't:
$ go build -buildmode=plugin -o test.so
A test.so is generated, but it's an archive!
$ file test.so
test.so: current ar archive
so readelf fails on it:
$ readelf -h test.so
File: test.so(__.PKGDEF )
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
File: test.so(_go_.o )
readelf: Error: Not an ELF file - it has the wrong magic bytes at the start
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.9 linux/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/suyu/go"
GORACE=""
GOROOT="/home/suyu/.gvm/gos/go1.9"
GOTOOLDIR="/home/suyu/.gvm/gos/go1.9/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build725236087=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
What did you do?
What did you expect to see?
ipfs should be started.
What did you see instead?
error message
The text was updated successfully, but these errors were encountered: