Skip to content
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

Error when go build in mips64le platform, get exec format error #80

Open
Abirdcfly opened this issue Feb 9, 2022 · 3 comments
Open

Comments

@Abirdcfly
Copy link

❯ docker run --platform linux/mips64le golang go version
standard_init_linux.go:228: exec user process caused: exec format error

❯ docker run --platform linux/amd64 golang go version
Unable to find image 'golang:latest' locally
latest: Pulling from library/golang
Digest: sha256:301609ebecc0ec4cd3174294220a4d9c92aab9015b3a2958297d7663aac627a1
Status: Downloaded newer image for golang:latest
go version go1.17.6 linux/amd64

❯ docker run --platform linux/arm64 golang go version
Unable to find image 'golang:latest' locally
latest: Pulling from library/golang
Digest: sha256:301609ebecc0ec4cd3174294220a4d9c92aab9015b3a2958297d7663aac627a1
Status: Downloaded newer image for golang:latest
go version go1.17.6 linux/arm64


❯ docker version
Client:
 Cloud integration: v1.0.22
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.12
 Git commit:        e91ed57
 Built:             Mon Dec 13 11:46:56 2021
 OS/Arch:           darwin/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.12
  Git commit:       459d0df
  Built:            Mon Dec 13 11:43:56 2021
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.4.12
  GitCommit:        7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc:
  Version:          1.0.2
  GitCommit:        v1.0.2-0-g52b36a2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

❯ docker buildx version
github.com/docker/buildx v0.7.1 05846896d149da05f3d6fd1e7770da187b52a247

❯ docker buildx ls
NAME/NODE       DRIVER/ENDPOINT STATUS  PLATFORMS
desktop-linux   docker
  desktop-linux desktop-linux   running linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6
default *       docker
  default       default         running linux/amd64, linux/arm64, linux/riscv64, linux/ppc64le, linux/s390x, linux/386, linux/arm/v7, linux/arm/v6

@tonistiigi
Copy link
Owner

Looks like this binary sets the e_ident[EI_ABIVERSION] bit at byte 0x8

root@647d2460ce00:/go# xxd /bin/bash  | head
00000000: 7f45 4c46 0201 0100 0000 0000 0000 0000  .ELF............
00000010: 0300 0800 0100 0000 6065 0300 0000 0000  ........`e......
00000020: 4000 0000 0000 0000 505d 1600 0000 0000  @.......P]......
00000030: 0700 0080 4000 3800 0a00 4000 1f00 1e00  ....@.8...@.....
00000040: 0600 0000 0400 0000 4000 0000 0000 0000  ........@.......
00000050: 4000 0000 0000 0000 4000 0000 0000 0000  @.......@.......
00000060: 3002 0000 0000 0000 3002 0000 0000 0000  0.......0.......
00000070: 0800 0000 0000 0000 0300 0000 0400 0000  ................
00000080: 804b 1400 0000 0000 804b 1400 0000 0000  .K.......K......
00000090: 804b 1400 0000 0000 0f00 0000 0000 0000  .K..............
root@647d2460ce00:/go# xxd /usr/local/go/bin/go  | head
00000000: 7f45 4c46 0201 0100 0100 0000 0000 0000  .ELF............
00000010: 0200 0800 0100 0000 d01a 0020 0100 0000  ........... ....
00000020: 4000 0000 0000 0000 b02b db00 0000 0000  @........+......
00000030: 0500 0080 4000 3800 0a00 4000 3000 2f00  ....@.8...@.0./.
00000040: 0600 0000 0400 0000 4000 0000 0000 0000  ........@.......
00000050: 4000 0020 0100 0000 4000 0020 0100 0000  @.. ....@.. ....
00000060: 3002 0000 0000 0000 3002 0000 0000 0000  0.......0.......
00000070: 0800 0000 0000 0000 0300 0000 0400 0000  ................
00000080: 802e 7700 0000 0000 802e 7720 0100 0000  ..w.......w ....
00000090: 802e 7720 0100 0000 0f00 0000 0000 0000  ..w ............

@zhangwenlong8911 @wanghuaiqing2010

@Abirdcfly
Copy link
Author

Abirdcfly commented Feb 10, 2022

❯ docker run --platform linux/mips64le loongnix/golang:1.14.6-alpine  go version
go version go1.14.6 linux/mips64le

But the image, which was updated a year ago and is no longer updated, is working(edit: go version is working, go build is slow but working! ). I'm not sure now if the problem is with docker or the official golang project...

@tonistiigi
Copy link
Owner

That binary does not have the abiversion set

» xxd ./go | head
00000000: 7f45 4c46 0201 0100 0000 0000 0000 0000  .ELF............

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants