You should really read what that error message said. If you simply run command:
sudo apt-get install iperf
you will get iperf
installed without the need to compile it from source - at least it did for me.
That said, please consider using (or least trying) more modern equivalent of iperf
, namely nuttcp
. nuttcp
seems to be better supported, and, according to some sources, works better.
You can install nuttcp on Ubuntu using:
sudo apt-get install nuttcp