Link to this batch file rem rem rem MSYS2 GCC BUILD (INSTRUCTIONS FROM LH_MOUSE) rem rem 1. Install MSYS2 (script below assumes default install in c:\msys64) rem 2. Run an MSYS2 terminal window rem 3. Run my MSYS2 build script rem rem THE REST OF THIS SCRIPT (BELOW) SHOULD BE RUN AS A MS-DOS BATCH FILE rem rem EXTRACT PACKAGES CREATED BY MSYS2 TERMINAL SESSION rem rem Install folder rem set MINGW_INSTALL=d:\mingw64_gcc12.2.0-7_willus.com rem rem Folder containing rsxnt.dll and make.exe. Not required. rem Comment this out if you want. rem set RSXNT_DIR=c:\bin rem rem Folder where MSYS-2 was installed rem set MSYS=c:\msys64 set PKGDIR=%MINGW_INSTALL%\tarfiles rem rem Gcc version rem set GCCVER=12.2.0 rem rem (This will fail if it already exists anyway) mkdir "%MINGW_INSTALL%" cd /d "%MINGW_INSTALL%" rmdir /s /q mingw64 mingw32 7z -y x "%PKGDIR%\*.tar" del /q .PKGINFO .MTREE .BUILDINFO rem rem rem BUILD MINIMAL GCC INSTALL FOR MULTILIB rem rmdir /s /q bin include lib mkdir bin cd bin mkdir x64 cd x64 copy /y "%MSYS%\mingw64\bin\ar.exe" copy /y "%MSYS%\mingw64\bin\as.exe" copy /y "%MSYS%\mingw64\bin\addr2line.exe" copy /y "%MSYS%\mingw64\bin\c++filt.exe" copy /y "%MSYS%\mingw64\bin\dll*.exe" copy /y "%MSYS%\mingw64\bin\gcov-dump.exe" copy /y "%MSYS%\mingw64\bin\gprof.exe" copy /y "%MSYS%\mingw64\bin\ld.bfd.exe" copy /y "%MSYS%\mingw64\bin\ld.exe" copy /y "%MSYS%\mingw64\bin\nm.exe" copy /y "%MSYS%\mingw64\bin\objcopy.exe" copy /y "%MSYS%\mingw64\bin\objdump.exe" copy /y "%MSYS%\mingw64\bin\ranlib.exe" copy /y "%MSYS%\mingw64\bin\readelf.exe" copy /y "%MSYS%\mingw64\bin\size.exe" copy /y "%MSYS%\mingw64\bin\strings.exe" copy /y "%MSYS%\mingw64\bin\strip.exe" copy /y "%MSYS%\mingw64\bin\windmc.exe" copy /y "%MSYS%\mingw64\bin\windres.exe" copy /y "%MSYS%\mingw64\bin\libwinpthread-1.dll" copy /y "%MSYS%\mingw64\bin\libgmp-10.dll" copy /y "%MSYS%\mingw64\bin\zlib1.dll" copy /y "%MSYS%\mingw64\bin\libisl-23.dll" if "%RSXNT_DIR%"=="" goto skip1 copy /y "%RSXNT_DIR%\make.exe" copy /y "%RSXNT_DIR%\rsxnt.dll" :skip1 copy /y ..\..\mingw64\bin\* copy /y "..\..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\*.exe" copy /y "..\..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\*.spec" cd .. mkdir x32 cd x32 copy /y "%MSYS%\mingw32\bin\ar.exe" copy /y "%MSYS%\mingw32\bin\as.exe" copy /y "%MSYS%\mingw32\bin\addr2line.exe" copy /y "%MSYS%\mingw32\bin\c++filt.exe" copy /y "%MSYS%\mingw32\bin\dll*.exe" copy /y "%MSYS%\mingw32\bin\gcov-dump.exe" copy /y "%MSYS%\mingw32\bin\gprof.exe" copy /y "%MSYS%\mingw32\bin\ld.bfd.exe" copy /y "%MSYS%\mingw32\bin\ld.exe" copy /y "%MSYS%\mingw32\bin\nm.exe" copy /y "%MSYS%\mingw32\bin\objcopy.exe" copy /y "%MSYS%\mingw32\bin\objdump.exe" copy /y "%MSYS%\mingw32\bin\ranlib.exe" copy /y "%MSYS%\mingw32\bin\readelf.exe" copy /y "%MSYS%\mingw32\bin\size.exe" copy /y "%MSYS%\mingw32\bin\strings.exe" copy /y "%MSYS%\mingw32\bin\strip.exe" copy /y "%MSYS%\mingw32\bin\windmc.exe" copy /y "%MSYS%\mingw32\bin\windres.exe" copy /y "%MSYS%\mingw32\bin\libwinpthread-1.dll" copy /y "%MSYS%\mingw32\bin\libgmp-10.dll" copy /y "%MSYS%\mingw32\bin\zlib1.dll" copy /y "%MSYS%\mingw32\bin\libisl-23.dll" if "%RSXNT_DIR%"=="" goto skip2 copy /y "%RSXNT_DIR%\make.exe" copy /y "%RSXNT_DIR%\rsxnt.dll" :skip2 copy /y ..\..\mingw32\bin\* copy /y "..\..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\*.exe" copy /y "..\..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\*.spec" cd .. rem rem Put liblto_plugin-0.dll in the right folders. MUST be in these folders rel. to bin. rem mkdir lib mkdir lib\gcc mkdir lib\gcc\i686-w64-mingw32 mkdir "lib\gcc\i686-w64-mingw32\%GCCVER%" copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\*.dll" "lib\gcc\i686-w64-mingw32\%GCCVER%" mkdir lib\gcc\x86_64-w64-mingw32 mkdir "lib\gcc\x86_64-w64-mingw32\%GCCVER%" copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\*.dll" "lib\gcc\x86_64-w64-mingw32\%GCCVER%" cd .. rem rem LIBRARY DIR rem mkdir lib cd lib mkdir x64 xcopy /e /y "%MSYS%\mingw64\x86_64-w64-mingw32\lib\*" x64 xcopy /y "%MSYS%\mingw64\lib\*.a" x64 xcopy /y "%MSYS%\mingw64\lib\*.o" x64 copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\*.a" x64 copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\*.o" x64 mkdir x64\adalib copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\adalib\*" x64\adalib del /q x64\*dll* mkdir x32 xcopy /e /y "%MSYS%\mingw32\i686-w64-mingw32\lib\*" x32 xcopy /y "%MSYS%\mingw32\lib\*.a" x32 xcopy /y "%MSYS%\mingw32\lib\*.o" x32 copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\*.a" x32 copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\*.o" x32 mkdir x32\adalib copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\adalib\*" x32\adalib del /q x32\*dll* cd .. rem rem INCLUDE DIR rem mkdir include cd include mkdir x64 mkdir inc mkdir inc\_x64 xcopy /y /e "%MSYS%\mingw64\include\*" inc\_x64 xcopy /y /e "%MSYS%\mingw64\x86_64-w64-mingw32\include\*" x64 xcopy /e /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\include\*" x64 mkdir x64\adainclude copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\adainclude\*" x64\adainclude copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\adainclude" x64\adainclude mkdir x64\finclude copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\finclude\*" x64\finclude copy /y "..\mingw64\lib\gcc\x86_64-w64-mingw32\%GCCVER%\finclude" x64\finclude mkdir x64\c++ xcopy /e /y "..\mingw64\include\c++\%GCCVER%\*" x64\c++ xcopy /e /y x64\c++\x86_64-w64-mingw32\* x64\c++ rmdir /s /q x64\c++\x86_64-w64-mingw32 mkdir x32 mkdir inc\_x32 xcopy /y /e "%MSYS%\mingw32\include\*" inc\_x32 xcopy /y /e "%MSYS%\mingw32\i686-w64-mingw32\include\*" x32 xcopy /e /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\include\*" x32 mkdir x32\adainclude copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\adainclude\*" x32\adainclude copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\adainclude" x32\adainclude mkdir x32\finclude copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\finclude\*" x32\finclude copy /y "..\mingw32\lib\gcc\i686-w64-mingw32\%GCCVER%\finclude" x32\finclude mkdir x32\c++ xcopy /e /y "..\mingw32\include\c++\%GCCVER%\*" x32\c++ xcopy /e /y x32\c++\i686-w64-mingw32\* x32\c++ rmdir /s /q x32\c++\i686-w64-mingw32 cd .. rem rem My utility to combine include folders rem cd include\inc imerge2 _x64 _x32 cd .. imerge inc x64 x32 xcopy /e /-y _x32\* x32 rmdir /s /q _x32 xcopy /e /-y _x64\* x64 rmdir /s /q _x64 cd .. rem rem Copy DLLs rem copy /y "%MSYS%\mingw32\bin\libzstd.dll" bin\x32 copy /y "%MSYS%\mingw64\bin\libzstd.dll" bin\x64 rem rem Clean up rem rmdir /s /q mingw64 mingw32 @echo off echo ----------------------------------------------------------------- echo NOTE! The ar.exe files in echo %MINGW_INSTALL%\bin\x64 and echo %MINGW_INSTALL%\bin\x32 echo store the incorrect date in the .ar files. They should echo be replaced by an older version of ar.ex which works echo correctly. echo See: https://github.com/msys2/MINGW-packages/issues/14857 echo NOTE2 Make sure lib\x32 has libpthreadxp.a. If it doesn't echo then copy it from a previous installatino. echo -----------------------------------------------------------------