Skip to content

Commit

Permalink
wiki: update notes on cross compiling package build speed
Browse files Browse the repository at this point in the history
Replace a small section that talks about running "go install" as a
way to speed up cross compiling build speed -- this is no longer needed
given the way Go build caching works.

Change-Id: Ic4ab12cecd8b8326d1f24b9a9ef441fe077235af
Reviewed-on: https://go-review.googlesource.com/c/wiki/+/599215
Reviewed-by: Than McIntosh <[email protected]>
Auto-Submit: Than McIntosh <[email protected]>
Reviewed-by: Than McIntosh <[email protected]>
  • Loading branch information
thanm authored and gopherbot committed Jul 17, 2024
1 parent ae427b9 commit 20fdead
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions WindowsCrossCompiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ $ go build -o hello.exe hello.go

You can now run `hello.exe` on a Windows machine near you.

Note that the command above will silently rebuild most of standard library, and for this reason will be quite slow. To speed-up the process, you can install all the windows-amd64 standard packages on your system with

```
GOOS=windows GOARCH=amd64 go install
```
Note that the first time you run the command above it will
silently rebuild most of standard library, and for this reason
will be quite slow. Subsequent builds will be faster due to Go
command build caching.

Note also that `cgo` is disabled when cross-compiling, so any file that mentions `import "C"` will be silently ignored (See https://github.com/golang/go/issues/24068). In order to use cgo, or any of the build modes `c-archive`, `c-shared`, `shared`, `plugin`, you need to have a C cross-compiler.

Expand Down

0 comments on commit 20fdead

Please sign in to comment.