ns2 requires the VINT Xgraph .... latest is v12.1 / 12.2
An Xgraph - 4.38 is a completely different application : Not for ns2.
No reason to build xgraph from a "tar.gz" as the perfect packages .deb and .rpm are available.
Download xgraph_12.1-17_amd64.deb
cd Downloads/
sudo apt install ./xgraph_12.1-17_amd64.deb
-