How to build applications that target my hardware

I’m using Bazzite but this is a general development question with regards to compiling and running programs that need hardware access like the GPU.

I am trying to build and run the Bevy game engine which requires some devel dependencies to be installed, for example libX11-devel, alsa-lib-devel, systemd-devel, wayland-devel and libxkbcommon-devel. While these libs are installed in the base system, the devel packages are not.

I tried adding an Ubuntu container using BoxBuddy and installing the required packages through that (I’m more familiar with Ubuntu/apt) which allowed me to compile bevy, but when I run bevy from the Ubuntu container it does not detect my NVIDIA GPU. It did run Bevy but it was using LLVM Pipe instead of the NVIDIA driver.

In the end I installed the devel dependencies using rpm-ostree which worked as expected but I know this isn’t the recommended way of doing things.

Is there a better way of installing dev dependencies while still being able to access the hardware of the host system like the NVIDIA driver or is the rpm-ostree approach for now?

Which ubuntu container did you use? distrobox list should give you the exact one.

I’ve deleted it now but it was ubuntu-toolbox:24.04.

Yeah I would doublecheck that you’re enabling nvidia in the box when creating it:

Ah thanks for that, I was used BoxBuddy to create the container and I don’t think that was surfaced that option. I will give that a try when I’m back at my home PC.

I have tried this out now and it is not only partially working, GL applications can use the NVIDIA GPU but Vulkan applications cannot. Bevy uses WGPU which is a higher level abstraction that I think will be using Vulkan under the hood.

I’ve installed the mesa-tools and vuklan-tools packages into the ubuntu-nvidia box, running glxheads shows the GL renderer is using the NVIDIA GPU but running vkcube shows that Vulkan is using the llvmpipe software renderer (glxinfo/vulkaninfo display more detailed info but effectively show the same thing).

I can see the GPU as expected if I use a tool like screenfetch.

Googling this, there was a similar issue in Bazzite a few years ago Nvidia distrobox integration not working... - Universal Blue and a fix was made for arch distrobox fix(desktop): Add nvidia distrobox fix found by bsherman · ublue-os/bazzite@91c2b39 · GitHub. Could this be the same problem but for Ubuntu?

This seems to be a problem with the Ubuntu image, I tried bazzite-arch and fedora with the --nvidia flag and Vulkan seems to be working for those.

1 Like