We should probably add [a proper Autoconf check](https://github.com/geany/geany/blob/46d5e7542b8396ed593f2e319f71d153a67684dc...) for `realpath` if mingw's newlib activates it for windows.
As a possible workaround, you could try [updating your msys2](https://wiki.archlinux.org/index.php/pacman#Upgrading_packages), judging by the GCC version, it's rather out of date.