I could be wrong but I see -Werror which can usually be counteracted by adding NOWERROR=1 in your make string. Give that a try.
That's funny because I thought I tried that but I guess I didn't do it correctly. It seems to have worked and resulted in a ~208 MB mame64 binary getting built. I also had to declare QT_SELECT, this is on an 8 core machine. Xubuntu 18.10 with gcc 8.2.0.
$ export QT_SELECT=qt5
$ make -j9 CFLAGS='-U_FORTIFY_SOURCE' NOWERROR=1