PCBnew OpenGL 2.1 or higher is required

Bug #1781581 reported by Alex
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
KiCad
Fix Released
High
Unassigned

Bug Description

I've been using Kicad 4.07 for a while now, and with the release of 5.0.0-rc3, I wanted to try it out. Unfortunately, I just haven't been able to get PCBnew to work with the OpenGL canvas on my desktop. Unfortunately, I'm just not sure what may be causing the issue, but I'll provide all the relevant information that I can.

Version Information:
Application: kicad
Version: (5.0.0-rc3-dev-10-g3e22e5ccd), release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.60.0 OpenSSL/1.1.0h zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.4) nghttp2/1.32.0
Platform: Linux 4.14.52-1-MANJARO x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.67.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.60.0
    Compiler: GCC 8.1.1 with C++ ABI 1012
Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

glxinfo | grep OpenGL:
OpenGL vendor string: Advanced Micro Devices, Inc.
OpenGL renderer string: AMD Radeon HD 5800 Series
OpenGL core profile version string: 4.5.13399 Core Profile Context 15.201.1151
OpenGL core profile shading language version string: 4.40
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.5.13399 Compatibility Profile Context 15.201.1151
OpenGL shading language version string: 4.40
OpenGL context flags: (none)
OpenGL profile mask: compatibility profile
OpenGL extensions:

Revision history for this message
Thomas Pointhuber (pointhi) wrote :
Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Have you also updated the video drivers at the same time? Could you check if other OpenGL applications work correctly (e.g. glxgears)?

Changed in kicad:
status: New → Incomplete
Revision history for this message
Alex (knapik1227) wrote :

My video drivers would have been the latest proprietary ones as the free ones don't work well with my computer and I had just recently reinstalled my operating system. I tried out glxgears and it worked just fine.

Revision history for this message
Stefan Krueger (z-mail-i) wrote :
Download full text (3.3 KiB)

i have same / similar behavior:
if i try to switch to 'Modern Toolset (Accelerated)' i get the 'OpenGL 2.1 or higher is required!' message.
Additionally the 3D Viewer does not show anything (attached screenshot)

on my search i cam across this forum thread that seem to be related:
V5.0.0-rc2 OpenGL not detected, Ubuntu 18.04 https://forum.kicad.info/t/v5-0-0-rc2-opengl-not-detected-ubuntu-18-04/11318/10

the orig. poster has found that this is coursed by the nvidia-340 driver.
(that is the one i currently also use...)

i quickly tested `glxgears` and it works fine.
(blender also has a openGL user interface and runs fine)

but the kicad-ogltest fails:

stefan@stefan-Latitude-E6510:~$ kicad-ogltest

(kicad-ogltest:10373): Gtk-WARNING **: 09:58:32.620: Unable to locate theme engine in module_path: "adwaita",

(kicad-ogltest:10373): Gtk-WARNING **: 09:58:32.627: Unable to locate theme engine in module_path: "adwaita",
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
*** Caught unhandled unknown exception; terminating

i will try and switch to the Nouveau driver to test if it works for my system.
(in the past i had problems with this driver.. but eventually things have changed)

pleas let me know if i can give some more information or if i should open a separate bug for this.

my environment is

Application: kicad
Version: 5.0.0-fee4fd1~65~ubuntu18.04.1, release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.58.0 OpenSSL/1.1.0g 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 4.15.0-29-generic x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.65.1
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.58.0
    Compiler: GCC 7.3.0 with C++ ABI 1011

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

stefan@stefan-Latitude-E6510:~$ glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: NVS 3100M/PCIe/SSE2
OpenGL core profile version string: 3.3.0 NVIDIA 340.106
OpenGL core profile shading language version string: 3.30 NVIDIA via Cg compiler
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.3.0 NVIDIA 340.106
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler
OpenGL context flags: (none)
OpenGL profile mask: (...

Read more...

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Can you try running pcbnew with LIBGL_DEBUG=verbose environmental variable set? Run from a terminal command line and post the results here:
$ LIBGL_DEBUG=verbose pcbnew

Revision history for this message
Alex (knapik1227) wrote :

I just ran it and these are the results. Seems like something to do with swrast?:

LIBGL_DEBUG=verbose pcbnew
19:44:51: Warning: Mismatch between the program and library build versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1011,wx containers,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1012,wx containers,compatible with 2.8).
19:44:51: Debug: Adding locale lookup path: /usr/share/kicad/internat
19:44:51: Debug: Checking template path '/usr/local/share/kicad/template' exists
19:44:51: Debug: Checking template path '/usr/share/kicad/template' exists

(pcbnew:21048): Gtk-CRITICAL **: 19:44:53.409: IA__gtk_widget_event: assertion 'WIDGET_REALIZED_FOR_EVENT (widget, event)' failed

(pcbnew:21048): Gtk-CRITICAL **: 19:44:53.478: IA__gtk_widget_event: assertion 'WIDGET_REALIZED_FOR_EVENT (widget, event)' failed
libGL: screen 0 does not appear to be DRI2 capable
libGL: OpenDriver: trying /usr/lib/xorg/modules/dri//tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/xorg/modules/dri//swrast_dri.so
libGL: dlopen /usr/lib/xorg/modules/dri//swrast_dri.so failed (/usr/lib/xorg/modules/dri//swrast_dri.so: cannot open shared object file: No such file or directory)
libGL: OpenDriver: trying /usr/lib32/xorg/modules/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib32/xorg/modules/dri/swrast_dri.so
libGL: dlopen /usr/lib32/xorg/modules/dri/swrast_dri.so failed (/usr/lib32/xorg/modules/dri/swrast_dri.so: cannot open shared object file: No such file or directory)
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Yes, for some reason your system insists on using the software renderer and it fails. Could you try to run the same LIBGL_DEBUG test with glxgears and post the output here?

Revision history for this message
Alex (knapik1227) wrote :
Download full text (3.7 KiB)

Sure, here's the output:

LIBGL_DEBUG=verbose glxgears
libGL: AtiGetClientDriverName: 15.20.3 fglrx (screen 0)
libGL: OpenDriver: trying /usr/lib/xorg/modules/dri//fglrx_dri.so
ukiDynamicMajor: found major device number 244
ukiDynamicMajor: found major device number 244
ukiDynamicMajor: found major device number 244
ukiOpenDevice: node name is /dev/ati/card0
ukiOpenDevice: open result is 4, (OK)
ukiGetBusid returned 'PCI:1:0:0'
ukiOpenDevice: node name is /dev/ati/card1
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card2
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card3
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card4
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card5
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card6
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card7
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card8
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card9
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card10
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card11
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card12
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card13
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card14
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card15
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiDynamicMajor: found major device number 244
ukiOpenByBusid: Searching for BusID PCI:1:0:0
ukiOpenDevice: node name is /dev/ati/card0
ukiOpenDevice: open result is 4, (OK)
ukiOpenByBusid: ukiOpenMinor returns 4
ukiOpenByBusid: ukiGetBusid reports PCI:1:0:0
ukiDynamicMajor: found major device number 244
ukiDynamicMajor: found major device number 244
ukiOpenByBusid: Searching for BusID PCI:1:0:0
ukiOpenDevice: node name is /dev/ati/card0
ukiOpenDevice: open result is 5, (OK)
ukiOpenByBusid: ukiOpenMinor returns 5
ukiOpenByBusid: ukiGetBusid reports PCI:1:0:0
ukiDynamicMajor: found major device number 244
ukiDynamicMajor: found major device number 244
ukiDynamicMajor: found major device number 244
ukiOpenDevice: node name is /dev/ati/card0
ukiOpenDevice: open result is 8, (OK)
ukiGetBusid returned 'PCI:1:0:0'
ukiOpenDevice: node name is /dev/ati/card1
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card2
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card3
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card4
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card5
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card6
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card7
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card8
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card9
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card10
ukiOpenDevice: UKI_ERR_NOT_ROOT
ukiOpenDevice: node name is /dev/ati/card11
ukiOpenDevice: UKI_ERR...

Read more...

Revision history for this message
Aurelio Lucchesi (0rel-deactivatedaccount) wrote :

Hi! I'm also using KiCad for a couple of years now for various hobby projects, and I like it a lot. I've only tested the promising OpenGL based layout mode a couple of times, but I'm looking forward to try it out in the new version soon...

Unfortunately, I ran into very similar issues like described above on my Arch Linux box (Manjaro), using an older Nvidia GeForce GTX 260 card, after upgrading to KiCad 5.0.0 recently.

There's a "OpenGL 2.1 or higher is required!" pop-up showing up when I try to switch to the "Modern Toolset" in pcbnew, and the 3D preview doesn't work anymore (also with the Legacy Toolset selected).

Here some infos on my setup. I hope that helps you, to get more insights on the issue:

Application: kicad
Version: 5.0.0, release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.0 OpenSSL/1.1.0h zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.4) nghttp2/1.32.0
Platform: Linux 4.15.18-3-MANJARO x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.67.0
    Curl: 7.61.0
    Compiler: GCC 8.1.1 with C++ ABI 1012

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=OFF
    KICAD_SCRIPTING_ACTION_MENU=ON
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=OFF
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

$ glxinfo | grep OpenGL
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 260/PCIe/SSE2
OpenGL core profile version string: 3.3.0 NVIDIA 340.107
OpenGL core profile shading language version string: 3.30 NVIDIA via Cg compiler
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 3.3.0 NVIDIA 340.107
OpenGL shading language version string: 3.30 NVIDIA via Cg compiler
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 2.0 NVIDIA 340.107 340.107
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 1.00
OpenGL ES profile extensions:

$ kicad-ogltest
23:31:28: Warning: Mismatch between the program and library build versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1011,wx containers,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1012,wx containers,compatible with 2.8).
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
*** Caught unhandled unknown exception; terminating

Revision history for this message
Stefan Krueger (z-mail-i) wrote :
Download full text (8.2 KiB)

Hi there
i also tried and run with the verbose setting:

$ LIBGL_DEBUG=verbose pcbnew

(pcbnew:4704): Gtk-WARNING **: 13:55:50.881: Unable to locate theme engine in module_path: "adwaita",

(pcbnew:4704): Gtk-WARNING **: 13:55:50.910: Unable to locate theme engine in module_path: "adwaita",

** (pcbnew:4704): WARNING **: 13:56:06.617: Invalid borders specified for theme pixmap:
        /usr/share/themes/Breeze/gtk-2.0/../assets/line-h.png,
borders don't fit within the image
libGL: screen 0 does not appear to be DRI2 capable
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
libGL: Can't open configuration file /home/stefan/.drirc: No such file or directory.
libGL: Can't open configuration file /home/stefan/.drirc: No such file or directory.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

and also kicad-ogltest gives the same:
$ LIBGL_DEBUG=verbose kicad-ogltest

(kicad-ogltest:4816): Gtk-WARNING **: 14:02:53.816: Unable to locate theme engine in module_path: "adwaita",

(kicad-ogltest:4816): Gtk-WARNING **: 14:02:53.825: Unable to locate theme engine in module_path: "adwaita",
libGL: screen 0 does not appear to be DRI2 capable
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
libGL: Can't open configuration file /home/stefan/.drirc: No such file or directory.
libGL: Can't open configuration file /home/stefan/.drirc: No such file or directory.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
*** Caught unhandled unknown exception; terminating

and also tried
$ LIBGL_DEBUG=verbose glxgears -info
Running synchronized to the vertical refresh. The framerate should be
approximately the same as the monitor refresh rate.
GL_RENDERER = NVS 3100M/PCIe/SSE2
GL_VERSION = 3.3.0 NVIDIA 340.106
GL_VENDOR = NVIDIA Corporation
GL_EXTENSIONS = GL_ARB_arrays_of_arrays GL_ARB_base_instance GL_ARB_blend_func_extended GL_ARB_clear_buffer_object GL_ARB_color_buffer_float GL_ARB_compatibility GL_ARB_compressed_texture_pixel_storage GL_ARB_conservative_depth GL_ARB_copy_buffer GL_ARB_copy_image GL_ARB_debug_output GL_ARB_depth_buffer_float GL_ARB_depth_clamp GL_ARB_depth_texture GL_ARB_draw_buffers GL_ARB_draw_buffers_blend GL_ARB_draw_elements_base_vertex GL_ARB_draw_instanced GL_ARB_enhanced_layouts GL_ARB_ES2_compatibility GL_ARB_ES3_compatibility GL_ARB_explicit_attrib_location GL_ARB_explicit_uniform_location GL_ARB_fragment_coord_conventions GL_ARB_fragment_layer_viewport GL_ARB_fragment_program GL_ARB_fragment_program_shadow GL_ARB_fragment_shader GL_ARB_framebuffer_no_attachments GL_ARB_framebuffer_object GL_ARB_framebuffer_sRGB GL_ARB_geometry_shader4 GL_ARB_get_program_binary GL_ARB_half_float_pixel GL_ARB_half_float_vertex GL_ARB_imaging GL_ARB_instanced_arrays GL_ARB_internalformat_query GL_ARB_internalformat_query2 GL_ARB_invalidate_subdata GL_ARB_map_buffer_alignment GL_ARB_map_buffer_range GL_ARB_multi_bind GL_ARB_multisample GL_ARB_multitexture GL_ARB_occlusion_qu...

Read more...

Revision history for this message
Seth Hillbrand (sethh) wrote :

Hi Stefan-

Can you post the output of the command:

find /usr -iname "*libGL.so*" -exec ls -l {} \;

Revision history for this message
jean-pierre charras (jp-charras) wrote :

Also, google for:
"libGL error: failed to load driver: swrast"
You can find interesting info.

Revision history for this message
Stefan Krueger (z-mail-i) wrote :

Hi Seth,

thats:
~$ find /usr -iname "*libGL.so*" -exec ls -l {} \;
-rw-r--r-- 1 root root 567624 Jun 5 16:16 /usr/lib/x86_64-linux-gnu/libGL.so.1.0.0
lrwxrwxrwx 1 root root 10 Mär 7 17:25 /usr/lib/x86_64-linux-gnu/libGL.so -> libGL.so.1
lrwxrwxrwx 1 root root 14 Jul 25 10:28 /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib -> libGL.so.1.0.0
-rw-r--r-- 1 root root 1267800 Jan 9 2018 /usr/lib/x86_64-linux-gnu/libGL.so.340.106
lrwxrwxrwx 1 root root 16 Mär 7 17:25 /usr/lib/x86_64-linux-gnu/libGL.so.1 -> libGL.so.340.106
lrwxrwxrwx 1 root root 10 Mär 7 17:25 /usr/lib/i386-linux-gnu/libGL.so -> libGL.so.1
-rw-r--r-- 1 root root 1075136 Jan 9 2018 /usr/lib/i386-linux-gnu/libGL.so.340.106
lrwxrwxrwx 1 root root 16 Mär 7 17:25 /usr/lib/i386-linux-gnu/libGL.so.1 -> libGL.so.340.106

let me know if i can give you more infos!
thanks for taking the time to look into it!

sunny greetings
stefan

Revision history for this message
Aurelio Lucchesi (0rel-deactivatedaccount) wrote :
Download full text (10.0 KiB)

To find out more about the issue I've tried to look into the project a bit. So I've searched for the warning ("OpenGL 2.1 or higher is required!") and recompiled KiCad (release build).

Found source files:
- include/gal/opengl/opengl_gal.h
- common/gal/opengl/opengl_gal.cpp

It turns out to be an issue with wxWidgets, I think. In the GAL (Graphics Abstraction Layer), in the constructor OPENGL_GAL::OPENGL_GAL() in common/gal/opengl/opengl_gal.cpp:172:

// IsDisplayAttr() handles WX_GL_{MAJOR,MINOR}_VERSION correctly only in 3.0.4
// starting with 3.1.0 one should use wxGLContext::IsOk() (done by GL_CONTEXT_MANAGER)
#if wxCHECK_VERSION( 3, 0, 3 ) and !wxCHECK_VERSION( 3, 1, 0 )
    const int attr[] = { WX_GL_MAJOR_VERSION, 2, WX_GL_MINOR_VERSION, 1, 0 };

    if( !IsDisplaySupported( attr ) )
        throw std::runtime_error( "OpenGL 2.1 or higher is required!" );
#endif /* wxCHECK_VERSION( 3, 0, 3 ) */

This is throwing an error on my Manjaro/Arch linux computer (more infos on it posted in the previous post).

If I comment the IsDisplaySupported() check out, I get a gray work area in pcbnew, and the 3D Preview window is also gray. The verbose output of the modified project:

$ LIBGL_DEBUG=verbose ./pcbnew/pcbnew
20:08:01: Warning: Mismatch between the program and library build versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1011,wx containers,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1012,wx containers,compatible with 2.8).
libGL: screen 0 does not appear to be DRI2 capable
libGL: OpenDriver: trying /usr/lib/dri/tls/swrast_dri.so
libGL: OpenDriver: trying /usr/lib/dri/swrast_dri.so
libGL: Can't open configuration file /home/rel/.drirc: No such file or directory.
libGL: Can't open configuration file /home/rel/.drirc: No such file or directory.
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

More infos:
$ ldd pcbnew/pcbnew | grep wx
 libwx_gtk2u_gl-3.0.so.0 => /usr/lib/libwx_gtk2u_gl-3.0.so.0 (0x00007f37f67e5000)
 libwx_gtk2u_aui-3.0.so.0 => /usr/lib/libwx_gtk2u_aui-3.0.so.0 (0x00007f37f6552000)
 libwx_gtk2u_adv-3.0.so.0 => /usr/lib/libwx_gtk2u_adv-3.0.so.0 (0x00007f37f617d000)
 libwx_gtk2u_html-3.0.so.0 => /usr/lib/libwx_gtk2u_html-3.0.so.0 (0x00007f37f5eac000)
 libwx_gtk2u_core-3.0.so.0 => /usr/lib/libwx_gtk2u_core-3.0.so.0 (0x00007f37f5681000)
 libwx_baseu_net-3.0.so.0 => /usr/lib/libwx_baseu_net-3.0.so.0 (0x00007f37f543d000)
 libwx_baseu-3.0.so.0 => /usr/lib/libwx_baseu-3.0.so.0 (0x00007f37f4fa6000)
 libwx_baseu_xml-3.0.so.0 => /usr/lib/libwx_baseu_xml-3.0.so.0 (0x00007f37f4d96000)
 libwx_gtk2u_stc-3.0.so.0 => /usr/lib/libwx_gtk2u_stc-3.0.so.0 (0x00007f37f4958000)

$ find /usr -iname "*libGL.so*" -exec ls -l {} \;
-rwxr-xr-x 1 root root 386364 Nov 9 2017 /usr/lib32/libGL.so.1.0.0
lrwxrwxrwx 1 root root 14 Aug 4 23:15 /usr/lib32/libGL.so -> libGL.so.1.0.0
lrwxrwxrwx 1 root root 10 Jun 9 22:37 /usr/lib32/nvidia/libGL.so -> libGL.so.1
-rwxr-xr-x 1 root root 1075136 Jun 9 22:37 /usr/lib32/nvidia/libGL.so.340.107
lrwxrwxrwx 1 root root 16 Jun 9 22:37 /usr/lib32/nvidia/libGL.so.1 -> libGL.so.340.107
lrwxrwxrwx 1 root root 14 Aug 4 23...

Revision history for this message
Stefan Krueger (z-mail-i) wrote :

here again little bit shorter line format - hopefully without line-wrap:
$ find /usr -iname "*libGL.so*" -exec ls -g --no-group --human-readable --time-style=+ {} \;
-rw-r--r-- 1 555K /usr/lib/x86_64-linux-gnu/libGL.so.1.0.0
lrwxrwxrwx 1 10 /usr/lib/x86_64-linux-gnu/libGL.so -> libGL.so.1
lrwxrwxrwx 1 14 /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib -> libGL.so.1.0.0
-rw-r--r-- 1 1,3M /usr/lib/x86_64-linux-gnu/libGL.so.340.106
lrwxrwxrwx 1 16 /usr/lib/x86_64-linux-gnu/libGL.so.1 -> libGL.so.340.106
lrwxrwxrwx 1 10 /usr/lib/i386-linux-gnu/libGL.so -> libGL.so.1
-rw-r--r-- 1 1,1M /usr/lib/i386-linux-gnu/libGL.so.340.106
lrwxrwxrwx 1 16 /usr/lib/i386-linux-gnu/libGL.so.1 -> libGL.so.340.106

Revision history for this message
Seth Hillbrand (sethh) wrote :

@Aurelio-

It looks like you are running 64-bit KiCad but only have 32-bit OpenGL installed. You will need to install the 64-bit Nvidia driver or the 32-bit KiCad.

@Stefan-

Can you post the output for the command

ldd /path/to/pcbnew

Revision history for this message
Aurelio Lucchesi (0rel-deactivatedaccount) wrote :

@Seth:

Thanks for looking into all the cryptic logs! I think both 32- and 64-bit OpenGL drivers should be installed (those libGLs were cut off in the post above).

I've recently tried to update the driver manually (downloaded from Nvidia) to see if it helps with the issue. But then I've switched back to the driver from Arch/Manjaro with pacman, since it is up to date, and behaved the same. - For some reason, older versions of KiCad didn't have this problem (3D preview and OpenGL layout mode worked fine). So, I figured it is a bug introduced with KiCad 5.0.0.

$ lspci -k | grep -A 3 -E "NVIDIA"
01:00.0 VGA compatible controller: NVIDIA Corporation GT200 [GeForce GTX 260] (rev a1)
 Subsystem: Gigabyte Technology Co., Ltd GT200 [GeForce GTX 260]
 Kernel driver in use: nvidia
 Kernel modules: nouveau, nvidia

Installed nvidia* packages:

$ pacman -Qs nvidia
local/cuda 9.2.148-1
    NVIDIA's GPU programming toolkit
local/lib32-nvidia-340xx-utils 340.107-1
    NVIDIA drivers utilities (32-bit)
local/lib32-nvidia-cg-toolkit 3.1-5
    NVIDIA Cg libraries
local/libvdpau 1.1.1+3+ga21bf7a-1
    Nvidia VDPAU library
local/linux414-nvidia-340xx 340.107-12 (linux414-extramodules)
    NVIDIA drivers for linux.
local/linux415-nvidia-340xx 340.107-1 (linux415-extramodules)
    NVIDIA drivers for linux.
local/mhwd-nvidia 1:396.45-1
    MHWD module-ids for nvidia 396.45
local/mhwd-nvidia-304xx 1:304.137-1
    MHWD module-ids for nvidia 304.137
local/mhwd-nvidia-340xx 340.107-1
    MHWD module-ids for nvidia 340.107
local/mhwd-nvidia-390xx 390.77-1
    MHWD module-ids for nvidia 390.77
local/nvidia-340xx-utils 340.107-1
    NVIDIA drivers utilities
local/nvidia-cg-toolkit 3.1-4
    NVIDIA Cg libraries
local/opencl-nvidia 1:396.45-1
    OpenCL implemention for NVIDIA

I try to uninstall unnecessary packages, and keep you posted if I find out more about the problem. - I think it must be something related to wxWidget libraries and/or OpenGL driver...

BTW: Just found out that the current master branch I've tested was already KiCad version 6.0.0 (6.0.0-rc1):

Application: kicad
Version: 6.0.0-rc1-unknown, release build
Libraries:
    wxWidgets 3.0.4
    libcurl/7.61.0 OpenSSL/1.1.0h zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.4) nghttp2/1.32.0
Platform: Linux 4.15.18-3-MANJARO x86_64, 64 bit, Little endian, wxGTK
Build Info:
    wxWidgets: 3.0.4 (wchar_t,wx containers,compatible with 2.8) GTK+ 2.24
    Boost: 1.67.0
    OpenCASCADE Community Edition: 6.9.1
    Curl: 7.61.0
    Compiler: GCC 8.1.1 with C++ ABI 1012

Build settings:
    USE_WX_GRAPHICS_CONTEXT=OFF
    USE_WX_OVERLAY=OFF
    KICAD_SCRIPTING=ON
    KICAD_SCRIPTING_MODULES=ON
    KICAD_SCRIPTING_WXPYTHON=OFF
    KICAD_SCRIPTING_ACTION_MENU=OFF
    BUILD_GITHUB_PLUGIN=ON
    KICAD_USE_OCE=ON
    KICAD_USE_OCC=OFF
    KICAD_SPICE=ON

Revision history for this message
Seth Hillbrand (sethh) wrote :

@Aurelio-

Please post the full output if it was cut off.

Also, can you add the full output from `ldd path/to/pcbnew` ?

Revision history for this message
Aurelio Lucchesi (0rel-deactivatedaccount) wrote :
Download full text (13.3 KiB)

Thanks Seth for looking into this.

I've switch to the 5.0.0 branch and built it again (release build). It shows the same behavior as before.

Please note that I had to turn off KICAD_SCRIPTING_WXPYTHON, because there was a version conflict. That was also the case in previous builds, and KICAD_SCRIPTING_WXPYTHON is also turned of in the official package installed with the package manager (pacman).

$ cd build/release
$ cmake -DCMAKE_BUILD_TYPE=Release ../..
(...)
-- wxPython version 3.0 found.
/usr/lib/python2.7/site-packages/wx-3.0-gtk3/wx/_core.py:16629: UserWarning: wxPython/wxWidgets release number mismatch
  warnings.warn("wxPython/wxWidgets release number mismatch")
CMake Error at CMakeLists.txt:793 (message):

  wxWidgets and wxPython use different toolkits (gtk2 vs gtk3). It will
  result in a broken build. Please either install wxPython built using gtk2
  or add '-DKICAD_SCRIPTING_WXPYTHON=OFF' to cmake parameters to disable
  wxPython support.

-- Configuring incomplete, errors occurred!
See also "/home/rel/git/kicad/build/release/CMakeFiles/CMakeOutput.log".

That's how I've built it from the launchpad repo:
$ make -DCMAKE_BUILD_TYPE=Release -DKICAD_SCRIPTING_WXPYTHON=OFF ../../

If posts are too long (this one might be also too long), you could check the full log via "Download full text".

$ ldd kicad/kicad
 linux-vdso.so.1 (0x00007ffc69ff8000)
 libwx_gtk2u_gl-3.0.so.0 => /usr/lib/libwx_gtk2u_gl-3.0.so.0 (0x00007fe9a4a2a000)
 libwx_gtk2u_aui-3.0.so.0 => /usr/lib/libwx_gtk2u_aui-3.0.so.0 (0x00007fe9a4797000)
 libwx_gtk2u_adv-3.0.so.0 => /usr/lib/libwx_gtk2u_adv-3.0.so.0 (0x00007fe9a43c2000)
 libwx_gtk2u_html-3.0.so.0 => /usr/lib/libwx_gtk2u_html-3.0.so.0 (0x00007fe9a40f1000)
 libwx_gtk2u_core-3.0.so.0 => /usr/lib/libwx_gtk2u_core-3.0.so.0 (0x00007fe9a38c6000)
 libwx_baseu_net-3.0.so.0 => /usr/lib/libwx_baseu_net-3.0.so.0 (0x00007fe9a3682000)
 libwx_baseu-3.0.so.0 => /usr/lib/libwx_baseu-3.0.so.0 (0x00007fe9a31eb000)
 libwx_baseu_xml-3.0.so.0 => /usr/lib/libwx_baseu_xml-3.0.so.0 (0x00007fe9a2fdb000)
 libwx_gtk2u_stc-3.0.so.0 => /usr/lib/libwx_gtk2u_stc-3.0.so.0 (0x00007fe9a2b9d000)
 libGLEW.so.2.1 => /usr/lib/libGLEW.so.2.1 (0x00007fe9a28f5000)
 libcairo.so.2 => /usr/lib/libcairo.so.2 (0x00007fe9a25d2000)
 libpixman-1.so.0 => /usr/lib/libpixman-1.so.0 (0x00007fe9a232a000)
 libOpenGL.so.0 => /usr/lib/libOpenGL.so.0 (0x00007fe9a20fc000)
 libGLX.so.0 => /usr/lib/libGLX.so.0 (0x00007fe9a1ecb000)
 libGLU.so.1 => /usr/lib/libGLU.so.1 (0x00007fe9a1c4b000)
 libcurl.so.4 => /usr/lib/libcurl.so.4 (0x00007fe9a19cb000)
 libssl.so.1.1 => /usr/lib/libssl.so.1.1 (0x00007fe9a1761000)
 libcrypto.so.1.1 => /usr/lib/libcrypto.so.1.1 (0x00007fe9a12e4000)
 libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fe9a0f5b000)
 libm.so.6 => /usr/lib/libm.so.6 (0x00007fe9a0bc6000)
 libgomp.so.1 => /usr/lib/libgomp.so.1 (0x00007fe9a0998000)
 libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fe9a0780000)
 libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fe9a0562000)
 libc.so.6 => /usr/lib/libc.so.6 (0x00007fe9a01a6000)
 libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0x00007fe99fb69000)
 libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0x00007fe9...

Revision history for this message
Stefan Krueger (z-mail-i) wrote :
Download full text (6.5 KiB)

@Seth:
$ ldd /usr/bin/pcbnew
        linux-vdso.so.1 (0x00007ffe06533000)
        libwx_gtk2u_aui-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_gtk2u_aui-3.0.so.0 (0x00007f17c0601000)
        libwx_gtk2u_html-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_gtk2u_html-3.0.so.0 (0x00007f17c032e000)
        libwx_gtk2u_core-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_gtk2u_core-3.0.so.0 (0x00007f17bfafc000)
        libwx_baseu_net-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_baseu_net-3.0.so.0 (0x00007f17bf8b8000)
        libwx_baseu-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libwx_baseu-3.0.so.0 (0x00007f17bf429000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f17bf09b000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f17bee83000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f17bec64000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f17be873000)
        libgtk-x11-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0 (0x00007f17be231000)
        libgdk-x11-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0 (0x00007f17bdf7c000)
        libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f17bdd28000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f17bd98a000)
        libpangocairo-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0 (0x00007f17bd77d000)
        libcairo.so.2 => /usr/lib/x86_64-linux-gnu/libcairo.so.2 (0x00007f17bd460000)
        libgdk_pixbuf-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 (0x00007f17bd23c000)
        libpango-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0 (0x00007f17bcfef000)
        libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f17bccd9000)
        libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f17bc9a0000)
        libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f17bc79a000)
        libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007f17bc592000)
        libpng16.so.16 => /usr/lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f17bc360000)
        libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007f17bc0f8000)
        libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007f17bbe81000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f17bbc64000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f17bba60000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f17c0b53000)
        libgmodule-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0 (0x00007f17bb85c000)
        libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f17bb656000)
        libatk-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0 (0x00007f17bb430000)
        libgio-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0 (0x00007f17bb092000)
        libpangoft2-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0 (0x00007f17bae7c000)
        libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f17bac37000)
        libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f17baa2d000)
        libXinerama.so.1 => /usr/lib/x86_64-...

Read more...

Revision history for this message
Seth Hillbrand (sethh) wrote :

@Stefan- where did you get your KiCad?

Revision history for this message
Stefan Krueger (z-mail-i) wrote :

@Seth this should be the official version...
i have used the links from the official download info:
http://kicad-pcb.org/download/ubuntu/
there you find the
https://launchpad.net/~js-reynaud/+archive/ubuntu/kicad-5
ppa. i have checked my sources and this on is active.

i also have added & active the nightly build
https://launchpad.net/~js-reynaud/+archive/ubuntu/kicad-dev-nightly

Revision history for this message
Aurelio Lucchesi (0rel-deactivatedaccount) wrote :

Currently, I'm trying to replicate the error in a wxWidgets example.

For that I've built wxWidgets and the OpenGL cube example from the github repo:

$ git clone https://github.com/wxWidgets/wxWidgets
$ cd wxWidgets
$ ./configure --with-x11 --disable-shared --enable-log --enable-debug --enable-debug_cntxt
$ make -j4
$ cd samples/opengl/cube
$ make -j4 && ./cube

The build process and the example worked fine on my machine. But when I add a OpenGL version check similar to that in KiCad/pcbnew to the cube example, I run into an issue and a debugging pop-up shows up that says:

> A debugging check in this application has failed.
>
> ./src/unix/glx11.cpp(665): assert ""Assert failure"" failed in InitXVisualInfo(): wxGLAttributes
> object is empty.

The newly added version check obviously failed:

$ git diff -U0 cube.cpp
diff --git a/samples/opengl/cube/cube.cpp b/samples/opengl/cube/cube.cpp
index 5da6e7137f..822ea97615 100644
--- a/samples/opengl/cube/cube.cpp
+++ b/samples/opengl/cube/cube.cpp
@@ -485 +485,7 @@ MyFrame::MyFrame( bool stereoWindow )
-
+
+ static const int attr[] = { WX_GL_MAJOR_VERSION, 2, WX_GL_MINOR_VERSION, 1, 0 };
+ if( !wxGLCanvas::IsDisplaySupported( attr ) ) {
+ fprintf(stderr, "OpenGL 2.1 or higher is required!\n");
+ exit(-1);
+ }
+

It seems to have something to do with wxGLCanvasBase::ParseAttribList() in src/common/glcmn.cpp. - It starts in wxGLCanvasBase::IsDisplaySupported(const int *) in src/unix/glx11.cpp.

I do *not* know if this is really related to the KiCad 5.0.0 problem yet... I try to find out a bit more about this later...

Revision history for this message
Aurelio Lucchesi (0rel-deactivatedaccount) wrote :

Okay, I think I was on the wrong track up there, sorry for the confusion. The issue has probably nothing to do with wxWidgets directly.

KiCad is for some reason loading the wrong driver I think.

Both those workarounds make the accelerated layout mode finally work nicely :)

$ LD_PRELOAD='/usr/lib/nvidia/libGL.so.1' kicad
$ LD_PRELOAD='/usr/lib/nvidia/libGL.so.340.107' kicad
$ ls -l /usr/lib/nvidia/libGL.so.1
lrwxrwxrwx 1 root root 16 Aug 4 23:15 /usr/lib/nvidia/libGL.so.1 -> libGL.so.340.107

But, starting KiCad like that, shows the "OpenGL 2.1 or higher is required!" error from before in all tested versions of KiCad/pcbnew:

$ LD_PRELOAD='/usr/lib/libGL.so.1' kicad
$ kicad

If I can further track down the problem, I would gladly try to do that, since this is probably a rare problem (is it maybe a CMake configuration issue? - I have not much experience in using CMake...).

@Stefan:

Does the LD_PRELOAD trick work for you as well?

Revision history for this message
Stefan Krueger (z-mail-i) wrote :

@Aurelio:
i have tried with the examples you have given - but non of them worked.
no wounder - as these paths are not available on my system... (see #13 https://bugs.launchpad.net/kicad/+bug/1781581/comments/13)

so i tried and used one of the available paths:
$ LD_PRELOAD='/usr/lib/x86_64-linux-gnu/libGL.so.1' pcbnew
with this pcbnew started.
then i switched to the openGL view (with F11)
and got shortly a gray screenfill in pcbnew
than the warning: 'Could not find shader uniform: SMAA_RT_METRICS'
and it automatically switched back to 'modern fallback'
then i opend the 3D Viewer and juchu - it worked :-) i saw a small empty pcb ;-)

then i tried and started kicad with the LD_PRELOAD and it was the same - the 'modern toolset' did not work (same error message) - the 3D Viewer worked fine and showed my PCB and the 3D models of the footprints.

i also run the kicad-ogltest:
stefan:~$ LD_PRELOAD='/usr/lib/x86_64-linux-gnu/libGL.so.1' kicad-ogltest
(kicad-ogltest:25189): Gtk-WARNING **: 13:06:26.513: Unable to locate theme engine in module_path: "adwaita",
(kicad-ogltest:25189): Gtk-WARNING **: 13:06:26.521: Unable to locate theme engine in module_path: "adwaita",
INFO: Instantiated GL window
INFO: Found OpenGL version 3.3
INFO: Successfully called OPENGL_GAL::BeginDrawing
PASS
stefan:~$

so this seemed to also worked. :-)

Revision history for this message
Aurelio Lucchesi (0rel-deactivatedaccount) wrote :

Nice! :)

Strange that those warnings still appear and that the accelerated layout mode in pcbnew doesn't work on your PC.

Maybe it's because you have the open source OpenGL driver installed (not sure, but I think /usr/lib/x86_64-linux-gnu/ points to the open source driver on Ubuntu).

Looking into the infos above:
> OpenGL renderer string: NVS 3100M/PCIe/SSE2
> OpenGL core profile version string: 3.3.0 NVIDIA 340.106
> OpenGL core profile shading language version string: 3.30 NVIDIA via Cg

If there are still glitches (like the 'Could not find shader uniform: SMAA_RT_METRICS' warning), you could try to also install the (closed source) Nvidia driver, and LD_PRELOAD that one to see if KiCad works properly with it installed.

So, only the 3D Viewer works on your machine and the OpenGL mode in pcbnew doesn't? Only the "Modern Toolset (Fallback)" mode does? - That's strange... That looks like an actual bug, since it's not just a system/driver issue.

(The SMAA_RT_METRICS warning has something to do with a anti aliasing/a built-in GLSL shader I think, probably only used in pcbnew, not in the 3D Viewer. Source files found:
- common/gal/opengl/gl_builtin_shaders.cpp
- common/gal/opengl/antialiasing.cpp

It looks like ANTIALIASING_SMAA::loadShaders() in antialiasing.cpp fails... - You could try to somehow disable anti-aliasing. But maybe that can only be done by rebuilding KiCad, and I don't know much about how KiCad works internally at all...)

---
The kicad-ogl test gives me the following output now here:

$ LD_PRELOAD=/usr/lib/nvidia/libGL.so kicad-ogltest
17:26:55: Warning: Mismatch between the program and library build versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1011,wx containers,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1012,wx containers,compatible with 2.8).
INFO: Instantiated GL window
INFO: Found OpenGL version 3.3
INFO: Successfully called OPENGL_GAL::BeginDrawing
PASS

I've tried the "Modern Toolset (Accelerated)" mode in pcbnew and the 3D Preview with a larger PCB with many parts, and both seem to work fine now here. No glitches so far, track shoveling working fine so far (I had problems/crashes with that in older KiCad versions, when I tried it).

(Still, I think there's something wrong in the KiCad build process. I do not know why KiCad doesn't loads the right dynamic library libGL.so/driver out of the box. Most other applications use the Nvidia driver by default, and the older version 4 KiCad also had no problem with that here...)

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

I think you already know the root cause: you have two OpenGL libraries and the default symlink points to the software renderer.

If there are different paths to the OpenGL libraries (e.g. /usr/lib vs /usr/lib/nvidia) then you can give priority to the nVidia library by adding an entry in /etc/ld.so.conf or /etc/ld.so.conf.d/*.

You may also try intalling libglvnd [1], this is how the OpenGL library is resolved on my system.

The question demanding an answer is: how come glxgears pick the right OpenGL library?

More info:
https://askubuntu.com/questions/53354/why-is-usr-lib-libgl-so-1-always-linked-to-libgl-mesa-so
https://bugs.launchpad.net/ubuntu/+source/python-qt4/+bug/941826

1. https://github.com/NVIDIA/libglvnd

Revision history for this message
Aurelio Lucchesi (0rel-deactivatedaccount) wrote :
Download full text (11.9 KiB)

Thanks for looking into this Maciej.

I do not fully understand yet how the OS decides exactly when to load which shared object/dynamic library. I'm looking into the details you've pointed out (/etc/ld.so.conf*).

$ cat /etc/ld.so.conf
# Dynamic linker/loader configuration.
# See ld.so(8) and ldconfig(8) for details.
include /etc/ld.so.conf.d/*.conf
$ ls /etc/ld.so.conf.d/
00-lib32-nvidia.conf 99_oce.conf fakeroot.conf octave.conf openmpi.conf R.conf
00-nvidia.conf cuda.conf lib32-glibc.conf opencollada.conf perf.conf xulrunner.conf
$ cat /etc/ld.so.conf.d/00-nvidia.conf
/usr/lib/nvidia/
$ cat /etc/ld.so.conf.d/00-lib32-nvidia.conf
/usr/lib32/nvidia/

> two OpenGL libraries and the default symlink points to the software renderer.

Yes, I think there are even three graphics drivers on my computer (because of dependencies of various programs). The proprietary nvidia driver, an open-source driver (mesa) and the software renderer (swrast?), and all of them in 32- and 64-bit variants.

I'm going to read a bit more about how libglvnd works later on, and how it could be used to fix the issue. Both, the libglvnd 64- and 32-bit version were installed already before.

$ pacman -Qs libglvnd
local/lib32-libglvnd 1.0.0-1
    The GL Vendor-Neutral Dispatch library
local/libglvnd 1.0.0-1
    The GL Vendor-Neutral Dispatch library

> The question demanding an answer is: how come glxgears pick the right OpenGL library?

Right, KiCad somehow tries to load the wrong library.

Not sure, but something has to be fixed in the build process of KiCad 5.0.0. The linker stores the final dependencies in the produced dynamically linked binary. And as it turns out, glxgears explicitly points to the nvidia libraries ('/usr/lib/nvidia/libGL.so.1' and '/usr/lib/libnvidia-glcore.so.340.107'), and pcbnew does not do that (glib is for GTK). So, the dependency comes from some other library? (wxWidgets, GTK+?) Or are the libraries loaded at runtime?

Maybe it can be fixed by modifying the CMake configuration files?

$ ls -al /usr/lib/libnvidia-glcore.so.340.107
-rwxr-xr-x 1 root root 44003128 Jun 9 21:57 /usr/lib/libnvidia-glcore.so.340.107

$ ldd /usr/bin/glxgears | grep -Ei 'gl|x11|nv'
 libGL.so.1 => /usr/lib/nvidia/libGL.so.1 (0x00007f5bae421000)
 libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f5badd4d000)
 libnvidia-tls.so.340.107 => /usr/lib/libnvidia-tls.so.340.107 (0x00007f5bad78e000)
 libnvidia-glcore.so.340.107 => /usr/lib/libnvidia-glcore.so.340.107 (0x00007f5baa

$ ldd /usr/bin/pcbnew | grep -Ei 'gl|x11|nv'
 libgtk-x11-2.0.so.0 => /usr/lib/libgtk-x11-2.0.so.0 (0x00007f44a4b34000)
 libgdk-x11-2.0.so.0 => /usr/lib/libgdk-x11-2.0.so.0 (0x00007f44a4880000)
 libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007f44a35e5000)
 libX11.so.6 => /usr/lib/libX11.so.6 (0x00007f44a32a6000)

But for some reason, kicad-ogltest shows the dynamically linked libGL*.so explicitly:

$ /usr/bin/kicad-ogltest | grep -i gl
 libwx_gtk2u_gl-3.0.so.0 => /usr/lib/libwx_gtk2u_gl-3.0.so.0 (0x00007f62ff7f0000)
 libGLEW.so.2.1 => /usr/lib/libGLEW.so.2.1 (0x00007f62fe3af000)
 libOpenGL.so.0 => /usr/lib/libOpenGL.so.0 (0x00007f62fe181000)
 libGLX.so.0 => /usr/lib/libGLX...

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Thank you, that is very detailed report. Apparently you already have the right entries in /etc/ld.so.conf.d/00-nvidia.conf.

If you are interested in the shared libraries topic: normally ELF files store only the shared libraries file names, no full paths (check 'readelf -d /path/to/exe | grep NEEDED'). It is the loader's job to find the right librariesa and this is what you get from ldd command.

I guess you will get the GL libraries listed when you run 'ldd _pcbnew.kiface' - this is the binary containing the actual pcbnew code. 'Pcbnew' is only a loader for _pcbnew.kiface, which is in turn a shared library. I find it a bit strange that I also have GL libraries listed for the 'pcbnew' executable and you do not.

BTW. I am running Arch Linux, so that is the same distro family as Manjaro and have a similar video adapters configuration: integrated Intel card and discrete nVidia in a laptop. I suppose you installed KiCad from a package, right?

Revision history for this message
Aurelio Lucchesi (0rel-deactivatedaccount) wrote :
Download full text (23.4 KiB)

Yes, I've installed KiCad 5.0.0 from the Arch community repo.

$ pacman -Qs kicad
local/kicad 5.0.0-1
    Electronic schematic and printed circuit board (PCB) design tools

And also cloned the git repo from launchpad for more testing. But didn't install anything from there...

> normally ELF files store only the shared libraries file names, no full paths

That's interesting, I didn't know that in detail. The man page of ld.so is also very useful.

So it makes sense that the path to the actual shared library gets resolved by the OS/loader, and that's probably where libglvnd comes in (via libOpenGL.so / libGLdispatch.so (?)). I will read up more on that topic later.

Something else I don't understand yet is how the system handles conflicting libraries...

Could it be that another shared object (GTK/wxWidgets) depends on a different OpenGL library than a already loaded one (with the same symbols/functions in it), and libglvnd gets confused?

$ readelf -d /usr/lib/libwx_gtk2u_gl-3.0.so | grep libGL
 0x0000000000000001 (NEEDED) Shared library: [libGL.so.1]
$ ldd /usr/lib/libwx_gtk2u_gl-3.0.so | grep libGL
 libGL.so.1 => /usr/lib/nvidia/libGL.so.1 (0x00007f2ef5b34000)

Maybe the misbehavior stems from such a conflict, that comes from the *order* the libraries get loaded?

I tried to change the order in the main CMakeLists.txt by simply moving text around, but it didn't help...

---
More logs and various tests:

$ # "OpenGL 2.1 or higher is required!" showing up
$ pcbnew &
$ lsof -p `pidof pcbnew` | grep mem | grep GL
pcbnew 25806 rel mem REG 8,98 109512 6035021 /usr/lib/libxcb-glx.so.0.0.0
pcbnew 25806 rel mem REG 8,98 1137760 6031890 /usr/lib/libglib-2.0.so.0.5600.1
pcbnew 25806 rel mem REG 8,98 1267800 6293991 /usr/lib/nvidia/libGL.so.340.107
pcbnew 25806 rel mem REG 8,98 186112 6037699 /usr/lib/libOpenGL.so.0.0.0
pcbnew 25806 rel mem REG 8,98 194384 6044838 /usr/lib/libglapi.so.0.0.0
pcbnew 25806 rel mem REG 8,98 44003128 6031871 /usr/lib/libnvidia-glcore.so.340.107
pcbnew 25806 rel mem REG 8,98 477880 6042976 /usr/lib/libGLX_mesa.so.0.0.0
pcbnew 25806 rel mem REG 8,98 522000 6044904 /usr/lib/libGLU.so.1.3.1
pcbnew 25806 rel mem REG 8,98 612176 6034906 /usr/lib/libGLdispatch.so.0.0.0
pcbnew 25806 rel mem REG 8,98 665608 6031230 /usr/lib/libGLEW.so.2.1.0
pcbnew 25806 rel mem REG 8,98 67272 6039886 /usr/lib/libGLX.so.0.0.0
pcbnew 25806 rel mem REG 8,98 93272 6060100 /usr/lib/libwx_gtk2u_gl-3.0.so.0.4.0

$ # Modern Toolset (Accelerated) working ok
$ killall pcbnew
$ LD_PRELOAD=/usr/lib/nvidia/libGL.so pcbnew >/dev/null 2>&1 &
$ lsof -p `pidof pcbnew` | grep mem | grep -i GL
pcbnew 25725 rel mem REG 8,98 1137760 6031890 /usr/lib/libglib-2.0.so.0.5600.1
pcbnew 25725 rel mem REG 8,98 1267800 6293991 /usr/lib/nvidia/libGL.so.340.107
pcbnew 25725 rel mem REG ...

Revision history for this message
Aurelio Lucchesi (0rel-deactivatedaccount) wrote :

Luckily, there's a way to quicky fix the problem.

I've changed the OpenGL_GL_PREFERENCE from GLVND to LEGACY in the main CMakeLists.txt, and rebuilt KiCad. - And it seems to solve the issue! :)

(Only the debug builds have been tested so far.)

However, I'm not sure, if it is going to work under all conditions, and if it is a good solution at all.

It bypasses the libglvnd magic I guess. If I can help out with more tests on my setup, I would be glad if you could guide those tests a bit. It's difficult for me to find out what's really going, since I don't know KiCad's code base, cmake and there are too many rabbit holes to get lost in a Linux system :P

---

$ git diff -U0
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f2ea761f9..2edbe335c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -582 +582 @@ endif()
-set( OpenGL_GL_PREFERENCE "GLVND" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'
+set( OpenGL_GL_PREFERENCE "LEGACY" ) # CMake 3.11+ setting; see 'cmake --help-policy CMP0072'

$ mkdir -p build/debug
$ cd build/debug
$ cmake -DCMAKE_BUILD_TYPE=Debug -DKICAD_SCRIPTING_WXPYTHON=OFF -DKICAD_USE_OCE=OFF ../../

$ make -j4
$ ./utils/kicad-ogltest/kicad-ogltest
05:42:17: Warning: Mismatch between the program and library build versions detected.
The library used 3.0 (wchar_t,compiler with C++ ABI 1011,wx containers,compatible with 2.8),
and your program used 3.0 (wchar_t,compiler with C++ ABI 1012,wx containers,compatible with 2.8).
INFO: Instantiated GL window
INFO: Found OpenGL version 3.3
INFO: Successfully called OPENGL_GAL::BeginDrawing
PASS

(BTW: I turned oce/OpenCASCADE off (KICAD_USE_OCE=OFF), because I've uninstalled it before the previous tests.)

Revision history for this message
Aurelio Lucchesi (0rel-deactivatedaccount) wrote :
Download full text (3.5 KiB)

The release builds also have been tested successfully.

With the quick fix above, a OpenGL related symbol lookup looks like this. libOpenGL.so (libglvnd related) isn't used.

$ LD_DEBUG=all ./utils/kicad-ogltest/kicad-ogltest 2>&1 | nl | grep glClearColor
839621 17046: symbol=glClearColor; lookup in file=./utils/kicad-ogltest/kicad-ogltest [0]
839622 17046: symbol=glClearColor; lookup in file=/usr/lib/libwx_gtk2u_gl-3.0.so.0 [0]
839623 17046: symbol=glClearColor; lookup in file=/usr/lib/libwx_gtk2u_aui-3.0.so.0 [0]
839624 17046: symbol=glClearColor; lookup in file=/usr/lib/libwx_gtk2u_adv-3.0.so.0 [0]
839625 17046: symbol=glClearColor; lookup in file=/usr/lib/libwx_gtk2u_html-3.0.so.0 [0]
839626 17046: symbol=glClearColor; lookup in file=/usr/lib/libwx_gtk2u_core-3.0.so.0 [0]
839627 17046: symbol=glClearColor; lookup in file=/usr/lib/libwx_baseu_net-3.0.so.0 [0]
839628 17046: symbol=glClearColor; lookup in file=/usr/lib/libwx_baseu-3.0.so.0 [0]
839629 17046: symbol=glClearColor; lookup in file=/usr/lib/libwx_baseu_xml-3.0.so.0 [0]
839630 17046: symbol=glClearColor; lookup in file=/usr/lib/libwx_gtk2u_stc-3.0.so.0 [0]
839631 17046: symbol=glClearColor; lookup in file=/usr/lib/libGLEW.so.2.1 [0]
839632 17046: symbol=glClearColor; lookup in file=/usr/lib/libcairo.so.2 [0]
839633 17046: symbol=glClearColor; lookup in file=/usr/lib/libpixman-1.so.0 [0]
839634 17046: symbol=glClearColor; lookup in file=/usr/lib/nvidia/libGL.so.1 [0]
839635 17046: binding file ./utils/kicad-ogltest/kicad-ogltest [0] to /usr/lib/nvidia/libGL.so.1 [0]: normal symbol `glClearColor'

Shared libraries needed by kicad-ogltest, after disabling GLVND:

$ readelf -d ./utils/kicad-ogltest/kicad-ogltest | grep NEEDED
 0x0000000000000001 (NEEDED) Shared library: [libwx_gtk2u_gl-3.0.so.0]
 0x0000000000000001 (NEEDED) Shared library: [libwx_gtk2u_aui-3.0.so.0]
 0x0000000000000001 (NEEDED) Shared library: [libwx_gtk2u_adv-3.0.so.0]
 0x0000000000000001 (NEEDED) Shared library: [libwx_gtk2u_html-3.0.so.0]
 0x0000000000000001 (NEEDED) Shared library: [libwx_gtk2u_core-3.0.so.0]
 0x0000000000000001 (NEEDED) Shared library: [libwx_baseu_net-3.0.so.0]
 0x0000000000000001 (NEEDED) Shared library: [libwx_baseu-3.0.so.0]
 0x0000000000000001 (NEEDED) Shared library: [libwx_baseu_xml-3.0.so.0]
 0x0000000000000001 (NEEDED) Shared library: [libwx_gtk2u_stc-3.0.so.0]
 0x0000000000000001 (NEEDED) Shared library: [libGLEW.so.2.1]
 0x0000000000000001 (NEEDED) Shared library: [libcairo.so.2]
 0x0000000000000001 (NEEDED) Shared library: [libpixman-1.so.0]
 0x0000000000000001 (NEEDED) Shared library: [libGL.so.1]
 0x0000000000000001 (NEEDED) Shared library: [libGLU.so.1]
 0x0000000000000001 (NEEDED) Shared library: [libcurl.so.4]
 0x0000000000000001 (NEEDED) Shared library: [libssl.so.1.1]
 0x0000000000000001 (NEEDED) Shared library: [libcrypto.so.1.1]
 0x0000000000000001 (NEEDED) Shared library: [li...

Read more...

Revision history for this message
Stefan Krueger (z-mail-i) wrote :

in reply to @Aurelio #26:

i have resorted the results from
$ find /usr -iname "*libGL.so*" -exec stat -c%N {} \;
so its easier for me to understand and follow the linkgs... :

'/usr/lib/x86_64-linux-gnu/libGL.so.1.distrib' -> 'libGL.so.1.0.0'
'/usr/lib/x86_64-linux-gnu/libGL.so.1.0.0'

'/usr/lib/x86_64-linux-gnu/libGL.so' -> 'libGL.so.1'
'/usr/lib/x86_64-linux-gnu/libGL.so.1' -> 'libGL.so.340.106'
'/usr/lib/x86_64-linux-gnu/libGL.so.340.106'

'/usr/lib/i386-linux-gnu/libGL.so' -> 'libGL.so.1'
'/usr/lib/i386-linux-gnu/libGL.so.1' -> 'libGL.so.340.106'
'/usr/lib/i386-linux-gnu/libGL.so.340.106'

last time (#25) i have tested with libGL.so.1
so now i have redone the tests with the direct libGL.so.340.106 file.
but the results were exactly the same.
and then also have doen the test with the direct use of libGL.so.1.0.0 file.
this results in the 'OpenGL 2.1 or higher is required' error and an not working 3D Viewer..

so it seems libGL.so.1.0.0 is pointing to the Nouveau driver or something else..

i think the libGL.so.340.106 is standing for the nvidia closed source driver..
i had tested the Nouveau driver - but it does not work on my system... (does not find the 'display' and so it falls back to some sw rendering and i have 600x400pixel resolution....)

so iam very sure that the current active driver is the nvidia one..

Revision history for this message
Aurelio Lucchesi (0rel-deactivatedaccount) wrote :

Thanks Stephan for all the details!

---
*) nvidia driver on Ubuntu:

Yes, I think I was confused, you seem to have the current proprietary nvidia driver installed!

I've cross-checked those files here:
https://packages.ubuntu.com/bionic/i386/nvidia-340/filelist:
/usr/lib/x86_64-linux-gnu/libGL.so
/usr/lib/i386-linux-gnu/libGL.so.340.106

So our setups should be comparable then. Now it would be interesting to find out what exactly causes the problem.

---
*) Anti-aliasing / SMAA_RT_METRICS problem:

After looking a bit into those mentioned source files, to find out how to turn off anti-aliasing in code.
I've discovered that KiCad comes with an comfortable way to configure anti aliasing settings right in pcbnew GUI:

pcbnew -> Display Options... -> Accelerated Graphics -> No Antialiasing

When I select *subpixel* anti-aliasing in that menu, I also get the same error message you've mentioned: "Could not find shader uniform: SMAA_RT_METRICS", after pressing OK. And it also switches over to 'Modern Toolset (Fallback)' mode, after showing a gray window for a moment. -- Both supersampling (2x/4x) modes work fine here (nvidia GeForce GTX 260). - But I think this problem/bug would deserve a new ticket, since it is not directly related to the other one.

I hope this helps, to run pcbnew's new OpenGL mode on your setup with the LD_PRELOAD workaround.

---
*) GLVND workaround / LEGACY pseudo fix:

It would be interesting to see if the tiny change required in CMakeLists.txt also fixes the problem on your system, if you have the time to test it...

To replicate it, you could apply it and rebuild KiCad like this:

$ git clone https://git.launchpad.net/kicad
$ cd kicad
$ git checkout 5.0.0
$ sed -i.bak 's/OpenGL_GL_PREFERENCE "GLVND"/OpenGL_GL_PREFERENCE "LEGACY"/g' CMakeLists.txt
$ mkdir -p build/release
$ cd build/release
$ cmake -DCMAKE_BUILD_TYPE=Release -DKICAD_SCRIPTING_WXPYTHON=OFF -DKICAD_USE_OCE=OFF ../../
$ make
$ ./pcbnew/pcbnew

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Aurelio,

I have tested your changes on Linux and Windows and I have found no problems. It seems that not every platform supports GLVND equally well, so it might be better to follow the legacy way for the time being.

I intend to apply your modifications to the master branch, so please give me your e-mail address if you would like to have the patch attributed to you. Thank you for your cooperation.

Revision history for this message
Stefan Krueger (z-mail-i) wrote :

@Aurelio

so i tried to compile from source :-)
- i first had to install all dependencies..
$ sudo apt build-dep kicad
(with the nightly package sources enabled)
fixed the dependencies..
and also needed to run
$ sudo ./scripts/get_libngspice_so.sh
to install NGSPICE libraries (this script was mentioned by cmake)

after an long long time (i forget to specify a make -j 8 for multi-core usage..) build finished.
i started pcb new and switched to 'Modern Toolset (Accelerated)' - but this greeted me with the already known 'Could not find shader uniform: SMAA_RT_METRICS' message..
but the 3D View worked.
so i switched to 'No Antialiasing' and it worked.
i also checked the other options and the Supersampling* worked..

thanks for your persistence to trac this all down... ;-)

if someone of you do need any other info from me - or if i should try to recompile something else let me know...

Revision history for this message
Maciej Suminski (orsonmmz) wrote :

Aurelio,

I did not want to wait longer with applying the fix, so I simply put your name with a 'thanks' line. We appreciate your help!

Changed in kicad:
status: Incomplete → Fix Committed
importance: Undecided → High
milestone: none → 5.0.1
assignee: nobody → Aurelio Lucchesi (0rel)
Revision history for this message
Alex (knapik1227) wrote :

Yep, I just build the latest version of KiCAD for my GNU/Linux install and I can confirm that openGL mode is working great now. Thank you very much!

Revision history for this message
Stefan Krueger (z-mail-i) wrote :

me to.
i updated through the nightly ppa and its working fine.

Revision history for this message
Stefan Krueger (z-mail-i) wrote :

additionally i have now created
Bug #1788456 'Could not find shader uniform: SMAA_RT_METRICS'

so we could find out what is the case for the SMAA messagae found in comment 24...

Revision history for this message
Aurelio Lucchesi (0rel-deactivatedaccount) wrote :

Thanks everyone for all the testing and the feedback, it's great to hear that it works now in most cases! :D
KiCad is great!

Sorry for the long delay, I was away.

@Maciej

That makes sense yes. I do not know though what kind of limitations come with using LEGACY OpenGL_GL_PREFERENCE over GLVND. As long as CMake makes sure that KiCad can be built for every target platform and that the right OpenGL libraries are linked in, it should be fine I think to use LEGACY I guess.

Thanks a lot for applying the fix, and mentioning me.
I'm glad that we were able to find a solution!

(BTW: You should be able to see my mail address on the launchpad profile page.)

@Stefan:

Happy to hear that! - Yes it takes quite a while to build KiCad, I was surprised as well, it's big. You could also abort a build process (with Ctrl-C) and continue it by invoking make with new parameters like -j9 a second time. It usually works, without losing previously compiled object files.
(Still have to test the NGSPICE simulation features soon...)

@Bug #1788456 'Could not find shader uniform: SMAA_RT_METRICS'

Since I also have this problem, we could try to track this one down as well. (But I'm not sure if I will work on Linux next week already. - I hope to get to work on a new project with KiCad 5.0.0+ soon...)

@Alex:
Thanks for testing it!

Are you going to update the ticket, when the new version 5.0.1 is released? ("Fix Released")

Changed in kicad:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.