A few months ago when I was first getting started with Bazel I tried to sort out how to pass the GOOS and GOARCH to go_binary rules to get linux builds on MacOS. From what I read at the time I think it turned out not to really be feasible which is part of why we ended up setting up a docker container for building all our services. (it wasn't the only reason but it was a reason)
Now, I'm trying to get go to build a standalone binary so I can put it in a scratch docker image, and again it requires an ENV var rather than a compiler flag (CGO_ENABLED=0). Is there an elegant way to do this? I suppose I can pass it in my bazel invocation with --action_env but that seems heavy handed for something that is not actually being configured at invocation time.
Thanks!
-MacRae
And for completeness, here's the bug tracking doing cross compilation correctly in go bazel: https://github.com/bazelbuild/rules_go/issues/70
Looks like per https://github.com/bazelbuild/rules_go/issues/161 this can be accomplished (on linux) purely with linker options so I'm good. Here's an example of ones that worked for me: https://github.com/kubernetes/kubernetes/blob/v1.7.0-alpha.4/cmd/kubeadm/BUILD#L11-L22
And for completeness, here's the bug tracking doing cross compilation correctly in go bazel: https://github.com/bazelbuild/rules_go/issues/70
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/8a83c728-cdee-43e4-8f42-36f9f83bceaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Glad you found a solution. Adding +Jay Conrod just so he knows.
On Wed, Aug 30, 2017 at 9:52 PM <macrae...@gmail.com> wrote:
Looks like per https://github.com/bazelbuild/rules_go/issues/161 this can be accomplished (on linux) purely with linker options so I'm good. Here's an example of ones that worked for me: https://github.com/kubernetes/kubernetes/blob/v1.7.0-alpha.4/cmd/kubeadm/BUILD#L11-L22
And for completeness, here's the bug tracking doing cross compilation correctly in go bazel: https://github.com/bazelbuild/rules_go/issues/70
--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/8a83c728-cdee-43e4-8f42-36f9f83bceaf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.