Attempt to build gtk+3.0 from source fails

I am trying to apply a patch to the gtk+3.0 on Ubuntu 21.10 and failing. But more importantly, even without applying the patches, I am unable to build the package.

Here are the steps:

apt-get source "gtk+3.0"
sudo apt-get build-dep "gtk+3.0"
cd gtk+3.0-3.24.40
dpkg-buildpackage -rfakeroot -b -us -uc

This fails with:

make  check-local
make[6]: Entering directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb/win32/vs15'
make[6]: Leaving directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb/win32/vs15'
make[5]: Leaving directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb/win32/vs15'
Making check in vs16
make[5]: Entering directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb/win32/vs16'
make  check-local
make[6]: Entering directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb/win32/vs16'
make[6]: Leaving directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb/win32/vs16'
make[5]: Leaving directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb/win32/vs16'
make[5]: Entering directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb/win32'
make  check-local
make[6]: Entering directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb/win32'
make[6]: Leaving directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb/win32'
make[5]: Leaving directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb/win32'
make[4]: Leaving directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb/win32'
make[4]: Entering directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb'
make  check-local
make[5]: Entering directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb'
make[5]: Leaving directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb'
make[4]: Leaving directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb'
make[3]: *** [Makefile:749: check-recursive] Error 1
make[3]: Target 'check' not remade because of errors.
make[3]: Leaving directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30/debian/build/deb'
dh_auto_test: error: cd debian/build/deb && make -j4 check VERBOSE=1 -k check -j1 returned exit code 2
make[2]: *** [debian/rules:225: override_dh_auto_test] Error 2
make[2]: Leaving directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30'
make[1]: *** [debian/rules:133: binary] Error 2
make[1]: Leaving directory '/home/gaussian/owninstalls/sway-ubuntu/gtk/gtk+3.0-3.24.30'
dpkg-buildpackage: error: debian/rules binary subprocess returned exit status 2
make: *** [Makefile:204: firefox-friendly-gtk] Error 2

This is just the end of the output, after 10+ minutes of compiling. Any ideas what could be wrong?


As @N0rbert pointed out below, trying to build GTK+3.0 as a regular user does not seem to work at the moment. Per comments and my testing, there are at least two ways to build it:

  1. In a Docker container
  2. In an LXC container (the approach taken by me)