Fixed bad linker flags for mingw. Fixed ar tool name.
Workaround for mingw gcc compiler bug.
see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61838