Problem with libdrm and amdgpu-pro

Hello snapcrafters.
Now I have such an error with which I can not figure it out, on computers where proprietary AMD drivers are installed, it is not possible to start the application if it is written in QML.
I do not compile the application during the build snap package, I use a ready-made binary and the correct version of the library.
Here is the error log.

/usr/share/libdrm/amdgpu.ids: No such file or directory
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: radeonsi
/usr/share/libdrm/amdgpu.ids: No such file or directory
mesa: for the -simplifycfg-sink-common option: may only occur zero or one times!
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: radeonsi
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
QSoundEffect(pulseaudio): Error decoding source
QSoundEffect(pulseaudio): Error decoding source
Buffer creation failed
Buffer creation failed
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed: 
""
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed: 
""
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed: 
""
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed: 
""
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed: 
""
QOpenGLShaderProgram::uniformLocation(matrix): shader program is not linked
QOpenGLShaderProgram::uniformLocation(opacity): shader program is not linked
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed: 
""
QOpenGLShaderProgram::uniformLocation(qt_Matrix): shader program is not linked
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed: 
""
QOpenGLShaderProgram::uniformLocation(matrix): shader program is not linked
QOpenGLShaderProgram::uniformLocation(textureScale): shader program is not linked
QOpenGLShaderProgram::uniformLocation(color): shader program is not linked
QOpenGLShaderProgram::uniformLocation(alphaMin): shader program is not linked
QOpenGLShaderProgram::uniformLocation(alphaMax): shader program is not linked
QOpenGLShaderProgram::uniformLocation(fontScale): shader program is not linked
QOpenGLShaderProgram::uniformLocation(vecDelta): shader program is not linked
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed: 
""
QOpenGLShaderProgram::uniformLocation(matrix): shader program is not linked
QOpenGLShaderProgram::uniformLocation(textureScale): shader program is not linked
QOpenGLShaderProgram::uniformLocation(color): shader program is not linked
QOpenGLShaderProgram::uniformLocation(alphaMin): shader program is not linked
QOpenGLShaderProgram::uniformLocation(alphaMax): shader program is not linked
QOpenGLShaderProgram::uniformLocation(fontScale): shader program is not linked
QOpenGLShaderProgram::uniformLocation(vecDelta): shader program is not linked
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed: 

I use
snapcraft 3.0.1
snap 2.36.3
snapd 2.36.3
series 16
ubuntu 18.04
kernel 4.15.0-43-generic

Here is yaml
name: managetime
version: “0.1.0”
summary: timer
description: |
Application for time management
confinement: strict
grade: stable
architectures: [amd64]

base: core18

icon: snap/gui/managetime.png

apps:
    managetime:
        desktop: share/applications/managetime.desktop
        command: bin/projecttimer
        plugs: 
            - home
            - unity7
            - x11
            - opengl
            - pulseaudio
            - wayland
            - network
            - desktop
            - desktop-legacy
        environment:
            XDG_RUNTIME_DIR: /run/user/1000
            __EGL_VENDOR_LIBRARY_DIRS: $SNAP/etc/glvnd/egl_vendor.d:$SNAP/usr/share/glvnd/egl_vendor.d
            # XKB config
            XKB_CONFIG_ROOT: $SNAP/usr/share/X11/xkb
            # Qt Platform to Wayland
            #QT_QPA_PLATFORM: wayland
            QT_QPA_PLATFORM: xcb
            QTCHOOSER_NO_GLOBAL_DIR: 1
            QT_SELECT: snappy-qt5
            # Qt Modules
            LD_LIBRARY_PATH: $SNAP/Qt/5.11.0/gcc_64/lib:$LD_LIBRARY_PATH
            QT_PLUGIN_PATH: $SNAP/Qt/5.11.0/gcc_64/plugins
            QML2_IMPORT_PATH: $QML2_IMPORT_PATH:$SNAP/Qt/5.11.0/gcc_64/qml
            QT_QPA_PLATFORM_PLUGIN_PATH: $SNAP/Qt/5.11.0/gcc_64/plugins/platforms
            # XDG Config
            XDG_CONFIG_DIRS: $SNAP/etc/xdg:$SNAP/usr/xdg:$XDG_CONFIG_DIRS
            XDG_DATA_DIRS: $SNAP/usr/share:$XDG_DATA_DIRS
            # Font Config and themes
            FONTCONFIG_PATH: $SNAP/etc/fonts/conf.d
            FONTCONFIG_FILE: $SNAP/etc/fonts/fonts.conf
            # Tell libGL where to find the drivers
            LIBGL_DRIVERS_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/dri
parts:
    managetime:
        plugin: dump
        source: scripts
        source-type: local
        build-attributes: 
            - keep-execstack

    integration:
        plugin: nil
        stage-packages:
            - libc6
            - zlib1g
            - libstdc++6
            - libgcc1
            - libglib2.0-0
            - libpcre3
            - libxext6
            - libx11-6
            - libxcb1
            - libxau6
            - libxdmcp6
            - libbsd0
            - libxdamage1
            - libxfixes3
            - libx11-xcb1
            - libxcb-glx0
            - libxcb-dri3-0
            - libxcb-present0
            - libxcb-dri2-0
            - libxxf86vm1
            - libxshmfence1
            - libxcb-sync1
            - libpulse-mainloop-glib0
            - libpulse0
            - libsystemd0
            - liblzma5
            - liblz4-1
            - libgcrypt20
            - libgpg-error0
            - libwrap0
            - libsndfile1
            - libflac8
            - libogg0
            - libvorbis0a
            - libvorbisenc2
            - libasyncns0
            - libdbus-1-3
            - libfontconfig1
            - libfreetype6
            - libpng16-16
            - libexpat1
            - libxi6
            - libxrender1
            - libdrm2
            - libwayland-client0
            - libwayland-cursor0
            - libffi6
            - libxkbcommon0
            - libxcomposite1
            - libgl1
            - libgl1-mesa-dri
            - libgl1-mesa-glx
            - libdrm-common
            - libtinfo5

Please, if anyone knows how to solve the problem, then show it based on my yaml.
More than a month spent on it and no one can give good advice how to fix it((((
Thx.

1 Like

Also developing Qt application and have got the same problem with this libdrm. Question for developers:" How to solve this?". Thanks

I have the same problem

I have a Radeon Vega card and I’m currently using AMDGPU drivers (mesa), but I can give AMDGPU-Pro a try. Which snap should I install?

You need to install driver from here https://www.amd.com/en/support/graphics/radeon-rx-vega-series/radeon-rx-vega-series/radeon-rx-vega-64 or 56 if u have.

And u can for test use this project https://github.com/QuasarApp/Console-QtDeployer.git

Or I’ll come home in the evening and send you my package, which just doesn’t work.

I grabbed qml-hello-world from the store. Can you check that it fails for you?

The problem must also be reproduced on this package.
install and run on PC with AMDGPU-PRO drivers
the name of programm : cqtdeployerexample

This is my QML app managetime
You can install it and get that error result about what I wrote.

I tried to install and run this application. It also does not work.
Here is the error log

libGL error: unable to load driver: amdgpu_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: amdgpu
libGL error: unable to load driver: amdgpu_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: amdgpu
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed:
“”
QOpenGLShaderProgram::uniformLocation( matrix ): shader program is not linked
QOpenGLShaderProgram::uniformLocation( opacity ): shader program is not linked
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed:
“”
QOpenGLShaderProgram::uniformLocation( matrix ): shader program is not linked
QOpenGLShaderProgram::uniformLocation( textureScale ): shader program is not linked
QOpenGLShaderProgram::uniformLocation( color ): shader program is not linked
QOpenGLShaderProgram::uniformLocation( alphaMin ): shader program is not linked
QOpenGLShaderProgram::uniformLocation( alphaMax ): shader program is not linked
QOpenGLShaderProgram::uniformLocation( fontScale ): shader program is not linked
QOpenGLShaderProgram::uniformLocation( vecDelta ): shader program is not linked
QOpenGLShaderProgram: could not create shader program
QOpenGLShader: could not create shader
QOpenGLShader: could not create shader
shader compilation failed:

i belive that amdgpu driver linked above installs somewhere in /opt or /var/opt … i assume thats not part of the opengl interface

I’ve spent some time debugging this today and observed the problem you indicated.

I suspect the thing comes down to the fact that OpenGL stack shipped by AMDGPU-PRO is not available inside the snap mount namespace and the proprietary amdgpu kernel driver is incompatible with Mesa.

We have some workarounds to deal with identical problem in NVIDIA proprietary stack. There is some work on improving OpenGL story of snaps scheduled already, so hopefully will have a proper solution rather than an ugly nvidia-like hack. I’ve poked at different things and collected some data in the process. The userspace bits seem a bit lacking compared to what NVIDIA ships (eg, lack of glvnd), though it’s unclear if that will affect us.

If I understand you correctly, need to wait for some additions in the snapcraft so that this problem is resolved?
How soon can this be fixed?
And one more question is, will this decision require some additional parameters in snapcraft?

The whole package you download from amd.com actually ships 2 drivers.

There is the open source amdgpu driver (under /opt/amdgpu), which AFAICT does not require extra kernel bits. It’s basically a rebuild of 18.2 mesa with llvm 7.0. On Ubuntu 18.04, the driver version is newer than what shipped with the distro. Given how new functionality is landing in the

And then there is amdgpu-pro proprietary driver (under /opt/amdgpu-pro). This one uses a kernel module named amdgpu (named identically to the mainline driver) and ships the userspace bits (libGL, libEGL, libGLESv2). However it lack support for glvnd, so it will not work without tricks when there is more than one GPU involved. On the bright side of things, the kernel module has /sys/module/kernel/version which we can use for probing if the driver is in use. I do not know how close the kernel module is to the mainline. I read it supports FreeSync and stuff, which has landed in mainline only recently. The lack of glvnd, hopefully makes supporting the userspace stack similar to the old NVIDIA driver releases (pre 400.x ones).

Vulkan story seems to be interesting. The pro driver ships amdvlk with corresponding ICD files.

Finally, both drivers end up being added under /etc/ld.so.conf.d, with the proprietary one taking priority.

The user can install just the open source driver. In fact, the open source driver is recommended for consumer products (at least according to release notes).

I don’t know about changes on the snapcraft side (maybe none are needed?). However, we will be addressing the problem on snapd side.

well, what i meant is that the snap opengl interface typically forwards /usr/lib/$ARCH_TRIPLET/dri/ into the snap environment so the dri modules of the host are available … if the drivers live in /opt this wont happen …

one option to (grossly) hack around that issue could be to actually ship the driver inside the snap by putting it into some valid library search path under $SNAP (though this will likely break the first time there are newer symbols on one of the sides (driver vs host versions))

If amdgpu-pro put in a snap package, could it simplify its work in the system?

I tried to install and run this application without a amdgpu-pro. Here is a log

qml-hello-world
libGL error: unable to load driver: amdgpu_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: amdgpu
libGL error: unable to load driver: amdgpu_dri.so
libGL error: driver pointer missing
libGL error: failed to load driver: amdgpu

This is the log after running my application.
managetime
/usr/share/libdrm/amdgpu.ids: No such file or directory

@ogra any update on this?

i neither have that hardware nor do i work on that interface, thats a thing for @mborzecki or someone from his team i guess …