If you are getting errors in check() then you can either pass --nocheck and makepkg will skip that or build in chroot.
If you getting errors in build() then try building in chroot. It is really simple to set one up https://wiki.archlinux.org/title/DeveloperWiki:Building_in_a_clean_chroot#Setting_up_a_chroot
If you are still getting errors then unfortunately I can't help you, because this works on chroot on 2 machines that I own.
Pinned Comments