Meson compile fails

meson keeps failing on my with 1 of the patches failing

make[2]: Entering directory '/home/pi/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/home/pi/openwrt/scripts/config'
make[1]: Entering directory '/home/pi/openwrt'
cd "/home/pi/openwrt"; git log --format=%h -1 toolchain > /home/pi/openwrt/tmp/.ver_check
cmp -s /home/pi/openwrt/tmp/.ver_check /home/pi/openwrt/staging_dir/toolchain-aarch64_cortex-a72_gcc-13.3.0_musl/stamp/.ver_check || { \
	rm -rf /home/pi/openwrt/build_dir/target-aarch64_cortex-a72_musl /home/pi/openwrt/staging_dir/target-aarch64_cortex-a72_musl /home/pi/openwrt/staging_dir/toolchain-aarch64_cortex-a72_gcc-13.3.0_musl /home/pi/openwrt/build_dir/toolchain-aarch64_cortex-a72_gcc-13.3.0_musl; \
	mkdir -p /home/pi/openwrt/staging_dir/toolchain-aarch64_cortex-a72_gcc-13.3.0_musl/stamp; \
	mv /home/pi/openwrt/tmp/.ver_check /home/pi/openwrt/staging_dir/toolchain-aarch64_cortex-a72_gcc-13.3.0_musl/stamp/.ver_check; \
}
mkdir -p /home/pi/openwrt/build_dir/target-aarch64_cortex-a72_musl/stamp
touch /home/pi/openwrt/staging_dir/target-aarch64_cortex-a72_musl/.prepared
mkdir -p /home/pi/openwrt/build_dir/host/stamp /home/pi/openwrt/staging_dir/host/include/sys
install -m0644 /home/pi/openwrt/tools/include/*.h /home/pi/openwrt/staging_dir/host/include/
install -m0644 /home/pi/openwrt/tools/include/sys/*.h /home/pi/openwrt/staging_dir/host/include/sys/
ln -snf lib /home/pi/openwrt/staging_dir/host/lib64
touch /home/pi/openwrt/staging_dir/host/.prepared
make[2]: Entering directory '/home/pi/openwrt/tools/flock'
find /home/pi/openwrt/build_dir/host/flock-2.18 -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -print0 | xargs -r -0 rm -rf
make[2]: Leaving directory '/home/pi/openwrt/tools/flock'
time: tools/flock/compile#0.06#0.02#0.08
make[2]: Entering directory '/home/pi/openwrt/tools/libdeflate'
find /home/pi/openwrt/build_dir/host/libdeflate-1.20 -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -print0 | xargs -r -0 rm -rf
make[2]: Leaving directory '/home/pi/openwrt/tools/libdeflate'
time: tools/libdeflate/compile#0.10#0.04#0.14
make[2]: Entering directory '/home/pi/openwrt/tools/zstd'
find /home/pi/openwrt/build_dir/host/zstd-1.5.6 -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -print0 | xargs -r -0 rm -rf
make[2]: Leaving directory '/home/pi/openwrt/tools/zstd'
time: tools/zstd/compile#0.09#0.05#0.14
make[2]: Entering directory '/home/pi/openwrt/tools/sed'
find /home/pi/openwrt/build_dir/host/sed-4.9 -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -print0 | xargs -r -0 rm -rf
make[2]: Leaving directory '/home/pi/openwrt/tools/sed'
time: tools/sed/compile#0.11#0.05#0.14
make[2]: Entering directory '/home/pi/openwrt/tools/patch'
find /home/pi/openwrt/build_dir/host/patch-2.7.6 -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -print0 | xargs -r -0 rm -rf
make[2]: Leaving directory '/home/pi/openwrt/tools/patch'
time: tools/patch/compile#0.06#0.03#0.09
make[2]: Entering directory '/home/pi/openwrt/tools/tar'
find /home/pi/openwrt/build_dir/host/tar-1.35 -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -print0 | xargs -r -0 rm -rf
make[2]: Leaving directory '/home/pi/openwrt/tools/tar'
time: tools/tar/compile#0.11#0.04#0.14
make[2]: Entering directory '/home/pi/openwrt/tools/ninja'
find /home/pi/openwrt/build_dir/host/ninja-1.11.1 -mindepth 1 -maxdepth 1 -not '(' -type f -and -name '.*' -and -size 0 ')' -print0 | xargs -r -0 rm -rf
make[2]: Leaving directory '/home/pi/openwrt/tools/ninja'
time: tools/ninja/compile#0.11#0.04#0.15
make[2]: Entering directory '/home/pi/openwrt/tools/meson'
. /home/pi/openwrt/include/shell.sh; /home/pi/openwrt/staging_dir/host/bin/libdeflate-gzip -dc /home/pi/openwrt/dl/meson-1.5.1.tar.gz | tar -C /home/pi/openwrt/build_dir/host/meson-1.5.1/.. -xf -
[ ! -d ./src/ ] || cp -fpR ./src/* /home/pi/openwrt/build_dir/host/meson-1.5.1

Applying /home/pi/openwrt/tools/meson/patches/010-wsl2.patch using plaintext: 
patching file mesonbuild/minstall.py
Hunk #1 FAILED at 229.
1 out of 1 hunk FAILED -- saving rejects to file mesonbuild/minstall.py.rej
Patch failed!  Please fix /home/pi/openwrt/tools/meson/patches/010-wsl2.patch!
make[2]: Leaving directory '/home/pi/openwrt/tools/meson'
time: tools/meson/compile#0.05#0.05#0.10
    ERROR: tools/meson failed to build.
make[1]: Leaving directory '/home/pi/openwrt'

Not sure what to do ..:~

Patching of that file failed so look in that directory for a .rej file and see what has failed, probably the patch has to be rebased.

It could also be that the patch is not necessary anymore because of upstream update you can see what failed and if it is already in the original file

Or manually make the correct file and make a patch of that

1 Like

Found the .rej file

--- mesonbuild/minstall.py
+++ mesonbuild/minstall.py
@@ -229,7 +229,7 @@ def restore_selinux_contexts() -> None:
     '''
     try:
         subprocess.check_call(['selinuxenabled'])
-    except (FileNotFoundError, NotADirectoryError, PermissionError, subprocess.CalledProcessError):
+    except (FileNotFoundError, NotADirectoryError, OSError, PermissionError, subprocess.CalledProcessError):
         # If we don't have selinux or selinuxenabled returned 1, failure
         # is ignored quietly.
         return

Not sure of the rebasing or checking upstream
Or Tis it 'selinuxenabled' is not ??
Using the mirror-03.infra.openwrt.org/releases/23.05.4/targets/mediatek/filogic/config.buildinfo
as a config with a make oldconfig or makeb deconfig

I moved 010-wsl2.patch out of the patch dir and it compiles.
But I like the patch, lol.
I installed meson python3-mesonpy, but no help.
I think I'm missing some host stuff maybe

Then look into the original file around line 229.
The patch tries to find this line:

Maybe the line is already patched or moved.

It's the OSError the patch adds
It errors out because something is not right on the host I think