mameau%CWD%:> █
OFFLINE
$ cat cross-compilation-windows.txt
Notes on cross-compiling Windows MAME on Linux

Linux: Ubuntu Focal (20.04) 64b
MAME: 0242

Refer: https://docs.mamedev.org/initialsetup/compilingmame.html#cross-compiling-mame

Install required tools
# apt-get install g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64

gets you version *-9.3.0-7ubuntu1+22~exp1ubuntu4

The min command line that may successfully compile MAME
$ make \
 TARGETOS=windows \
 PTR64=1 \
 OVERRIDE_CC=x86_64-w64-mingw32-gcc-posix \
 OVERRIDE_CXX=x86_64-w64-mingw32-g++-posix \
 OVERRIDE_LD=x86_64-w64-mingw32-ld \
 MINGW64=/usr**

Compare this to official doco and you note '-posix' is appended to the OVERRIDE_C* opts, this gets around std:reccusive_mutex type errors

My actual command to build w/tools, etc

make \
 -j12 \
 NOWERROR=1 \
 TARGETOS=windows \
 PTR64=1 \
 OVERRIDE_CC=x86_64-w64-mingw32-gcc-posix \
 OVERRIDE_CXX=x86_64-w64-mingw32-g++-posix \
 OVERRIDE_LD=x86_64-w64-mingw32-ld \
 MINGW64=/usr** \
 CFLAGS='-U_FORTIFY_SOURCE' \
 TOOLS=1 \
 REGENIE=1 \
 STRIP_SYMBOLS=1 

or for a debug windows build add

 STRIP_SYMBOLS=0 \
 DEBUG=1