Building Mutter from scratch--getting dependencies

Summary

Hi, I’m running Asahi Fedora Remix and I’m trying to patch GNOME to enable better notch compatibility, as instructed on this post. I cloned the Mutter repo, and I’m trying to build it by running meson settup builddir && cd builddir. However, meson wants me to install gnome-desktop-4 as a dependency.

Things I did until now

Meson would fail to find a package, so I’d install the devel version of it. I ended up following this tutorial on how to install dependencies, and ended up with the following code:

dep_list=$(dnf deplist mutter-devel | grep provider | sort -u | awk '{print $2}')
for package in $dep_list
do
    echo "Installing package $package"
    sudo dnf -y install $package 
done
for package in $dep_list; do dnf list installed $package; done

The script worked, and I’d try to run the meson command, and I’d get meson.build:178:22: ERROR: Dependency "gnome-desktop-4" not found, tried pkgconfig and cmake, which is weird. I tried to install gnome-desktop-4-devel and gnome-desktop-4 anyway and wouldn’t get a match.

Requested solution

I’d like a surefire way to install Mutter’s source code and dependencies, and for meson to detect gnome-desktop-4.

I doubt this is an issue specifically related to Asahi, hence why I’m posting on the main forum, but I can post there as well if need be.

Appendix, logs

Meson output
❯ meson setup builddir && cd builddir
The Meson build system
Version: 1.3.2
Source dir: /home/name/Documents/mutter
Build dir: /home/name/Documents/mutter/builddir
Build type: native build
Project name: mutter
Project version: 46.0
C compiler for the host machine: cc (gcc 13.2.1 "cc (GCC) 13.2.1 20240316 (Red Hat 13.2.1-7)")
C linker for the host machine: cc ld.bfd 2.40-14
Host machine cpu family: aarch64
Host machine cpu: aarch64
Compiler for C supports link arguments -Wl,--disable-new-dtags: YES 
Library m found: YES
Found pkg-config: YES (/usr/bin/pkg-config) 1.9.5
Run-time dependency graphene-gobject-1.0 found: YES 1.10.6
Run-time dependency gdk-pixbuf-2.0 found: YES 2.42.10
Run-time dependency pango found: YES 1.51.0
Run-time dependency cairo found: YES 1.18.0
Run-time dependency pangocairo found: YES 1.51.0
Run-time dependency pixman-1 found: YES 0.42.2
Run-time dependency fribidi found: YES 1.0.13
Run-time dependency gsettings-desktop-schemas found: YES 45.0
Run-time dependency glib-2.0 found: YES 2.78.3
Run-time dependency gio-unix-2.0 found: YES 2.78.3
Dependency gio-unix-2.0 found: YES 2.78.3 (cached)
Run-time dependency gobject-2.0 found: YES 2.78.3
Dependency gobject-2.0 found: YES 2.78.3 (cached)
Run-time dependency gmodule-no-export-2.0 found: YES 2.78.3
Run-time dependency gnome-settings-daemon found: YES 45.1
Run-time dependency xkbcommon found: YES 1.6.0
Run-time dependency ice found: YES 1.0.10
Run-time dependency atk found: YES 2.50.2
Run-time dependency dbus-1 found: YES 1.14.10
Run-time dependency colord found: YES 1.4.6
Run-time dependency lcms2 found: YES 2.15
Run-time dependency harfbuzz found: YES 8.2.1
Run-time dependency libeis-1.0 found: YES 1.2.1
Run-time dependency libei-1.0 found: YES 1.2.1
Run-time dependency gtk4 found: YES 4.12.5
Run-time dependency x11 found: YES 1.8.7
Run-time dependency xcomposite found: YES 0.4.5
Run-time dependency xcursor found: YES 1.2.1
Run-time dependency xdamage found: YES 1.1.5
Run-time dependency xext found: YES 1.3.5
Run-time dependency xfixes found: YES 6.0.0
Run-time dependency xi found: YES 1.8.1
Run-time dependency xtst found: YES 1.2.4
Run-time dependency xkbfile found: YES 1.1.1
Run-time dependency xkeyboard-config found: YES 2.40
Run-time dependency xkbcommon-x11 found: YES 1.6.0
Run-time dependency xrender found: YES 0.9.11
Run-time dependency x11-xcb found: YES 1.8.7
Run-time dependency xrandr found: YES 1.5.4
Run-time dependency xcb-randr found: YES 1.13.1
Run-time dependency xcb-res found: YES 1.13.1
Run-time dependency xinerama found: YES 1.1.5
Run-time dependency xau found: YES 1.0.11
Run-time dependency libdisplay-info found: YES 0.1.1
Found CMake: /usr/bin/cmake (3.27.7)
Run-time dependency gnome-desktop-4 found: NO (tried pkgconfig and cmake)

meson.build:178:22: ERROR: Dependency "gnome-desktop-4" not found, tried pkgconfig and cmake
Meson log output for gnome-desktop-4, in case that's needed
Called: `/usr/bin/pkg-config --modversion gnome-desktop-4` -> 1
stderr:
Package gnome-desktop-4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gnome-desktop-4.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gnome-desktop-4', required by 'virtual:world', not found
-----------
CMake binary for host machine is not cached
CMake binary missing from cross or native file, or env var undefined.
Trying a default CMake fallback at cmake
Found CMake: /usr/bin/cmake (3.27.7)
Extracting basic cmake information
CMake Toolchain: Calling CMake once to generate the compiler state
Calling CMake (['/usr/bin/cmake']) in /home/name/Documents/mutter/builddir/meson-private/__CMake_compiler_info__ with:
  - "--trace-expand"
  - "--trace-format=json-v1"
  - "--no-warn-unused-cli"
  - "--trace-redirect=cmake_trace.txt"
  - "-G"
  - "Ninja"
  - "-DCMAKE_TOOLCHAIN_FILE=/home/name/Documents/mutter/builddir/meson-private/__CMake_compiler_info__/CMakeMesonTempToolchainFile.cmake"
  - "."
Try CMake generator: auto
Calling CMake (['/usr/bin/cmake']) in /home/name/Documents/mutter/builddir/meson-private/cmake_gnome-desktop-4 with:
  - "--trace-expand"
  - "--trace-format=json-v1"
  - "--no-warn-unused-cli"
  - "--trace-redirect=cmake_trace.txt"
  - "-DCMAKE_TOOLCHAIN_FILE=/home/name/Documents/mutter/builddir/meson-private/cmake_gnome-desktop-4/CMakeMesonToolchainFile.cmake"
  - "."
  -- Module search paths:    ['/', '/opt', '/usr', '/usr/local']
  -- CMake root:             /usr/share/cmake
  -- CMake architectures:    []
  -- CMake lib search paths: ['lib', 'lib32', 'lib64', 'libx32', 'share', '']
Preliminary CMake check failed. Aborting.
Run-time dependency gnome-desktop-4 found: NO (tried pkgconfig and cmake)

meson.build:178:22: ERROR: Dependency "gnome-desktop-4" not found, tried pkgconfig and cmake

You can use sudo dnf builddep mutter to install all build dependencies. Also, to install the devel package for a specific .pc file, you can use e.g. sudo dnf install pkgconfig(gnome-desktop-4) (it’s gnome-desktop4-devel).

I would consider building a custom rpm package with the patch applied; it would be a lot less likely to break your system.

2 Likes

Thanks so much! I was able to use fedpkg to grab the source code and apply the patch. However, I’m still unsure how to build the rpm package. I moved the source code to its own directory, and if I do fedpkg mockbuild or fedpkg local, I get this error:

Failed to get repository name from Git url or pushurl
Failed to get ns from Git url or pushurl

The meson setup builddir command still works, so should I use meson and ninja to make the RPM package?
Thanks!

Added asahi

Because the patch already exists, you can skip some of that guide:

$ fedpkg co -a mutter
$ cd mutter
$ git switch f40
<download patch file into this directory and modify mutter.spec>
$ fedpkg local

The change to mutter.spec is mainly just to add:

Patch: MBP14_notch.patch

You should also change Release to something like:

Release:       %autorelease.MBP14_notch

Managed to build successfully, can’t seem to install it though

Had two directors, aarch64 and noarch. Ran sudo dnf install aarch64/mutter-45.5-1.fc39.asahi_notchpatch.aarch64.rpm and got

Error: 
 Problem: conflicting requests
  - nothing provides mutter-common = 45.5-1.fc39.asahi_notchpatch needed by mutter-45.5-1.fc39.asahi_notchpatch.aarch64 from @commandline
(try to add '--skip-broken' to skip uninstallable packages)

Tried running sudo dnf install noarch/mutter-common-45.5-1.fc39.asahi_notchpatch.noarch.rpm and got

Last metadata expiration check: 0:00:43 ago on Thu 18 Apr 2024 06:23:08 PM EDT.
allow_vendor_change is disabled. This option is currently not supported for downgrade and distro-sync commands
Error: 
 Problem: problem with installed package mutter-common-45.5-1.fc39.noarch
  - cannot install both mutter-common-45.5-1.fc39.asahi_notchpatch.noarch from @commandline and mutter-common-45.5-1.fc39.noarch from @System
  - cannot install both mutter-common-45.5-1.fc39.asahi_notchpatch.noarch from @commandline and mutter-common-45.0-12.fc39.noarch from fedora
  - cannot install both mutter-common-45.5-1.fc39.asahi_notchpatch.noarch from @commandline and mutter-common-45.5-1.fc39.noarch from updates
  - conflicting requests
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages)

I will say, I thought I managed to install these packages correctly at first, but I think I just installed the unpatched versions and I ran these commands after trying to reinstall.

Try installing both packages at the same time.

Didn’t work :frowning:
mutter common first:

sudo dnf install noarch/mutter-common-45.5-1.fc39.asahi_notchpatch.noarch.rpm aarch64/mutter-45.5-1.fc39.asahi_notchpatch.aarch64.rpm
[sudo] password for name: 
Last metadata expiration check: 0:51:01 ago on Thu 18 Apr 2024 06:23:08 PM EDT.
allow_vendor_change is disabled. This option is currently not supported for downgrade and distro-sync commands
Error: 
 Problem 1: problem with installed package mutter-common-45.5-1.fc39.noarch
  - cannot install both mutter-common-45.5-1.fc39.asahi_notchpatch.noarch from @commandline and mutter-common-45.5-1.fc39.noarch from @System
  - cannot install both mutter-common-45.5-1.fc39.asahi_notchpatch.noarch from @commandline and mutter-common-45.0-12.fc39.noarch from fedora
  - cannot install both mutter-common-45.5-1.fc39.asahi_notchpatch.noarch from @commandline and mutter-common-45.5-1.fc39.noarch from updates
  - conflicting requests
 Problem 2: problem with installed package mutter-45.5-1.fc39.aarch64
  - cannot install both mutter-45.5-1.fc39.asahi_notchpatch.aarch64 from @commandline and mutter-45.5-1.fc39.aarch64 from @System
  - cannot install both mutter-45.5-1.fc39.asahi_notchpatch.aarch64 from @commandline and mutter-45.0-12.fc39.aarch64 from fedora
  - cannot install both mutter-45.5-1.fc39.asahi_notchpatch.aarch64 from @commandline and mutter-45.5-1.fc39.aarch64 from updates
  - conflicting requests
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages)

mutter first

sudo dnf install aarch64/mutter-45.5-1.fc39.asahi_notchpatch.aarch64.rpm noarch/mutter-common-45.5-1.fc39.asahi_notchpatch.noarch.rpm
Last metadata expiration check: 0:51:41 ago on Thu 18 Apr 2024 06:23:08 PM EDT.
allow_vendor_change is disabled. This option is currently not supported for downgrade and distro-sync commands
Error: 
 Problem 1: problem with installed package mutter-45.5-1.fc39.aarch64
  - cannot install both mutter-45.5-1.fc39.asahi_notchpatch.aarch64 from @commandline and mutter-45.5-1.fc39.aarch64 from @System
  - cannot install both mutter-45.5-1.fc39.asahi_notchpatch.aarch64 from @commandline and mutter-45.0-12.fc39.aarch64 from fedora
  - cannot install both mutter-45.5-1.fc39.asahi_notchpatch.aarch64 from @commandline and mutter-45.5-1.fc39.aarch64 from updates
  - conflicting requests
 Problem 2: problem with installed package mutter-common-45.5-1.fc39.noarch
  - cannot install both mutter-common-45.5-1.fc39.asahi_notchpatch.noarch from @commandline and mutter-common-45.5-1.fc39.noarch from @System
  - cannot install both mutter-common-45.5-1.fc39.asahi_notchpatch.noarch from @commandline and mutter-common-45.0-12.fc39.noarch from fedora
  - cannot install both mutter-common-45.5-1.fc39.asahi_notchpatch.noarch from @commandline and mutter-common-45.5-1.fc39.noarch from updates
  - conflicting requests
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages)

I think that may be the issue. Try adding --setopt=allow_vendor_change=true. Fedora Asahi Remix apparently has that disabled by default.

sudo dnf install noarch/mutter-common-45.5-1.fc39.asahi_notchpatch.noarch.rpm --setopt=allow_vendor_change=true didn’t work either. Similar errors.

Output
download.vscodium.com                                                                         3.8 kB/s | 833  B     00:00    
Error: 
 Problem: problem with installed package mutter-45.5-1.fc39.aarch64
  - package mutter-45.5-1.fc39.aarch64 from @System requires mutter-common = 45.5-1.fc39, but none of the providers can be installed
  - package mutter-45.5-1.fc39.aarch64 from updates requires mutter-common = 45.5-1.fc39, but none of the providers can be installed
  - package mutter-45.0-12.fc39.aarch64 from fedora requires mutter-common = 45.0-12.fc39, but none of the providers can be installed
  - cannot install both mutter-common-45.5-1.fc39.asahi_notchpatch.noarch from @commandline and mutter-common-45.5-1.fc39.noarch from @System
  - cannot install both mutter-common-45.5-1.fc39.asahi_notchpatch.noarch from @commandline and mutter-common-45.0-12.fc39.noarch from fedora
  - cannot install both mutter-common-45.5-1.fc39.asahi_notchpatch.noarch from @commandline and mutter-common-45.5-1.fc39.noarch from updates
  - conflicting requests
(try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages)

Not sure if it’d be worth doing --allowerasting simply because it’s mutter and I don’t wanna remove pretty crucial dependencies, and doesn’t seem like the kind of issue that allowerasing would fix (afaik).

I’ll look more into these errors as well, seems weird.
Also I have no idea why VSCodium is showing up haha.

Please combine both of my suggestions. You need to specify both packages (because they can’t be upgraded separately), and you need to allow vendor change.

I’ve confirmed that the packages I built in a F40 toolbox can be used to upgrade mutter when allow_vendor_change is enabled (as it is by default in Fedora proper). Disabling it produces a similar error to the one you got.

Ah gotcha, apologies for misinterpreting.

Same exact error. Saw this post suggesting that the --allowerasing option can, in fact, be used. Ran it, saw that the only package that would be removed would be mutter-devel, so I proceeded. Seemed to work. Thanks so much for your help!

Well actually, one more thing, any way to confirm the patched version of mutter is being used through the terminal or something (like mutter --version or something)? Behavior’s not as expected but I’m guessing it’s just the patch. Just wanna make sure.

Well, you can check that your version is installed with e.g. rpm -qa | grep mutter. Mutter’s (upstream) version hasn’t changed.

One sanity check would be to intentionally break the patch and verify that it fails to compile (and thus is being applied). You could also add a printf to see if this branch is being hit, e.g. change line 12 to:

+    g_print ("Notch patch active\n"); 

You should see that message in journalctl --user -b.

There’s also a companion GNOME Shell extension apparently, but the basic functionality of constraining apps below the notch should work without it.

Worked for me, thanks! Guess it’s just the patch haha.

I won’t post future responses but I’ll put some updates in case anyone applying the same patch runs into the same issue.

  • Current issue is that a fullscreen YouTube video still takes up notch space, and when I run the given extension, it overlaps. My guess is I just put in the full screen size when the patch intended for me to put in the screen size without the notch. Never mind, needs full size.