Build gperftools correctly

Review 1210 by @mlucy