Fail more gracefully when OpenGL can't start due to a driver problem
Description
Sometimes (normally after a libcuda package update without having yet restarted), Ubuntu 18 enters in a state where GLX does not work properly. Other applications issue then a warning about this problem. If you start e.g. glxgears, it says it cannot run. If you type nvidia-smi, it says:
Failed to initialize NVML: Driver/library version mismatch
For KiCad, the main project window starts well, but when you click on e.g. schematic editor, it fails silently.
I am not sure if it is possible to prevent these crashes on KiCand by showing an popup window or something like that warning about the problem ("Can't open eeschema"). First I was thinking it was some problem with the nightlies and was trying to look for other projects, other versions, etc... until I found out about the GLX stuff.
Side note, the solution when this happens is to restart the computer, see https://stackoverflow.com/a/43023000/7471760
KiCad Version
Application: KiCad
Version: 5.99.0-unknown-0cdffa16d4~142~ubuntu18.04.1, release build
Libraries:
wxWidgets 3.0.4
libcurl/7.58.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.4 libpsl/0.19.1 (+libidn2/2.0.4) nghttp2/1.30.0 librtmp/2.3
Platform: Linux 5.4.0-89-generic x86_64, 64 bit, Little endian, wxGTK, mate, x11
Build Info:
Date: Oct 28 2021 22:26:45
wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.22
Boost: 1.65.1
OCC: 7.5.2
Curl: 7.58.0
ngspice: unknown
Compiler: GCC 7.5.0 with C++ ABI 1011
Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON