Found what was causing the problem from here. I don't know why but running without -j4 like this: mingw32-make there is no error and qt is built successfully. I thought that without -j4 I would see the error message but luckily there was no error.