The bootloader which ships with Arduino IDE is version 4 which was already in the Uno from factory. To use the do_spm function you need Optiboot 8 build with this support enabledbuild with this support enabled. It is not enabled in the default builds, because it doesn't fit in the usual Optiboot size for Uno. It
The hex file of the bootloader is not enabled inhere. Simply replace the default builds, because it doesn't fithex file in the usual Optiboot size for UnoAVR boards package with this one.