Slide 12
Slide 12 text
Build ARM executable with Go
$ cat hello.go
package main
import "fmt"
func main() { fmt.Println("hello, world") }
$ sudo apt install golang
$ GOARCH=arm go build hello.go
$ file hello
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, Go
BuildID=r25mtH3xAmMqsN82YvTf/76iAXGVuGm9vmj6JX2uK/wp_gTuNYGed7ykVck7Ur/mSyuD7KUTU2imdNgDNt
Q, not stripped
$ ./hello
-bash: ./hello: cannot execute binary file: Exec format error
x86_64 ホストで ARM の実行ファイルをクロスビルドする (Go 言語を使用)
x86_64 ホストでは
ARM バイナリは実行できない
GOARCH=arm 指定で
ARM バイナリをビルド