# Summary xfwm4 (master git) compilation fails when configured as out-of-source build. # Motivation * Out-of-source build is highly desirable because source tree remains free of build artifact which, among other things, sometimes produce ill-effect. * Among the benefits for the occasional contributor, it allows to efficiently grep in the source tree without seeing a lot of uninteresting hits in generated files. * Others benefits of out-of-source build are mentioned e.g. in http://voices.canonical.com/jussi.pakkanen/2013/04/16/why-you-should-consider-using-separate-build-directories/ * Out-of-source build has been supported in autoconf for a long time now, see for example this post from 2009: https://stackoverflow.com/questions/1311231/store-gnu-make-generated-files-elsewhere . As shown below, one can have several build tree can be stored anywhere, not necessarily as a "build" subdir. For example, one build tree per target architecture, or debug/test/optimized builds, etc, from the very same source tree. # Symptom when compiling xfwm4 As shown by `make -k`, it appear that nearly everything builds right out-of-source, except fetching resources like svg icons. Making all in common make[2]: Entering directory '/.../xfwm4.buildtree/common' make[2]: Nothing to be done for 'all'. make[2]: Leaving directory '/.../xfwm4.buildtree/common' Making all in settings-dialogs make[2]: Entering directory '/.../xfwm4.buildtree/settings-dialogs' GEN workspace-resource.h /.../xfwm4/settings-dialogs/workspace.gresource.xml: Failed to locate ?monitor-icon.svg? in current directory. Makefile:1025: recipe for target 'workspace-resource.h' failed make[2]: *** [workspace-resource.h] Error 1 make[2]: Leaving directory '/.../xfwm4.buildtree/settings-dialogs' Makefile:510: recipe for target 'all-recursive' failed make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory '/.../xfwm4.buildtree' Makefile:442: recipe for target 'all' failed make: *** [all] Error 2 # Additional information Reproducible: always * On same system, xfwm4 builds okay in-source, not out-of-source. * On same system, tumbler (git clone https://git.xfce.org/xfce/tumbler) builds okay both in-source and out-of-source. # Steps to reproduce: The steps probably work on a vanilla Xubuntu system. They successfully reproduce the issue here. sudo apt-get build-dep xfce4-xfwm4 tumbler sudo apt-get insall libwnck-3-dev git clone http://git.xfce.org/xfce/xfwm4 ; cd xfwm4 git clean -dfx export MYPREFIX="${PWD}.installtree" ( export LC_ALL=C set -eu export SRCTREE="${PWD}" export BUILDTREE="${PWD}.buildtree" mkdir m4 NOCONFIGURE=indeed xdt-autogen rm -rf "$BUILDTREE" "$MYPREFIX" mkdir "$BUILDTREE" "$MYPREFIX" cd "$BUILDTREE" "${SRCTREE}"/configure --enable-maintainer-mode --prefix="${MYPREFIX?}" --enable-debug=yes time make -j8 -k || time make time make install && echo "BUILD SUCCESSFUL" ) To test with tumbler, replace the git line with: git clone https://git.xfce.org/xfce/tumbler ; cd tumbler Thank you for your attention. # Context information Ubuntu 18.04 AMD64 Exact source tree reference for xfwm4: commit dc1610147ddfc77df40cf24c88c8083f24e531ef Exact source tree reference for tumbler: commit 79b961a8520715fbd800c9def0632bc19569ecc1
Created attachment 7840 Add --sourcedir argument to glib-compile-resource This is easy to fix. glib-compile-resources is run from target directory, which is fine. One just has to add a --sourcedir argument. From "man glib-compile-resources": --sourcedir=DIRECTORY The files referenced in FILE are loaded from this directory. If not specified, the current directory is used. The attached patch makes allows out-of-source build to succeed.
Stephane Gourichon referenced this bugreport in commit 9392f50e2d8e8568fc54a400fa310c7e02a76080 Fix build out of tree https://git.xfce.org/xfce/xfwm4/commit?id=9392f50e2d8e8568fc54a400fa310c7e02a76080
Pushed, thanks!