Ubuntu 22.04 with Qt 6 Crash
-
Alright, been at this one for the entire day and I cannot seem to figure it out.
The following code crashes:
#include <QApplication> #include <QMainWindow> int main(int argc, char * argv[]) { QApplication a(argc, argv); QMainWindow win; win.show(); return a.exec(); }
The crash happens in the eglGetPlatformDisplay call (which is called within win.show())
void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display) { #if QT_CONFIG(egl_extension_platform_wayland) m_eglDisplay = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, display->wl_display(), nullptr); #else ...
This is the last stack frame before we get in to assembly for the crash - which seems to happen in xcb_get_extension_data.
And if I examine the QWaylandDisplay - it seems as though it is largely uninitialized - but I'm thinking this function might have the purpose of filling it out and initializing it considering its passed as a non const pointer.
I have both Qt 6.3.2 and 6.5.2 and I'm getting this same crash on this computer only.
This is a new computer running a 7900 XTX graphics card - I had to use the amdgpu_install script to get Ubuntu to work without being in safe mode.
I'm assuming I am missing some library - but I have installed every xcb, wayland, mesa, gl, vulkan library that I could find. Not sure what to do next - any insight would be appreciated. Thanks
-
An update for anyone who comes across this: It was an issue with the amdgpu drivers and default package manager Vulkan libraries.
To get everything working with wayland, I first downloaded amdgpu_install deb package from AMD drivers page (just filled in GPU info and it brought me to the download page) - they call it "Radeon Software for Linux". Installed the deb once downloaded (used apt install on it).
Once installed, amdgpu_install is available to use in the terminal. Read the instructions for which options to use when running amdgpu_install. I went with:
amdgpu_install -y --vulkan=amdvlk,pro --opencl=rocr,legacy --accept-eula
Once the driver is installed (with reboot), the newest vulkan SDK needs to be installed. This is easily missed but it's mentioned in the driver page "Release Notes". I just went to https://vulkan.lunarg.com/sdk/home and followed the instructions to install the latest SDK using the package manager - the apt instructions for me were:
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.3.250-jammy.list https://packages.lunarg.com/vulkan/1.3.250/lunarg-vulkan-1.3.250-jammy.list sudo apt update sudo apt install vulkan-sdk
I could see the above command installing a bunch of qt wayland libraries so I was hopeful. Sure enough, once complete, the crash was gone.
-
Alright, been at this one for the entire day and I cannot seem to figure it out.
The following code crashes:
#include <QApplication> #include <QMainWindow> int main(int argc, char * argv[]) { QApplication a(argc, argv); QMainWindow win; win.show(); return a.exec(); }
The crash happens in the eglGetPlatformDisplay call (which is called within win.show())
void QWaylandEglClientBufferIntegration::initialize(QWaylandDisplay *display) { #if QT_CONFIG(egl_extension_platform_wayland) m_eglDisplay = eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_EXT, display->wl_display(), nullptr); #else ...
This is the last stack frame before we get in to assembly for the crash - which seems to happen in xcb_get_extension_data.
And if I examine the QWaylandDisplay - it seems as though it is largely uninitialized - but I'm thinking this function might have the purpose of filling it out and initializing it considering its passed as a non const pointer.
I have both Qt 6.3.2 and 6.5.2 and I'm getting this same crash on this computer only.
This is a new computer running a 7900 XTX graphics card - I had to use the amdgpu_install script to get Ubuntu to work without being in safe mode.
I'm assuming I am missing some library - but I have installed every xcb, wayland, mesa, gl, vulkan library that I could find. Not sure what to do next - any insight would be appreciated. Thanks
@dprandle I don't think the cause for this crash is a missing library. This looks more like an issue with graphics driver and/or Wayland. You can try with X11 (I think you can select X11 when you log in) and also with other driver (the one from AMD versus OSS driver).
-
@dprandle I don't think the cause for this crash is a missing library. This looks more like an issue with graphics driver and/or Wayland. You can try with X11 (I think you can select X11 when you log in) and also with other driver (the one from AMD versus OSS driver).
@jsulm Thanks - it does indeed work in X11 which is a work around for now. What did you mean by try using the AMD drivers vs the OSS one? At the moment the only GPU driver I can use is amdgpu - if I disable it I cannot boot.
I suppose I could try running in safe mode and see if I get the crash.
The odd thing is that Qt Creator and Designer both work - I suppose they may not be using the same wayland-egl library.
I can see (using QT_DEBUG_PLUGINS=1) that the crash occurs right after loading libqt-plugin-wayland-egl.so library (but the load of the library does complete)
-
@jsulm Thanks - it does indeed work in X11 which is a work around for now. What did you mean by try using the AMD drivers vs the OSS one? At the moment the only GPU driver I can use is amdgpu - if I disable it I cannot boot.
I suppose I could try running in safe mode and see if I get the crash.
The odd thing is that Qt Creator and Designer both work - I suppose they may not be using the same wayland-egl library.
I can see (using QT_DEBUG_PLUGINS=1) that the crash occurs right after loading libqt-plugin-wayland-egl.so library (but the load of the library does complete)
@dprandle said in Ubuntu 22.04 with Qt 6 Crash:
amdgpu
This is the open source driver, as far as I know AMD also provides a closed source one.
-
@dprandle said in Ubuntu 22.04 with Qt 6 Crash:
amdgpu
This is the open source driver, as far as I know AMD also provides a closed source one.
@jsulm Ahh - they did have closed source drivers a number of years ago, but they now only have open source - though they do have proprietary and open source versions of Vulkan implementation specifically.
I can retry with the open source version of Vulkan and see if I have any success. I would guess that wayland-egl, however, would be using opengl and not Vulkan.
As the 7900 XTX is so new (and required newer drivers than apt provides for 22.04) it probably is some issue between Wayland and amdgpu.
-
@jsulm Ahh - they did have closed source drivers a number of years ago, but they now only have open source - though they do have proprietary and open source versions of Vulkan implementation specifically.
I can retry with the open source version of Vulkan and see if I have any success. I would guess that wayland-egl, however, would be using opengl and not Vulkan.
As the 7900 XTX is so new (and required newer drivers than apt provides for 22.04) it probably is some issue between Wayland and amdgpu.
@dprandle said in Ubuntu 22.04 with Qt 6 Crash:
they did have closed source drivers a number of years ago, but they now only have open source
Good to know. Did not use AMD graphics cards in my machine since many years.
-
An update for anyone who comes across this: It was an issue with the amdgpu drivers and default package manager Vulkan libraries.
To get everything working with wayland, I first downloaded amdgpu_install deb package from AMD drivers page (just filled in GPU info and it brought me to the download page) - they call it "Radeon Software for Linux". Installed the deb once downloaded (used apt install on it).
Once installed, amdgpu_install is available to use in the terminal. Read the instructions for which options to use when running amdgpu_install. I went with:
amdgpu_install -y --vulkan=amdvlk,pro --opencl=rocr,legacy --accept-eula
Once the driver is installed (with reboot), the newest vulkan SDK needs to be installed. This is easily missed but it's mentioned in the driver page "Release Notes". I just went to https://vulkan.lunarg.com/sdk/home and followed the instructions to install the latest SDK using the package manager - the apt instructions for me were:
wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo tee /etc/apt/trusted.gpg.d/lunarg.asc sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-1.3.250-jammy.list https://packages.lunarg.com/vulkan/1.3.250/lunarg-vulkan-1.3.250-jammy.list sudo apt update sudo apt install vulkan-sdk
I could see the above command installing a bunch of qt wayland libraries so I was hopeful. Sure enough, once complete, the crash was gone.
-