I've got something that works for me. I'm using 2.50, so I'd
appreciate it if someone using 2.45 or below could check that it
builds and isn't completely broken.

I checked the patch on Debian 10.6, with librsvg2 2.44.10-2.1. Compilation failed with the following error (path sanitized)

/usr/bin/ld: image.o: in function `svg_load_image':
emacs/src/image.c:9810: undefined reference to `rsvg_handle_set_stylesheet'
/usr/bin/ld: emacs/src/image.c:9924: undefined reference to `rsvg_handle_set_stylesheet'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:651:temacs] error 1
make[1]: leaving directory “emacs/src”
make: *** [Makefile:424:src] error 2

BTW, the patch fixes the problem on Arch Linux, with librsvg 2:2.50.1-1.

Sheng Yang(杨圣), PhD candidate
Computer Science Department
University of Maryland, College Park
E-mail: styang@fastmail.com
E-mail (old but still used): yangsheng6810@gmail.com