veandco / go-sdl2

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

go-sdl2 does not compile on macos x #74

Closed AuroreDupont closed 9 years ago

AuroreDupont commented 9 years ago

I have the following error:

go get -v github.com/veandco/go-sdl2/sdl{,_mixer,_image,_ttf} github.com/veandco/go-sdl2/sdl

github.com/veandco/go-sdl2/sdl

gotree/src/github.com/veandco/go-sdl2/sdl/syswm.go:5:10: fatal error: 'SDL2/SDL_syswm.h' file not found

include <SDL2/SDL_syswm.h>

     ^

Maybe the following line is missing:

cgo pkg-config: sdl2

(from http://golang.org/cmd/cgo/)

aqiank commented 9 years ago

Hi, I pushed a patch that should solve the issue. Please try again. Thanks!

AuroreDupont commented 9 years ago

pkg-config --cflags sdl2 returns: -D_THREAD_SAFE -I/homebrew/include/SDL2 (including the SDL2 folder) #include 'SDL2/SDL_syswm.h' still fails.

stephanbruny commented 9 years ago

same on windows (cygwin). there simply is no SDL2-folder in the SDL installation. SDL-headers are all to be put into standard include-directory without subfolder. Changing the line 5 in syswm.go from #include <SDL2/SDL_syswm.h> to #include <SDL_syswm.h> will fix it.

aqiank commented 9 years ago

I pushed an update again. Could you guys try it? I'm not sure about the cygwin environment though, might need to add a bit more preprocessor condition for that environment.

stephanbruny commented 9 years ago

is there a reason for searching the SDL_syswm.h in a "SDL2"-subfolder?

As for cygwin, I'd just remove any includes containing "SDL2"-subfolder just using #include<SDL_something.h>

Same goes for (my) iMac. All package managers I know (so far) are not putting SDL-headers in a subfolder.

Just remove SDL2/ - if not a Linux-distribution installs SDL headers there by default?

aqiank commented 9 years ago

I believe it's there for MinGW people. If that's not the case, let me know!

AuroreDupont commented 9 years ago

The last patch works for me. Thank you.