Thanks a million for the patch! I managed to make this work on Asahi Linux Mac M1, this being the last missing dependency for linuxcnc-sim that I struggled with for a few days. I attach the PKGBUILD with this patch included from https://aur.archlinux.org/packages/tkimg that I used for building the package.