SDL icon indicating copy to clipboard operation
SDL copied to clipboard

/usr/local/include not included for X11 headers on FreeBSD when linking with CMake

Open Clownacy opened this issue 2 years ago • 3 comments

This seems to be a slightly different version of #2915, except instead of being an issue with building SDL, it's an issue with building software that uses SDL.

SDL_syswm.h includes X11 headers, even though they may not be available in the default include paths. In particular, FreeBSD keeps its X11 headers in /usr/local/include, which is not searched by default (at least by Clang). Linking SDL with CMake doesn't result in /usr/local/include being added as an include path, resulting in build errors.

Downstream projects could include /usr/local/include to work around this, but I feel that would be a workaround for an upstream problem.

This issue was encountered with SDL 2.0.22.

Clownacy avatar Aug 14 '22 20:08 Clownacy

Related, here is an OpenBSD patch to address this: http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/ports/devel/sdl2/patches/patch-sdl2-config_in?rev=1.3&content-type=text/plain&hideattic=1

slouken avatar Aug 16 '22 16:08 slouken

Related, here is an OpenBSD patch to address this: http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/ports/devel/sdl2/patches/patch-sdl2-config_in?rev=1.3&content-type=text/plain&hideattic=1

For OpenBSD, that is why we have @X_CFLAGS@ for /usr/X11R6/include. But the root @includedir@ was added for /usr/local/include for other of the required dependencies.

brad0 avatar Aug 31 '22 06:08 brad0

https://github.com/libsdl-org/SDL/pull/6084 should fix this, but I'm unsure whether this is a good approach.

madebr avatar Aug 31 '22 11:08 madebr

#7923 should fix this for SDL3. SDL2 will keep the status quo. Can anybody with FreeBSD test this pr?

madebr avatar Jul 04 '23 22:07 madebr