How can I enable Freedesktop SDK Extensions in GNOME Builder?

Given a simple Java “Hello world” project with a basic pom.xml file, when trying to build it on GNOME Builder I get the following:

bwrap: execvp mvn: No such file or directory

Which means it can’t find the Maven executable on the selected build environment which is org.freedesktop.Sdk/24.08. The org.freedesktop.Sdk.Extension.openjdk21/24.08 extension is installed and it can be confirmed by opening a Build or Runtime terminal on Builder and check the existence of the /usr/lib/sdk/openjdk21 directory. The question is: how can I enable the extension so that the binaries provided by the extension are available for usage, without having to manually source the /usr/lib/sdk/xxxxxxx/enable.sh script?

1 Like

What does your flatpak-builder json look like?

1 Like

There’s no such file in the project

The Freedesktop SDK are build for use with Flatpak apps. Therefore, it is normally expected to have a Flatpak manifest file which describes the build process.

The SDK extensions to use is also defined over the Flatpak manifest.

So, if you intend to use the Freedesktop SDK, you should probably write a Flatpak manifest and let Gnome Builder use this. Check the Flatpak Docs and the OpenJDK extension Readme on how a manifest should look like.

If using Flatpak is not suitable, you should use a different build environment, for example a build container set up with Toolbx.

1 Like

Thank you for the reply. That’s quite a pity, as it would have been nice to have the same dev environment to be used by multiple editors, including GNOME Builders and all the editors which adopt ide-flatpak-wrapper which apparently make use of the FreeDesktop environment along with its SDKs for general-purpose use.

Thing is, Gnome Builder does not utilize ide-flatpak-wrapper, by looking at the manifest. ide-flatpak-wrapper was created to make IDE’s like VS Code work in the Flatpak environment.
These IDE’s often expect the development tools to be install system-wide, which doesn’t work well with the Flatpak sandbox.

While Gnome Builder also can use system-wide installed tools (using the Default environment), it also provides good support for Flatpak and containers, which I guess is why ide-flatpak-wrapper is not used here.

However, if your goal is to provide a common build environment that can be used from any development system, I would just recommend to create the Flatpak manifest. This would allow you to clearly specify what is needed to build your app. And the app could be build from the manifest by any system, as long as Flatpak is available.

1 Like