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

SDL2_framerate.h not such file or directory #565

Open piotao opened 1 year ago

piotao commented 1 year ago

System: MX Linux 21 SDL2 installed and files in /usr/include/SDL2 exists (see attached file with ls -R - zipped)

Steps to reproduce in $HOME/go/src/esdeel directory:

  1. go mod init
  2. Write a simple program for SDL2 testing (attached main.go in zip)
  3. go get github.com/veandco/go-sdl2/sdl (no errors)
  4. go get github.com/veandco/go-sdl2/gfx (no errors)
  5. go build (or go run, doesn't matter)

Error: esdeel$ go build .

github.com/veandco/go-sdl2/gfx

In file included from ../../pkg/mod/github.com/veandco/go-sdl2@v0.4.34/gfx/sdl_gfx.go:5: ./sdl_gfx_wrapper.h:8:11: fatal error: SDL2_framerate.h: No such file or directory 8 | #include | ^~~~~~ compilation terminated.

HOW I FIXED THAT:

  1. Opened file ~/go/pkg/mod/github.com/veandco/go-sdl2@v0.4.34/gfx/sdl_gfx_wrapper.h and manually changed linux includes from default to their direct paths:

    include "/usr/include/SDL2/SDL2_framerate.h"

    etc.

  2. Changed file is included.
  3. This worked, and now I have graphics window which draws lines. I assume this fix is working! :) File is included in zip file too.

files.zip

veeableful commented 1 year ago

Hi @piotao, we rely on pkg-config --cflags sdl2 to find the SDL2 include directory. I wonder if MX Linux doesn't provide it or SDL2's pkgconfig directory is not in PKG_CONFIG_PATH environment variable?

hfiguiere commented 1 month ago

Shouldn't this be pkg-config --cflags SDL2_gfx in that case?

hfiguiere commented 1 month ago

SDL2_framerate.h comes with SDL2_gfx so that's the package that should be checked for that header.

veeableful commented 1 month ago

Hi @hfiguiere, thank you for the suggestion. I have updated the pkg-config to use sdl2_gfx in the v0.4.39 tag.