-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/go: cannot compile Go binary with external linking without cgo with v1.22.0 #65887
Comments
A bit of a blind shot but what happens if you use |
I'm confused by |
maybe more like #64875 |
External linking without cgo is fragile. The external linker will usually link in some C objects (like the startup code) anyway, and without cgo the interaction between the C code and Go code may not work correctly. So we require cgo for external linking. To get cgo working, as @Jorropo mentioned, you'll want to set
It is ignored as the target is not ARM.
The @bcmills maybe we want to mention that cgo is required for external linking in the release notes? |
This is working as intended — this was the fix for #46330, prior to which the linker would report I agree that adding a Go 1.22 release note seems appropriate. |
Here's the output when I run
|
@damcadam I think you are in C cross compilation sucks land. |
@damcadam, I suggest that you file an issue for that with the bootboot developers. Go does not provide a supported bare-metal port, so building a bare-metal kernel using the Go toolchain is inherently not something the Go project supports either. See previously: |
Hello, it looks like someone filed an issue with BootBoot that's having the same problem. Here's the link to that: |
Change https://go.dev/cl/569296 mentions this issue: |
@damcadam, I'm sorry, but what you're asking for just isn't a supported Go build configuration. Perhaps you can change the BootBoot Go example to build using internal linking instead of external? |
@bcmills If building with internal linking will work for Go 1.22 and future versions of Go that would be awesome! Do you have any guidance or resources I could use for using internal linking instead of external linking? |
Passing |
Sorry about the late reply. I ended up using the |
Go version
go version go1.22.0 linux/amd64
Output of
go env
in your module/workspace:What did you do?
I am trying to make BootBoot from the following path:
https://gitlab.com/bztsrc/bootboot/-/tree/master/mykernel/go?ref_type=heads
I am just running the make command.
What did you see happen?
I have found that this does not work with Go 1.22.0. The error message from making is shown below.
What did you expect to see?
Making this code used to work in Go 1.21.7. I expected to see the following output.
I am developing an embedded OS in Go. Compiling this code (the default bootboot kernel) works with Go version 1.21.7, but fails with the compiler changes in Go 1.22.0, like so:
The output from making with CGO enabled while using Go 1.22.0 is also shown below.
If I am no longer supposed to be able to use an external linker while compiling with CGO disabled, how can I get past this compilation error?
The text was updated successfully, but these errors were encountered: