libfreeimage fails to build with GCC 14+ compilers due to issues in the bundled libjxr library. Debian's libjxr library has some fixes:
https://sources.debian.org/patches/jxrlib/1.2~git20170615.f752187-5.3/0013-jxrlib-ftbfs-with-GCC-14.patch/
https://sources.debian.org/patches/jxrlib/1.2~git20170615.f752187-5.3/0015-FTBFS-fix-for-function-prototype-error.patch/
which are needed to get the build working.