I searched around apt for sdl2 packages until i found this:
$ apt search libsdl2
Sorting... Done
Full Text Search... Done
libsdl2-2.0-0/focal,now 2.0.10+dfsg1-3 amd64 [installed]
Simple DirectMedia Layer
libsdl2-dev/focal,now 2.0.10+dfsg1-3 amd64 [installed]
Simple DirectMedia Layer development files
libsdl2-doc/focal,focal 2.0.10+dfsg1-3 all
Reference manual for libsdl2
libsdl2-gfx-1.0-0/focal,now 1.0.4+dfsg-3 amd64 [installed,automatic]
drawing and graphical effects extension for SDL2
libsdl2-gfx-dev/focal,now 1.0.4+dfsg-3 amd64 [installed]
development files for SDL2_gfx
libsdl2-gfx-doc/focal,focal 1.0.4+dfsg-3 all
documentation files for SDL2_gfx
libsdl2-image-2.0-0/focal,now 2.0.5+dfsg1-2 amd64 [installed,automatic]
Image loading library for Simple DirectMedia Layer 2, libraries
libsdl2-image-dev/focal,now 2.0.5+dfsg1-2 amd64 [installed]
Image loading library for Simple DirectMedia Layer 2, development files
libsdl2-mixer-2.0-0/focal,now 2.0.4+dfsg1-2build1 amd64 [installed,automatic]
Mixer library for Simple DirectMedia Layer 2, libraries
libsdl2-mixer-dev/focal,now 2.0.4+dfsg1-2build1 amd64 [installed]
Mixer library for Simple DirectMedia Layer 2, development files
libsdl2-net-2.0-0/focal 2.0.1+dfsg1-4 amd64
Network library for Simple DirectMedia Layer 2, libraries
libsdl2-net-dev/focal 2.0.1+dfsg1-4 amd64
Network library for Simple DirectMedia Layer 2, development files
libsdl2-ttf-2.0-0/focal,now 2.0.15+dfsg1-1 amd64 [installed,automatic]
TrueType Font library for Simple DirectMedia Layer 2, libraries
libsdl2-ttf-dev/focal,now 2.0.15+dfsg1-1 amd64 [installed]
TrueType Font library for Simple DirectMedia Layer 2, development files
When I (via apt) installed libsdl2-dev
the /usr/bin/ld: cannot find -lSDL2
part of the error disappeared when I recompiled, so I continued on and installed libsdl2-mixer-dev
, libsdl2-image-dev
, libsdl2-ttf-dev
and libsdl2-gfx-dev
And after that it compiled and worked perfectly!
So it would seem that
/usr/bin/ld: cannot find -lSDL2
linker error is fixed by installing libsdl2-dev
,
-lSDL2_mixer
linker error with libsdl2-mixer-dev
,
etc.
This also fixed the same problem with the sdl2 crate I was having.
P.S.
I used sdl2 0.35.2 and pix-engine 0.7.0, the current latest versions