Patched to build for Ubuntu 14.04

Thanks to Sheng-Li PAN <psl@uestc.edu.cn> for the code.