I cannot reproduce that error on Ubuntu 18.04, using the same compiler and cmake versions.

The 'unexpected EOF' error suggests that one possibility is that the download was corrupted; you may need to download it again.

What it is the CHARMM version? Alternatively, and I've already asked this, when did you download the program?

Can you compile other Fortran programs on that machine?

Rick Venable
computational chemist