Building image failed, but build log showed no real error

Hi,

I cloned openwrt source, and was trying to build a custom image. The build took a long time, but failed eventually. The error log didn't seem to show anything useful. Could someone help me identify which step specifically failed it?

I tried twice, and it failed twice. Doesn't seem to be random. I was building an x86-64
22.03.3 image, on an x86-64 machine.

This is from the tail of the error log:

2023-04-02T12:55:08.6323145Z touch /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/.built
2023-04-02T12:55:08.6389312Z mkdir -p /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/bin/targets/x86/64/packages /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/ipkg-x86_64/grub2-bios-setup/CONTROL /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/staging_dir/target-x86_64_musl/pkginfo
2023-04-02T12:55:08.6467887Z install -d -m0755 /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/ipkg-x86_64/grub2-bios-setup/usr/sbin
2023-04-02T12:55:08.6500730Z install -m0755 /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/grub-bios-setup /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/ipkg-x86_64/grub2-bios-setup/usr/sbin/
2023-04-02T12:55:08.6575122Z find /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/ipkg-x86_64/grub2-bios-setup -name 'CVS' -o -name '.svn' -o -name '.#*' -o -name '*~'| xargs -r rm -rf
2023-04-02T12:55:08.6955225Z export CROSS="x86_64-openwrt-linux-musl-"  NO_RENAME=1 ; NM="x86_64-openwrt-linux-musl-nm" STRIP="/home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/staging_dir/host/bin/sstrip -z" STRIP_KMOD="/home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/scripts/strip-kmod.sh" PATCHELF="/home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/staging_dir/host/bin/patchelf" /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/scripts/rstrip.sh /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/ipkg-x86_64/grub2-bios-setup
2023-04-02T12:55:08.7037909Z rstrip.sh: /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/ipkg-x86_64/grub2-bios-setup/usr/sbin/grub-bios-setup: executable
2023-04-02T12:55:08.7113927Z (cd /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/ipkg-x86_64/grub2-bios-setup/CONTROL; ( echo "$CONTROL"; printf "Description: "; echo "$DESCRIPTION" | sed -e 's,^[[:space:]]*, ,g'; ) > control; chmod 644 control; ( echo "#!/bin/sh"; echo "[ \"\${IPKG_NO_SCRIPT}\" = \"1\" ] && exit 0"; echo "[ -s "\${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; echo ". \${IPKG_INSTROOT}/lib/functions.sh"; echo "default_postinst \$0 \$@"; ) > postinst; ( echo "#!/bin/sh"; echo "[ -s "\${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; echo ". \${IPKG_INSTROOT}/lib/functions.sh"; echo "default_prerm \$0 \$@"; ) > prerm; chmod 0755 postinst prerm;  )
2023-04-02T12:55:08.7189249Z install -d -m0755 /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/bin/targets/x86/64/packages
2023-04-02T12:55:08.7219971Z /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/staging_dir/host/bin/fakeroot /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/staging_dir/host/bin/bash /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/scripts/ipkg-build -m "" /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/ipkg-x86_64/grub2-bios-setup /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/bin/targets/x86/64/packages
2023-04-02T12:55:08.8772708Z Packaged contents of /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/ipkg-x86_64/grub2-bios-setup into /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/bin/targets/x86/64/packages/grub2-bios-setup_2.06-1_x86_64.ipk
2023-04-02T12:55:08.8808600Z rm -rf /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/.pkgdir/grub2-bios-setup.installed /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/.pkgdir/grub2-bios-setup
2023-04-02T12:55:08.8834833Z mkdir -p /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/.pkgdir/grub2-bios-setup
2023-04-02T12:55:08.8865580Z install -d -m0755 /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/.pkgdir/grub2-bios-setup/usr/sbin
2023-04-02T12:55:08.8897199Z install -m0755 /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/grub-bios-setup /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/.pkgdir/grub2-bios-setup/usr/sbin/
2023-04-02T12:55:08.8937343Z touch /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/.pkgdir/grub2-bios-setup.installed
2023-04-02T12:55:08.8962822Z mkdir -p /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/staging_dir/target-x86_64_musl/root-x86/stamp
2023-04-02T12:55:08.8998872Z SHELL= flock /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/tmp/.root-copy.flock -c 'cp -fpR /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/build_dir/target-x86_64_musl/linux-x86_64/grub-none/grub-2.06/.pkgdir/grub2-bios-setup/. /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/staging_dir/target-x86_64_musl/root-x86/'
2023-04-02T12:55:08.9062862Z touch /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/staging_dir/target-x86_64_musl/root-x86/stamp/.grub2-bios-setup_installed
2023-04-02T12:55:08.9179152Z echo "grub2-bios-setup" >> /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/staging_dir/target-x86_64_musl/pkginfo/grub2.none.install
2023-04-02T12:55:08.9200946Z make[3]: Leaving directory '/home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/package/boot/grub2'
2023-04-02T12:55:08.9202748Z time: package/boot/grub2/none/compile#81.36#12.67#91.32
2023-04-02T12:55:08.9218712Z make[2]: Leaving directory '/home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3'
2023-04-02T12:55:08.9224871Z make[1]: *** [package/Makefile:110: /home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/staging_dir/target-x86_64_musl/stamp/.package_compile] Error 2
2023-04-02T12:55:09.1136364Z make[1]: Leaving directory '/home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3'
2023-04-02T12:55:09.1257940Z make: *** [/home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/include/toplevel.mk:230: world] Error 2
2023-04-02T12:55:09.1784092Z ##[error]Process completed with exit code 2.

Sure it does:

2023-04-02T12:55:09.1257940Z make: *** [/home/runner/work/openwrt-images/openwrt-images/openwrt/build/22.03.3/include/toplevel.mk:230: world] Error 2
2023-04-02T12:55:09.1784092Z ##[error]Process completed with exit code 2.

Try make -j1 V=sc to increase the verbosity level. When it fails, you will need to trace backwards through the output to put a finger where it fails (could be a long way back).

It’s up to you to find where it fails. Most times, it is usually quite evident and quickly resolved.

Thanks for the help.

That log was generated with V=sc, so it was as verbose as it could be.

That particular line seems to result from a previous build error and not the cause of the error, which I'm unable to find.

Try a make clean before starting up the next build.

This might help: https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem#spotting_build_errors

This was a fresh build after clone, without any previous build result.

But did you include -j 1 also, not only V=sc? That is also needed otherwise because of parallel compiling you won't have the error message belonging to the same error bundled together.

2 Likes

Oh, thanks for the heads up. Because of parallelism, the actual error message was probably pretty far away. I will try -j 1 and see if it's more obvious.

Thanks.