It could well be that a workaround has already been proposed, but:

$ sudo apt-get install texlive-latex-extra texlive-fonts-recommended texlive-fonts-extra texlive-base texlive-latex-base texlive-lang-greek texlive-xetex xterm git
$ git clone git://git.code.sf.net/p/gretl/git gretl-git
$ cd gretl-git
$ sudo apt-get build-dep gretl
$./configure --prefix=/usr/local --enable-quiet-build --enable-openmp --enable-build-doc
$ make -j4 # all runs fine, but then ...
$ make pdfdocs

[...]

Package natbib Warning: Citation `koenker-zhao94' on page 74 undefined on input
line 6503.

Package natbib Warning: Citation `koenker94' on page 74 undefined on input line
6511.

Package natbib Warning: Citation `koenker-machado99' on page 74 undefined on in
put line 6512.

[74]
! Missing $ inserted.
<inserted text>  
               $
l.6592 ...re separated by an underscore: eg snake_
                                                 case)
?

Thoughts?

Cheers, Clive