To provide an alternative to Adrian's answer: if you prefer to use proprietary drivers sourced directly from NVIDIA instead of those found in a PPA, installing (or in my case, re-installing) the latest proprietary driver can help eliminate the swrast error.
If you don't have the NVIDIA driver yet, download the driver from NVIDIA's website. Next, switch to tty (ctrl
+alt
+F1
) and turn off your login manager:
If using lightdm, $ sudo service lightdm stop
If using gdm, $ sudo service gdm stop
Navigate to the install script and run it, and follow the prompts. Don't worry if the pre-install script fails. I always accept registering DKMS and the 32-bit compatibility libraries. After the driver is installed, restart your machine:
$ sudo reboot
If you already have an install script from an older NVIDIA driver, simply run the NVIDIA driver install script as oulined above, but with the "--update" option:
$ sudo ./NVIDIA-Linux-x86_64-***.**.run --update
This will get you the most up-to-date version of the driver.
Doing this fixed my libGL error: failed to load driver: swrast
error.
libGL.so
:LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/mesa ./glprogram
. By default, my Ubuntu 16.04 uses/usr/lib/nvidia-361/libGL.so
because of/etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf
and it all works fine.