go-sdl2 icon indicating copy to clipboard operation
go-sdl2 copied to clipboard

Compile broken with old SDL?

Open shish opened this issue 2 years ago • 11 comments

Trying to build inside github actions, where the current version of SDL is 2.0.8

| /root/go/src/github.com/veandco/go-sdl2/sdl/render.go:330:14: could not determine kind of name for C.GoString
| /root/go/src/github.com/veandco/go-sdl2/sdl/render.go:865:3: could not determine kind of name for C.RenderCopy
| /root/go/src/github.com/veandco/go-sdl2/sdl/render.go:354:14: could not determine kind of name for C.SDL_CreateRenderer
[...]
| gcc errors for preamble:
| /root/go/src/github.com/veandco/go-sdl2/sdl/render.go: In function 'SDL_LockTextureToSurface':
| /root/go/src/github.com/veandco/go-sdl2/sdl/render.go:204:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
|  {
|  ^
| /root/go/src/github.com/veandco/go-sdl2/sdl/render.go:213:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
|  {
|  ^
| cgo-generated-wrapper:1:0: error: expected '{' at end of input

It looks to my eyes like the SDL_LockTextureToSurface stub for pre-2.0.12 versions is missing a body?

https://github.com/veandco/go-sdl2/blob/0abc017f41d3daacca87cef4f36cbab8a95e1b14/sdl/render.go#L193

shish avatar Oct 10 '21 13:10 shish

Thanks, @shish for reporting the issue! I have pushed the fix to master and v0.4.x branches.

veeableful avatar Oct 11 '21 03:10 veeableful

Also broken with SDL 2.0.10.

../../go/pkg/mod/github.com/veandco/[email protected]/sdl/timer.go:22:16: could not determine kind of name for C.SDL_GetTicks64

Since this commit: https://github.com/veandco/go-sdl2/commit/06f44fad53c24fe011318f3bc2c2d31bac315e7c

This function is only available in SDL 2.0.18.

AXDOOMER avatar Mar 14 '22 00:03 AXDOOMER

Hi @AXDOOMER, thanks for reporting the issue! I have fixed it in the latest tag release v0.4.16.

veeableful avatar Mar 14 '22 03:03 veeableful

Looks like another one just appeared

../../../go/src/github.com/veandco/go-sdl2/sdl/log.go:55:18: could not determine kind of name for C.SDL_LogCategory

Using latest go-sdl2 and libsdl 2.0.10

Example of a build that was working a couple of days ago and not today: https://github.com/shish/rosettaboy/runs/7602639263

shish avatar Aug 01 '22 02:08 shish

Hi @shish, did it really use the latest go-sdl2 which is v0.4.24? The go.sum seems to suggest that it's using v0.4.10.

veeableful avatar Aug 01 '22 04:08 veeableful

Looks like I was actually ignoring go.sum because my github actions script installed the latest go-sdl from the main branch before it even checks out my project code ^^;

(I am not a go expert, I don't even know how to install specific versions of things >.>)

shish avatar Aug 01 '22 10:08 shish

Bumping go.sum to use v0.4.24 also seems to hit the same error

shish avatar Aug 01 '22 10:08 shish

Actually, this happens before even getting to my code at all - just taking a fresh github actions VM, running sudo apt-get update && sudo apt-get install -y golang libsdl2-dev + go get github.com/veandco/go-sdl2/sdl

shish avatar Aug 01 '22 12:08 shish

Hi @shish , it seems like the container is using Go provided by Ubuntu 18.04 which is relatively old at v1.10. Could you use newer Go, at least v1.13? Since we are using Go modules now, the minimum Go version has been bumped to v1.13.

veeableful avatar Aug 02 '22 12:08 veeableful

I'm not sure where you're seeing ubuntu-18.04 / golang 1.10 -- I was using the ubuntu-20.04 base with golang 1.13 :S (See the "install deps" logs in https://github.com/shish/rosettaboy/runs/7602639263?check_suite_focus=true )

However, using the "ubuntu-22.04 beta" container with golang 1.18 + libsdl2 2.0.20 appears to work, so that's enough for me :)

shish avatar Aug 02 '22 13:08 shish

Oh I'm sorry, I must have confused it with another new issue which has the same issue as yours and same way of using Ubuntu's Go package. It seems like it might not only be the Go version issue as our Github Actions for v0.4.x have been building fine with Go 1.13 though it's using latest Ubuntu. I will see if I can make it work with Ubuntu 20.04 as well if there's truly an issue with it somewhere.

veeableful avatar Aug 02 '22 14:08 veeableful