I think you can fix the bug by adding "#undef malloc" to the list of undefs in src/make-prime-list.c. You might want to give that a try. But this business with the primes has bitten us before, and I'd like to install the attached more-ambitious patch instead, which you might also like to try. Most of this patch is a table of primes.