Edit: I changed the title to better reflect what I am asking (was "Installing Ruby on Windows breaks Go debugging due to MSYS changes")
Update: I can now debug the code (after removing -race from my build configuration). However, the question still remains how to get this to work when using race detection or CGO on Windows.
Since I installed Ruby on my Windows system (1,000 times more tedious to get working than Go :) I find I can't use the -race option or CGO. I get errors irrespective of which version of gcc is used. I've tried Go 1.16.6 and 1.17.10 and gcc 5.1, 6.4, 8.1, 12.1. Errors are like this:
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../lib/libmsvcrt.a(/359): duplicate symbol reference: _unlock_file in both libgcc(.text) and libgcc(.data)
libgcc(.text): relocation target atexit not defined
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libmingwex.a(/6215): duplicate symbol reference: .refptr.__imp___mb_cur_max in both libgcc(.rdata$.refptr.__imp___mb_cur_max) and libgcc(.rdata$.refptr.__imp___mb_cur_max)
C:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/5.1.0/../../../../x86_64-w64-mingw32/lib/../lib/libmsvcrt.a(/47): duplicate symbol reference: _set_output_format in both libgcc(.text) and libgcc(.data)
runtime/cgo(.text): relocation target __imp___acrt_iob_func not defined
runtime/cgo(.text): relocation target __imp___acrt_iob_func not defined
runtime/cgo(.text): relocation target __imp___acrt_iob_func not defined
libgcc(.rdata$.refptr.__imp___mb_cur_max): relocation target __mb_cur_max not defined