Closed wintermute-cell closed 5 months ago
I don't think this issue is related to the issue you linked. https://github.com/gen2brain/raylib-go/issues/373 (and the delve and go issues related to it) seems to boil down to the apple linker. This issue does not appear to be affected by the underlying C compiler and linker (I tried gcc, clang and internal linking).
Furthermore, I was not able to reproduce the bug without raylib-go specifically. While it might be possible that the actual error lies somewhere within the go toolchain, I think further investigation why this problem occurs with specifically raylib-go would be worthwhile.
Hence I'd like to ask you to please reopen this.
The issue is the support for Delve and CGO, I don't think anyone managed to debug i.e. InitWIndow() and OpenGL context with Delve. Whatever the issue is, and how Delve works with C will not be fixed here in this repo. Unless you are sure that raylib-go is the problem and you can identify the issue, I don't see a reason for the issue to be kept open.
Okay, I found out more. The problem actually has nothing to do with the -gcflags, sorry for the misdirection. Passing the gcflags simply skipped my existing build cache, which I discovered when clearing said cache.
Well, now I can't build raylib-go at all anymore, always encountering this error:
Since I don't know a lot about CGO, I am again pretty lost and would appreciate some insight if you have any. I tried all kinds of Go versions, from 1.19 to 1.22, none work; so I'm not sure what could have broken the process since it last compiled successfully.
Sorry again for the incorrect investigation so far!
Do you have a C compiler installed?
yes
~ % gcc --version
gcc (GCC) 13.2.0
And you are not using vendor and CGO_ENABLED=1?
yes
Okay, I finally figured it out!
It was an exec $SHELL
at the end of my CGO shell hook. I have no idea why it would cause this issue, but for me it is fixed now.
Thanks again, and sorry for the fuss.
Hey!
Running
dlv debug cmd/game/main.go
fails:So far, I have traced this down to this flag dlv uses to disable inlining and optimizations for gc:
-gcflags "all=-N -l"
When running
go build -o outfile -gcflags "all=-N -l" cmd/game/main.go
, the same error occurs:Both flags individually cause the same problem (so either
-N
or-l
is enough to break it). Edit: other gcflags seem to cause the same problem.Not sure where I could continue searching from this point on.