update dependencies

(cherry picked from commit fd4eafe8ca35ef95ef3ef02fc3d2b80614677505)

Also apply the same fix to win32/Makefile.mingw.
This partly reverts the commit 802ac504d47894ee7f4426e42ddf39912adea9c0.