My local MSYS2 setup on a native Windows system does *not* have `alloca.h` nor does the CI build image has it (https://github.com/geany/infrastructure/pkgs/container/geany-mingw64-ci) and both cleanly build Geany.
How do you start your build? Is the `gcc` command you posted above the same which is used to build Geany?
Just in case you didn't know, there is a howto on https://wiki.geany.org/howtos/win32/msys2 to assist in building Geany with MSYS2.