-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/cgo: wrong parse cgo overlay file #66142
Comments
are you sure those instructions reproduce the issue? |
Yes i am sure |
For the record, the way that the compiler decides that it is looking at a cgo-generated file is that the file name starts with Presumably that test is somehow being confused by the use of So, with that background: what are you trying to do? Why is this an important use case that we need to address in cmd/go and cmd/compile? |
I attempted to export C symbols without the -std flag, as discussed here Interestingly, when I use both the -overlay and -trimpath options, the compilation succeeds, but the behavior seems strange. $ go build -trimpath -overlay=overlay.json example_cgo.go
$ echo $?
0 |
CC @golang/compiler |
In triage: It seems like you're trying to use |
I'm looking to utilize cgo pragmas such as Regarding the compilation of cgo files with the $ go build -trimpath -overlay=overlay.json example_cgo.go
$ echo $?
0 |
These directives are intended for internal use of the Go implementation itself. They are not supposed to be used in user code. Please use cgo as documented in https://go.dev/cmd/cgo , instead of trying to bypass the restrictions with -overlay. Thanks. |
Go version
go1.22.0 linux/amd64
Output of
go env
in your module/workspace:What did you do?
Go code:
example.go
I run cgo:
next I build go file with
-overlay
optionoverlay.json:
go build -overlay=overlay.json example_cgo.go
What did you see happen?
errors:
What did you expect to see?
nothing/no error, because
_obj/_cgo_gotypes.go is a cgo-generated file
The text was updated successfully, but these errors were encountered: