Then I turned to use cmd with mingw32-64 （g++ Ver.5.2.0） instead of msys2 . till now I haven't got any problems.

about half a year ago, I encountered this problem when I was building Qt5 with msys2. Thus this might be a bug of msys2. Also I guess there might be something to do with multi-threaded compiling. but not for sure, as I didn't verrfy that.