I was able to build for PostgreSQL 10.4 with the following command below:
sudo apt install -y libreadline-dev libperl-dev libz-dev
pgenv build 10.4
OS:
Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-33-generic x86_64)
Everything is fine. But then, the problem is how to use it