Remove -static flag and use --disable-shared when building debug binaries.