If I recall correctly, this is an issue with g2o. Try roscd g2o, and if you get an error, that is your first problem. If you do change to the g2o directory, try rosmake g2o. If it doesn't make correctly, you might need to install dependencies with rosdep install g2o. Beyond that, I can't give more specifics without further knowledge of the error.