-
-
Notifications
You must be signed in to change notification settings - Fork 661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to cross compile to a different libc implementation? #4007
Comments
Are you also seeing these warnings with a non-Bazel Go build? It would be very helpful to see and compare the exact command lines the Bazel build and the Go build run. |
Hm, this project has grown quite a bit in size and it's very Bazel-centric. Is there any set of CLI flags I can pass to get some debug info? It would be hard to simply rebuild using plain Go. That said, is it possible for Go to cross compile to another libc at all? What I find in other forums is that it's very centered towards the host's libc implementation. LLVM/clang on the other hand can cross compile between libcs. |
You could override Go rules with Together with |
Thanks for sharing this tip, @fmeum! It's really helpful. Just wondering, do you know if this is documented somewhere? I think it would be useful to add to the docs, if not. I was considering raising a PR for this. Wanted to add, to test locally I thought a ├── patches
│ ├── BUILD.bazel (empty)
│ └── verbose.patch
├── BUILD.bazel
├── MODULE.bazel
bazel_dep(name = "rules_go", version = "0.49.0")
single_version_override(
module_name = "rules_go",
patch_strip = 1,
patches = ["//patches:verbose.patch"],
version = "0.49.0",
)
diff --git a/go/tools/builders/env.go b/go/tools/builders/env.go
index bb01ac20..8f70fff5 100644
--- a/go/tools/builders/env.go
+++ b/go/tools/builders/env.go
@@ -75,7 +75,7 @@ func envFlags(flags *flag.FlagSet) *env {
flags.StringVar(&env.goroot, "goroot", "", "The value to set for GOROOT.")
flags.Var(&tagFlag{}, "tags", "List of build tags considered true.")
flags.StringVar(&env.installSuffix, "installsuffix", "", "Standard library under GOROOT/pkg")
- flags.BoolVar(&env.verbose, "v", false, "Whether subprocess command lines should be printed")
+ flags.BoolVar(&env.verbose, "v", true, "Whether subprocess command lines should be printed")
flags.BoolVar(&env.shouldPreserveWorkDir, "work", false, "if true, the temporary work directory will be preserved")
return env
} For reference: https://sourcegraph.com/github.com/bazelbuild/examples/-/blob/bzlmod/02-override_bazel_module/MODULE.bazel?L26 // https://github.com/bazelbuild/examples/blob/main/bzlmod/02-override_bazel_module/MODULE.bazel#L26 |
What version of rules_go are you using?
0.46.0
What version of gazelle are you using?
0.35.0
What version of Bazel are you using?
Bazelisk version: v1.19.0
Does this issue reproduce with the latest releases of all the above?
Yes
What operating system and processor architecture are you using?
Linux x86_64
Any other potentially useful information about your toolchain?
No
What did you do?
I want to deploy my binary on a Raspberry Pi Zero and when I just build the
myprogram
target, I se these warnings:My Raspberry Pi Zero platform is defined like this:
Ultimately, I will want to have
musl
libc implementation on my Raspberry Pi Zero. How can I avoid the assumption that the libc implementation is GNU on my target platform when cross compiling?What did you expect to see?
I don't want to see
glibc
warnings in my build.What did you see instead?
glibc
-related warnings. I understand that static compilation still has some dynamic linking involved in the final product, but this build assumesglibc
on the target, I wouldn't want it to do that.The text was updated successfully, but these errors were encountered: