veandco / go-sdl2

SDL2 binding for Go
https://godoc.org/github.com/veandco/go-sdl2
BSD 3-Clause "New" or "Revised" License
2.17k stars 219 forks source link

windows build warning: SDL_GetRevisionNumber #542

Open wushu037 opened 1 year ago

wushu037 commented 1 year ago

I got an error when I tried to compile the windows platform (Both compiling with cross-platform and compiling directly on windows gave me an error) macos to windows image

windows image

veeableful commented 1 year ago

Hi @wushu037, could you try with the latest version which is v0.4.25 and see if it's still happening? It seems like you were using v0.3.3.

wushu037 commented 1 year ago

Hi @veeableful , thank you very much, I tried it and now it compiles successfully. (But there are some problems running. I'm using go-sdl2 indirectly from the gobot library, where should I ask)

veeableful commented 1 year ago

Hi @wushu037, it seems like you have already asked in the right place! If you need a fix now, I think you may be able to just simply use older SDL2 versions such as 2.0.12 or maybe even 2.0.14.

On second look, it seems like the error is just a warning so maybe you were able to compile it? Did it produce the gamepad-keys-map executable?

wushu037 commented 1 year ago

Hi @veeableful , thank you for your interest!

1. I modified to the latest version and the warning is gone

2. oh, indeed. I updated the issue in gobot, thank you. It does compile the executable. As for why I got the warnings and errors confused, it's because in the program I wrote myself, I still used robotgo and used it to call the system screenshot. (I actually just implemented a small function to map joystick shared keys to system shortcuts)

And when I compiled it on a Mac with the cross-platform compilation script provided in the readme for go-sdl2, not only did I get a warning from go-sdl2, but I also got a fatal error from robotgo. This caused me to describe the warning as an error in the description, so sorry about that image

To be honest, I don't know how to fix this at the moment, because I'm not very familiar with that cross-platform compilation script provided by go-sdl2

veeableful commented 1 year ago

Hi @wushu037, I think you could try using Docker or Podman to run the cross-compilation under Linux which seems to be a supported way of cross-compiling for robotgo. If you want to cross-compile on macOS, you might need to build zlib using the mingw-w64 tools so robotgo can use it but it might be more troublesome than just using Linux container to do it.