Skip to content

Instantly share code, notes, and snippets.

@shogo82148
Created January 5, 2020 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shogo82148/a7a61b7a1652bff07fc0dfd07ceb2122 to your computer and use it in GitHub Desktop.
Save shogo82148/a7a61b7a1652bff07fc0dfd07ceb2122 to your computer and use it in GitHub Desktop.
simple cross compile check for https://github.com/go-sql-driver/mysql
#!/usr/bin/env bash
go version
perl -anE 'my $a = "\$ENV{GOOS}=\"$F[0]\"; \$ENV{GOARCH}=\"$F[1]\";"; say $a; eval $a; system("go", "build", ".")' <<'END'
aix ppc64
android 386
android amd64
android arm
android arm64
darwin 386
darwin amd64
darwin arm
darwin arm64
dragonfly amd64
freebsd 386
freebsd amd64
freebsd arm
illumos amd64
js wasm
linux 386
linux amd64
linux arm
linux arm64
linux ppc64
linux ppc64le
linux mips
linux mipsle
linux mips64
linux mips64le
linux s390x
netbsd 386
netbsd amd64
netbsd arm
openbsd 386
openbsd amd64
openbsd arm
openbsd arm64
plan9 386
plan9 amd64
plan9 arm
solaris amd64
windows 386
windows amd64
END
# the list of GOOS/GOARCH comes from https://golang.org/doc/install/source#environment
go version go1.13.5 darwin/amd64
$ENV{GOOS}="aix"; $ENV{GOARCH}="ppc64";
$ENV{GOOS}="android"; $ENV{GOARCH}="386";
$ENV{GOOS}="android"; $ENV{GOARCH}="amd64";
$ENV{GOOS}="android"; $ENV{GOARCH}="arm";
$ENV{GOOS}="android"; $ENV{GOARCH}="arm64";
$ENV{GOOS}="darwin"; $ENV{GOARCH}="386";
$ENV{GOOS}="darwin"; $ENV{GOARCH}="amd64";
$ENV{GOOS}="darwin"; $ENV{GOARCH}="arm";
$ENV{GOOS}="darwin"; $ENV{GOARCH}="arm64";
$ENV{GOOS}="dragonfly"; $ENV{GOARCH}="amd64";
$ENV{GOOS}="freebsd"; $ENV{GOARCH}="386";
$ENV{GOOS}="freebsd"; $ENV{GOARCH}="amd64";
$ENV{GOOS}="freebsd"; $ENV{GOARCH}="arm";
$ENV{GOOS}="illumos"; $ENV{GOARCH}="amd64";
$ENV{GOOS}="js"; $ENV{GOARCH}="wasm";
$ENV{GOOS}="linux"; $ENV{GOARCH}="386";
$ENV{GOOS}="linux"; $ENV{GOARCH}="amd64";
$ENV{GOOS}="linux"; $ENV{GOARCH}="arm";
$ENV{GOOS}="linux"; $ENV{GOARCH}="arm64";
$ENV{GOOS}="linux"; $ENV{GOARCH}="ppc64";
$ENV{GOOS}="linux"; $ENV{GOARCH}="ppc64le";
$ENV{GOOS}="linux"; $ENV{GOARCH}="mips";
$ENV{GOOS}="linux"; $ENV{GOARCH}="mipsle";
$ENV{GOOS}="linux"; $ENV{GOARCH}="mips64";
$ENV{GOOS}="linux"; $ENV{GOARCH}="mips64le";
$ENV{GOOS}="linux"; $ENV{GOARCH}="s390x";
$ENV{GOOS}="netbsd"; $ENV{GOARCH}="386";
$ENV{GOOS}="netbsd"; $ENV{GOARCH}="amd64";
$ENV{GOOS}="netbsd"; $ENV{GOARCH}="arm";
$ENV{GOOS}="openbsd"; $ENV{GOARCH}="386";
$ENV{GOOS}="openbsd"; $ENV{GOARCH}="amd64";
$ENV{GOOS}="openbsd"; $ENV{GOARCH}="arm";
$ENV{GOOS}="openbsd"; $ENV{GOARCH}="arm64";
$ENV{GOOS}="plan9"; $ENV{GOARCH}="386";
# github.com/go-sql-driver/mysql
./conncheck.go:42:15: undefined: syscall.EAGAIN
./conncheck.go:42:40: undefined: syscall.EWOULDBLOCK
$ENV{GOOS}="plan9"; $ENV{GOARCH}="amd64";
# github.com/go-sql-driver/mysql
./conncheck.go:42:15: undefined: syscall.EAGAIN
./conncheck.go:42:40: undefined: syscall.EWOULDBLOCK
$ENV{GOOS}="plan9"; $ENV{GOARCH}="arm";
# github.com/go-sql-driver/mysql
./conncheck.go:42:15: undefined: syscall.EAGAIN
./conncheck.go:42:40: undefined: syscall.EWOULDBLOCK
$ENV{GOOS}="solaris"; $ENV{GOARCH}="amd64";
$ENV{GOOS}="windows"; $ENV{GOARCH}="386";
$ENV{GOOS}="windows"; $ENV{GOARCH}="amd64";
@julienschmidt
Copy link

FYI: there is also go tool dist list: https://golang.org/cmd/dist/

@shogo82148
Copy link
Author

Thank you for your comment.
I will try to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment