When linking libraries statically, you must also statically link all their dependencies. Try running
pkgconf --libs --static sdl2
, this should give you the correct flags (or pkg-config
instead of pkgconf
) (on some distros, SDL2
instead of sdl2
).