Is there a way to cross-compile for different CPU architectures? #224
-
Obviously, what I'm looking for is some way to produce binaries for env GOOS=darwin GOARCH=amd64 go build -v . Produces: env GOOS=darwin GOARCH=amd64 go build -v .
package ...
...
imports github.com/progrium/macdriver/dispatch: build constraints exclude all Go files in /Users/jim/go/pkg/mod/github.com/progrium/macdriver@v0.5.0-preview.0.20230925233903-5cbb735647c0/dispatch
package ...
...
imports github.com/progrium/macdriver/helper/action: build constraints exclude all Go files in /Users/jim/go/pkg/mod/github.com/progrium/macdriver@v0.5.0-preview.0.20230925233903-5cbb735647c0/helper/action |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Yes, I'm currently on an Apple Silicon Mac 😁 |
Beta Was this translation helpful? Give feedback.
-
It should be that simple. BUT because of cgo it's not. That could change if we get purego integrated, but until then you'll have to look into projects like this: https://github.com/karalabe/xgo |
Beta Was this translation helpful? Give feedback.
-
Actually ... it turns out that this question has come up on the main Go repository on Github. There is an issue here: This magical incantation worked just fine for me:
I was able to make a universal binary with:
Hope this helps! |
Beta Was this translation helpful? Give feedback.
Actually ... it turns out that this question has come up on the main Go repository on Github. There is an issue here:
golang/go#44112
This magical incantation worked just fine for me:
Arm64
:Amd64
:I was able to make a universal binary with:
Hope this helps!