Amend to #3729.
It turns out that BerkelyDB was including inttypes.h indirectly, so our definition collided with the system header definition. We cannot fix this with just macro redefinition so we need to change the usage sites.
First commit: apply the following script to all .cpp and .h files:
# Middle
sed -i 's/"PRIx64"/x/g' "$1"
sed -i 's/"PRIu64"/u/g' "$1"
sed -i 's/"PRId64"/d/g' "$1"
# Initial
sed -i 's/PRIx64"/"x/g' "$1"
sed -i 's/PRIu64"/"u/g' "$1"
sed -i 's/PRId64"/"d/g' "$1"
# Trailing
sed -i 's/"PRIx64/x"/g' "$1"
sed -i 's/"PRIu64/u"/g' "$1"
sed -i 's/"PRId64/d"/g' "$1"
Second commit removes the definitions from util.h. The remaining definitions PRIsz/PRIpd are our own, so keep them to not generate too much diff noise...