Apk compilation requires host lua5.1

Will need to be updated to reflect a new lua5.1 prerequisite in order to build apk (as of Dec 7 snapshot), or lua5.1 will need to be added as a host tool and included in the SDK.

Otherwise when building packages with the SDK (at least) a failed apk build will fail the package build, when following the advice here:

At least on Debian 13 (Trixie), as it does not have lua5.1 installed by default.

I hesitate to simply edit the Wiki for something this core (besides the decision may be to make it a host tool and include in the SDK).

Or.... there is something else going on that resulted in the failure to find the already existing host tool (at ./staging_dir/target-aarch64_cortex-a76_musl/root-bcm27xx/usr/bin/lua5.1): will investigate further.

EDIT: Hmmm....that's not a host tool. I'll have to create a clean environment and get the exact error message, for further debugging.

Nope. It is a missing host tool:

touch /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110/.prepared_481e16543c6e8a430033358005569e4c_18f1e190c5d53547fed41a3eaa76e9e9
rm -f /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110/.configured_*
rm -f /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/target-aarch64_cortex-a53_musl/stamp/.apk.mbedtls_installed
/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/bin/sed -e "s|@CC@|'/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/bin/gcc',|" -e "s|@CXX@|'/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/bin/g++',|" -e "s|@PKGCONFIG@|/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/bin/pkg-config|" -e "s|@CMAKE@|/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/bin/cmake|" -e "s|@PYTHON@|/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/bin/python3|" -e "s|@CFLAGS@|'-O2', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/include', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/hostpkg/include', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/target-aarch64_cortex-a53_musl/host/include', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/include', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/hostpkg/include', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/target-aarch64_cortex-a53_musl/host/include',|" -e "s|@CXXFLAGS@|'-O2', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/include', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/hostpkg/include', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/target-aarch64_cortex-a53_musl/host/include', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/include', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/hostpkg/include', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/target-aarch64_cortex-a53_musl/host/include',|" -e "s|@LDFLAGS@|'-L/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/lib', '-L/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/hostpkg/lib', '-L/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/target-aarch64_cortex-a53_musl/host/lib',|" -e "s|@PREFIX@|/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host|" < /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/lib/meson/openwrt-native.txt.in > /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110/openwrt-native.txt
/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/bin/sed -e "s|@CC@|'aarch64-openwrt-linux-musl-gcc',|" -e "s|@CXX@|'aarch64-openwrt-linux-musl-g++',|" -e "s|@LD@|'bfd',|" -e "s|@AR@|aarch64-openwrt-linux-musl-gcc-ar|" -e "s|@STRIP@|aarch64-openwrt-linux-musl-strip|" -e "s|@NM@|aarch64-openwrt-linux-musl-gcc-nm|" -e "s|@PKGCONFIG@|/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/bin/pkg-config|" -e "s|@CMAKE@|/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/bin/cmake|" -e "s|@PYTHON@|/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/bin/python3|" -e "s|@CFLAGS@|'-Os', '-pipe', '-mcpu=cortex-a53', '-fno-caller-saves', '-fno-plt', '-fhonour-copts', '-ffile-prefix-map=/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110=apk-3.0.0_pre20251110', '-Wformat', '-Werror=format-security', '-fstack-protector', '-D_FORTIFY_SOURCE=1', '-Wl,-z,now', '-Wl,-z,relro', '-Wl,-z,pack-relative-relocs', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/usr/include', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/include', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/include/fortify',|" -e "s|@CXXFLAGS@|'-Os', '-pipe', '-mcpu=cortex-a53', '-fno-caller-saves', '-fno-plt', '-fhonour-copts', '-ffile-prefix-map=/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110=apk-3.0.0_pre20251110', '-Wformat', '-Werror=format-security', '-fstack-protector', '-D_FORTIFY_SOURCE=1', '-Wl,-z,now', '-Wl,-z,relro', '-Wl,-z,pack-relative-relocs', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/usr/include', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/include', '-I/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/include/fortify',|" -e "s|@LDFLAGS@|'-L/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/usr/lib', '-L/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/toolchain-aarch64_cortex-a53_gcc-14.3.0_musl/lib', '-fuse-ld=bfd', '-znow', '-zrelro', '-zpack-relative-relocs',|" -e "s|@ARCH@|"aarch64"|" -e "s|@CPU@|"generic"|" -e "s|@ENDIAN@|little|" < /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/lib/meson/openwrt-cross.txt.in > /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110/openwrt-cross.txt
VERSION=3.0.0_pre20251110 /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/bin/python3 /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/bin/meson.py  setup --buildtype plain --native-file /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110/openwrt-native.txt --cross-file /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110/openwrt-cross.txt -Ddefault_library=both -Db_lto=true -Dcompressed-help=false -Ddocs=disabled -Dhelp=enabled -Dlua_version=5.1 -Ddefault_library=static -Durl_backend=wget -Dzstd=false -Dpython=disabled -Dtests=disabled -Dcrypto_backend=mbedtls /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110/openwrt-build /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110/openwrt-build/..
The Meson build system
Version: 1.6.1
Source dir: /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110
Build dir: /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110/openwrt-build
Build type: cross build
Project name: apk-tools
Project version: 3.0.0_pre20251110
C compiler for the host machine: aarch64-openwrt-linux-musl-gcc (gcc 14.3.0 "aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 14.3.0 r32231-35dbdd644c) 14.3.0")
C linker for the host machine: aarch64-openwrt-linux-musl-gcc ld.bfd 2.44
C compiler for the build machine: /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/bin/gcc (gcc 14.2.0 "gcc (Debian 14.2.0-19) 14.2.0")
C linker for the build machine: /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/staging_dir/host/bin/gcc ld.bfd 2.44
Build machine cpu family: x86_64
Build machine cpu: x86_64
Host machine cpu family: aarch64
Host machine cpu: generic
Target machine cpu family: aarch64
Target machine cpu: generic
Program lua5.1 found: NO

../../../../../build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110/meson.build:19:10: ERROR: Program 'lua5.1' not found or not executable

A full log can be found at /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110/openwrt-build/meson-logs/meson-log.txt
make[2]: *** [Makefile:101: /home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/build_dir/target-aarch64_cortex-a53_musl/apk-mbedtls/apk-3.0.0_pre20251110/.configured_68b329da9893e34099c7d8ad5cb9c940] Error 1
make[2]: Leaving directory '/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/feeds/base_root/package/system/apk'
time: package/feeds/base/apk/mbedtls/compile#1.07#0.17#2.66
    ERROR: package/feeds/base/apk failed to build (build variant: mbedtls).
make[1]: *** [package/Makefile:187: package/feeds/base/apk/compile] Error 1
make[1]: Leaving directory '/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64'
make: *** [/home/daniel/Build/missing-lua/openwrt-sdk-mediatek-filogic_gcc-14.3.0_musl.Linux-x86_64/include/toplevel.mk:226: package/apk/compile] Error 2

My fedora dev box has it in hostpkg:

$ find . -name lua5.1 -type f
./staging_dir/hostpkg/bin/lua5.1

$ ll staging_dir/hostpkg/bin/lua*
Permissions Size User      Date Modified    Git Name
lrwxrwxrwx@    - efahlgren 2025-12-06 21:41  -I staging_dir/hostpkg/bin/lua -> lua5.1
.rwxr-xr-x@ 223k efahlgren 2025-12-06 21:41  -I staging_dir/hostpkg/bin/lua5.1
lrwxrwxrwx@    - efahlgren 2025-12-06 21:41  -I staging_dir/hostpkg/bin/luac -> luac5.1
.rwxr-xr-x@ 160k efahlgren 2025-12-06 21:41  -I staging_dir/hostpkg/bin/luac5.1

I never did anything explicit to create the host tools though, it's just there after a full make...

Thanks. It looks like it was missed from being included in the SDK then (for include/version.mk:REVISION:=r32228-a90fb76736).

EDIT: Issue created - https://github.com/openwrt/openwrt/issues/21082