Undefined reference to `TVirtualX::GetOpenGLScalingFactor()'

In general, make sure you have “completely removed” (i.e. use “remove with any associated configuration files”) all standard Ubuntu’s ROOT packages (this also removes the “/etc/root” subdirectory).
In the “Synaptic Package Manager”, in the “Quick search” field, type “cern root”, then select all (Ctrl-A) found packages and mark them to be “completely removed”, then click the “Apply” button.
See also [url]ROOTSYS and linux distribution installation and [url]Release 5.32.03 on Ubuntu 12.04