I spent many days trying to figure out what the problem was. And it turn out to be really silly.
The date of the server was wrong, so every time I downloaded the source of Postgres "it had an stamp on the future", I just set the correct date and everything worked out fine.