Unstable main - apk-tools compilation failure

Hi Guys, I'm trying to provide a support for NanoPC-T6-LTS board. Basically T6 is supported (but not yet released) and T6-LTS works with that image, but additional development is needed to adjust DTS files and create a separate target profile.
But anyway, usually I'm starting from building the head of main branch, so that I can incrementally check if my changes work or not. I was trying to build them on my ArchLinux according to a guide:

https://openwrt.org/docs/guide-developer/toolchain/use-buildsystem

I used this config.buildinfo

The only customization I made:
make menuconfig
was to pick the right target, profile.

But I faced two issues:

  1. Stability of a build depends on number of compiling threads (-j1 vs -j12).
  2. apk-tools apk-mbedtls/apk-3.0.0 does not compile.

Please let me know if main the right source for snapshots. Is it typical behaviour that it can be unstable. Perhaps I miss something or this is just a bug. Let me know how to start.

That looks like buildbot config, where you build all devices of the target and all kmods and all packages (and you try to build the SDK and the imagebuilder, too). Not wise for a single device build.

Start with empty .config and just select your device from menuconfig.

2 Likes

Thanks, are building scripts going to build my target image, fetching all dependent packages in such a way? If yes then I'll try that then.

Nothing to lose at this point.

Yes, selecting the device causes all necessary dependencies to get pulled in.

git clone https://git.openwrt.org/openwrt/openwrt.git
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a

cat << EOF > .config
CONFIG_TARGET_rockchip=y
CONFIG_TARGET_rockchip_armv8=y
CONFIG_TARGET_rockchip_armv8_DEVICE_friendlyarm_nanopc-t6=y
EOF

make -j1 V=s defconfig download clean world

Thanks for a tip, I tried to locally build in the following way and I have noticed that a toolchain and few util dependencies were downloaded however still there were several packages that were compiled from source and among them apk tools which is failing.
Is there anything I can improve here?

make -j1 download clean world
WARNING: Makefile 'package/feeds/packages/gst1-plugins-base/Makefile' has a dependency on 'libmesa', which does not exist
WARNING: Makefile 'package/feeds/packages/gst1-plugins-base/Makefile' has a dependency on 'libwayland', which does not exist
WARNING: Makefile 'package/feeds/packages/gst1-plugins-base/Makefile' has a dependency on 'libgraphene', which does not exist
 make[1] tools/download
 make[2] -C tools/autoconf download
 make[2] -C tools/autoconf-archive download
 make[2] -C tools/automake download
 make[2] -C tools/bc download
 make[2] -C tools/bison download
 make[2] -C tools/cmake download
 make[2] -C tools/cpio download
 make[2] -C tools/dosfstools download
 make[2] -C tools/e2fsprogs download
 make[2] -C tools/elfutils download
 make[2] -C tools/expat download
 make[2] -C tools/fakeroot download
 make[2] -C tools/findutils download
 make[2] -C tools/firmware-utils download
 make[2] -C tools/flex download
 make[2] -C tools/gengetopt download
 make[2] -C tools/gnulib download
 make[2] -C tools/libressl download
 make[2] -C tools/libtool download
 make[2] -C tools/lzma download
 make[2] -C tools/m4 download
 make[2] -C tools/make-ext4fs download
 make[2] -C tools/meson download
 make[2] -C tools/missing-macros download
 make[2] -C tools/mkimage download
 make[2] -C tools/mklibs download
 make[2] -C tools/mtd-utils download
 make[2] -C tools/mtools download
 make[2] -C tools/ninja download
 make[2] -C tools/padjffs2 download
 make[2] -C tools/patch-image download
 make[2] -C tools/patchelf download
 make[2] -C tools/pkgconf download
 make[2] -C tools/quilt download
 make[2] -C tools/squashfs4 download
 make[2] -C tools/sstrip download
 make[2] -C tools/util-linux download
 make[2] -C tools/xz download
 make[2] -C tools/zip download
 make[2] -C tools/zlib download
 make[2] -C tools/gmp download
 make[2] -C tools/mpc download
 make[2] -C tools/mpfr download
 make[2] -C tools/libdeflate download
 make[2] -C tools/patch download
 make[2] -C tools/tar download
 make[2] -C tools/zstd download
 make[2] -C tools/flock download
 make[2] -C tools/sed download
 make[1] toolchain/download
 make[2] -C toolchain/gdb download
 make[2] -C toolchain/kernel-headers download
 make[2] -C toolchain/binutils download
 make[2] -C toolchain/gcc/initial download
 make[2] -C toolchain/gcc/final download
 make[2] -C toolchain/musl download
 make[2] -C toolchain/fortify-headers download
 make[1] package/download
 make[2] -C package/base-files download
 make[2] -C package/boot/rkbin download
 make[2] -C package/boot/uboot-envtools download
 make[2] -C package/boot/uboot-rockchip download
 make[2] -C package/firmware/linux-firmware download
 make[2] -C package/kernel/gpio-button-hotplug download
 make[2] -C package/kernel/linux download
 make[2] -C package/libs/jansson download
 make[2] -C package/libs/libjson-c download
 make[2] -C package/libs/libmnl download
 make[2] -C package/libs/libnftnl download
 make[2] -C package/libs/libnl-tiny download
 make[2] -C package/libs/libubox download
 make[2] -C package/libs/mbedtls download
 make[2] -C package/libs/toolchain download
 make[2] -C package/libs/uclient download
 make[2] -C package/libs/udebug download
 make[2] -C package/libs/ustream-ssl download
 make[2] -C package/libs/zlib download
 make[2] -C package/network/config/firewall4 download
 make[2] -C package/network/config/netifd download
 make[2] -C package/network/ipv6/odhcp6c download
 make[2] -C package/network/services/dnsmasq download
 make[2] -C package/network/services/dropbear download
 make[2] -C package/network/services/odhcpd download
 make[2] -C package/network/services/ppp download
 make[2] -C package/network/utils/nftables download
 make[2] -C package/system/apk download
 make[2] -C package/system/ca-certificates download
 make[2] -C package/system/fstools download
 make[2] -C package/system/fwtool download
 make[2] -C package/system/mtd download
 make[2] -C package/system/openwrt-keyring download
 make[2] -C package/system/procd download
 make[2] -C package/system/ubox download
 make[2] -C package/system/ubus download
 make[2] -C package/system/uci download
 make[2] -C package/system/urandom-seed download
 make[2] -C package/system/urngd download
 make[2] -C package/system/usign download
 make[2] -C package/utils/busybox download
 make[2] -C package/utils/e2fsprogs download
 make[2] -C package/utils/f2fs-tools download
 make[2] -C package/utils/f2fs-tools download
 make[2] -C package/utils/jsonfilter download
 make[2] -C package/utils/ucode download
 make[2] -C package/utils/util-linux download
 make[1] target/download
 make[2] -C target/linux download
 make[1] clean
WARNING: Makefile 'package/feeds/packages/gst1-plugins-base/Makefile' has a dependency on 'libmesa', which does not exist
WARNING: Makefile 'package/feeds/packages/gst1-plugins-base/Makefile' has a dependency on 'libwayland', which does not exist
WARNING: Makefile 'package/feeds/packages/gst1-plugins-base/Makefile' has a dependency on 'libgraphene', which does not exist
make[2]: Entering directory '/sync/workspace/openwrt3/openwrt/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/sync/workspace/openwrt3/openwrt/scripts/config'
make[4]: Entering directory '/sync/workspace/openwrt3/openwrt/target/linux'
make[5]: Entering directory '/sync/workspace/openwrt3/openwrt/target/linux/rockchip'
make[6]: Entering directory '/sync/workspace/openwrt3/openwrt/target/linux/rockchip/image'
make[6]: Leaving directory '/sync/workspace/openwrt3/openwrt/target/linux/rockchip/image'
make[5]: Leaving directory '/sync/workspace/openwrt3/openwrt/target/linux/rockchip'
make[4]: Leaving directory '/sync/workspace/openwrt3/openwrt/target/linux'
time: target/linux/prereq#0.07#0.03#0.10
 make[1] world
 make[2] target/compile
 make[3] -C target/linux compile
 make[2] buildinfo
 make[3] diffconfig buildversion feedsversion
 make[4] scripts/config/conf
 make[2] package/cleanup
 make[2] package/compile
 make[3] -C package/utils/lua host-compile
 make[3] -C package/system/apk host-compile
 make[3] -C package/libs/toolchain compile
 make[3] -C package/libs/libnl-tiny compile
 make[3] -C package/libs/libjson-c compile
 make[3] -C package/utils/lua compile
 make[3] -C package/libs/libubox compile
 make[3] -C package/system/ubus compile
 make[3] -C package/system/uci compile
 make[3] -C package/utils/ucode compile
 make[3] -C package/libs/udebug compile
 make[3] -C package/network/config/netifd compile
 make[3] -C package/firmware/linux-firmware compile
 make[3] -C package/kernel/gpio-button-hotplug compile
 make[3] -C package/kernel/linux compile
 make[3] -C package/system/ubox compile
 make[3] -C package/libs/ncurses host-compile
 make[3] -C package/libs/zlib compile
 make[3] -C package/libs/ncurses compile
 make[3] -C package/utils/util-linux compile
 make[3] -C package/system/fstools compile
 make[3] -C package/system/fwtool host-compile
 make[3] -C package/system/fwtool compile
 make[3] -C package/libs/libjson-c host-compile
 make[3] -C package/libs/libubox host-compile
 make[3] -C package/system/usign host-compile
 make[3] -C package/system/ucert host-compile
 make[3] -C package/utils/jsonfilter compile
 make[3] -C package/libs/libsepol compile
 make[3] -C package/libs/pcre2 compile
 make[3] -C package/libs/musl-fts compile
 make[3] -C package/libs/libselinux compile
 make[3] -C package/utils/busybox compile
 make[3] -C package/system/procd compile
 make[3] -C package/system/openwrt-keyring compile
 make[3] -C package/system/usign compile
 make[3] -C package/base-files compile
 make[3] -C package/boot/rkbin compile
 make[3] -C package/boot/uboot-envtools compile
 make[3] -C package/boot/uboot-rockchip compile
 make[3] -C package/libs/jansson compile
 make[3] -C package/libs/libmnl compile
 make[3] -C package/libs/libnftnl compile
 make[3] -C package/libs/mbedtls compile
 make[3] -C package/libs/ustream-ssl compile
 make[3] -C package/libs/uclient compile
 make[3] -C package/network/utils/nftables compile
 make[3] -C package/network/config/firewall4 compile
 make[3] -C package/network/ipv6/odhcp6c compile
 make[3] -C package/network/services/dnsmasq compile
 make[3] -C package/network/services/dropbear compile
 make[3] -C package/network/services/odhcpd compile
 make[3] -C package/libs/libpcap compile
 make[3] -C package/network/utils/linux-atm compile
 make[3] -C package/network/utils/resolveip compile
 make[3] -C package/network/services/ppp compile
 make[3] -C package/libs/openssl compile
 make[3] -C package/system/apk compile
    ERROR: package/system/apk failed to build (build variant: mbedtls).
make -r world: build failed. Please re-run make with -j1 V=s or V=sc for a higher verbosity level to see what's going on
make: *** [/sync/workspace/openwrt3/openwrt/include/toplevel.mk:248: world] Error 1

You need to try APK with V=s to see the full log

This seems to be a root cause:

/usr/include/stdio.h:53:9: error: unknown type name '__gnuc_va_list'
   53 | typedef __gnuc_va_list va_list;
      |         ^~~~~~~~~~~~~~
/usr/include/stdio.h:53:24: error: conflicting types for 'va_list'; have 'int'
   53 | typedef __gnuc_va_list va_list;
      |                        ^~~~~~~

Full log:

make[3]: Entering directory '/sync/workspace/openwrt/package/system/apk'
touch /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/.prepared_951970ef98e51ce9898a417ff2e5cf7c_18f1e190c5d53547fed41a3eaa76e9e9_check
. /sync/workspace/openwrt/include/shell.sh; zstdcat /sync/workspace/openwrt/dl/apk-3.0.0_pre20241113.tar.zst | tar -C /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/.. -xf -
[ ! -d ./src/ ] || cp -fpR ./src/. /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113

Applying /sync/workspace/openwrt/package/system/apk/patches/0001-openwrt-move-layer-db-to-temp-folder.patch using plaintext: 
patching file src/database.c

Applying /sync/workspace/openwrt/package/system/apk/patches/0010-app_list-add-full-print.patch using plaintext: 
patching file src/app_list.c
touch /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/.prepared_951970ef98e51ce9898a417ff2e5cf7c_18f1e190c5d53547fed41a3eaa76e9e9
rm -f /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/.configured_*
rm -f /sync/workspace/openwrt/staging_dir/target-aarch64_generic_musl/stamp/.apk.mbedtls_installed
/sync/workspace/openwrt/staging_dir/host/bin/sed -e "s|@CC@|'/sync/workspace/openwrt/staging_dir/host/bin/gcc',|" -e "s|@CXX@|'/sync/workspace/openwrt/staging_dir/host/bin/g++',|" -e "s|@PKGCONFIG@|/sync/workspace/openwrt/staging_dir/host/bin/pkg-config|" -e "s|@CMAKE@|/sync/workspace/openwrt/staging_dir/host/bin/cmake|" -e "s|@PYTHON@|/sync/workspace/openwrt/staging_dir/host/bin/python3|" -e "s|@CFLAGS@|'-O2', '-I/sync/workspace/openwrt/staging_dir/host/include', '-I/sync/workspace/openwrt/staging_dir/hostpkg/include', '-I/sync/workspace/openwrt/staging_dir/target-aarch64_generic_musl/host/include', '-I/sync/workspace/openwrt/staging_dir/host/include', '-I/sync/workspace/openwrt/staging_dir/hostpkg/include', '-I/sync/workspace/openwrt/staging_dir/target-aarch64_generic_musl/host/include',|" -e "s|@CXXFLAGS@|'-O2', '-I/sync/workspace/openwrt/staging_dir/host/include', '-I/sync/workspace/openwrt/staging_dir/hostpkg/include', '-I/sync/workspace/openwrt/staging_dir/target-aarch64_generic_musl/host/include', '-I/sync/workspace/openwrt/staging_dir/host/include', '-I/sync/workspace/openwrt/staging_dir/hostpkg/include', '-I/sync/workspace/openwrt/staging_dir/target-aarch64_generic_musl/host/include',|" -e "s|@LDFLAGS@|'-L/sync/workspace/openwrt/staging_dir/host/lib', '-L/sync/workspace/openwrt/staging_dir/hostpkg/lib', '-L/sync/workspace/openwrt/staging_dir/target-aarch64_generic_musl/host/lib',|" -e "s|@PREFIX@|/sync/workspace/openwrt/staging_dir/host|" < /sync/workspace/openwrt/staging_dir/host/lib/meson/openwrt-native.txt.in > /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/openwrt-native.txt
/sync/workspace/openwrt/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@|/sync/workspace/openwrt/staging_dir/host/bin/pkg-config|" -e "s|@CMAKE@|/sync/workspace/openwrt/staging_dir/host/bin/cmake|" -e "s|@PYTHON@|/sync/workspace/openwrt/staging_dir/host/bin/python3|" -e "s|@CFLAGS@|'-Os', '-pipe', '-mcpu=generic', '-fno-caller-saves', '-fno-plt', '-fhonour-copts', '-ffile-prefix-map=/sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113=apk-3.0.0_pre20241113', '-Wformat', '-Werror=format-security', '-fstack-protector', '-D_FORTIFY_SOURCE=1', '-Wl,-z,now', '-Wl,-z,relro', '-I/sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/usr/include', '-I/sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/include', '-I/sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/include/fortify',|" -e "s|@CXXFLAGS@|'-Os', '-pipe', '-mcpu=generic', '-fno-caller-saves', '-fno-plt', '-fhonour-copts', '-ffile-prefix-map=/sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113=apk-3.0.0_pre20241113', '-Wformat', '-Werror=format-security', '-fstack-protector', '-D_FORTIFY_SOURCE=1', '-Wl,-z,now', '-Wl,-z,relro', '-I/sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/usr/include', '-I/sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/include', '-I/sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/include/fortify',|" -e "s|@LDFLAGS@|'-L/sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/usr/lib', '-L/sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/lib', '-fuse-ld=bfd', '-znow', '-zrelro',|" -e "s|@ARCH@|"aarch64"|" -e "s|@CPU@|"generic"|" -e "s|@ENDIAN@|little|" < /sync/workspace/openwrt/staging_dir/host/lib/meson/openwrt-cross.txt.in > /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/openwrt-cross.txt
VERSION=3.0.0_pre20241113 /sync/workspace/openwrt/staging_dir/host/bin/python3 /sync/workspace/openwrt/staging_dir/host/bin/meson.py  setup --buildtype plain --native-file /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/openwrt-native.txt --cross-file /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/openwrt-cross.txt -Ddefault_library=both -Dcompressed-help=false -Ddocs=disabled -Dhelp=enabled -Dlua_version=5.1 -Durl_backend=wget -Dzstd=false -Dcrypto_backend=mbedtls /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/openwrt-build /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/openwrt-build/..
The Meson build system
Version: 1.5.1
Source dir: /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113
Build dir: /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/openwrt-build
Build type: cross build
Project name: apk-tools
Project version: 3.0.0_pre20241113
C compiler for the host machine: aarch64-openwrt-linux-musl-gcc (gcc 13.3.0 "aarch64-openwrt-linux-musl-gcc (OpenWrt GCC 13.3.0 r28180-b8b658bc0d) 13.3.0")
C linker for the host machine: aarch64-openwrt-linux-musl-gcc ld.bfd 2.42
C compiler for the build machine: /sync/workspace/openwrt/staging_dir/host/bin/gcc (gcc 14.2.1 "gcc (GCC) 14.2.1 20240910")
C linker for the build machine: /sync/workspace/openwrt/staging_dir/host/bin/gcc ld.bfd 2.43.0
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: YES (/sync/workspace/openwrt/staging_dir/hostpkg/bin/lua5.1)
Found pkg-config: YES (/sync/workspace/openwrt/staging_dir/host/bin/pkg-config) 2.2.0
Found CMake: /sync/workspace/openwrt/staging_dir/host/bin/cmake (3.30.5)
Run-time dependency lua5.1 found: NO (tried pkgconfig and cmake)
Dependency scdoc skipped: feature docs disabled
Run-time dependency zlib found: YES 1.3.1
Run-time dependency libzstd found: NO (tried pkgconfig and cmake)
Run-time dependency mbedtls found: YES 3.6.2
Run-time dependency mbedcrypto found: YES 3.6.2
Header "unistd.h" has symbol "fexecve" : YES 
Header "sys/random.h" has symbol "getrandom" : YES 
Header "string.h" has symbol "memrchr" : YES 
Header "sys/mman.h" has symbol "memfd_create" : YES 
Header "sys/stat.h" has symbol "mknodat" : YES 
Header "unistd.h" has symbol "pipe2" : YES 
Header "stdlib.h" has symbol "qsort_r" : YES 
Header "stdlib.h" has symbol "reallocarray" : YES 
Header "string.h" has symbol "strchrnul" : YES 
Header "string.h" has symbol "strlcpy" : YES 
Header "sys/socket.h" has symbol "SOCK_CLOEXEC" : YES 
Checking if "Test qsort_r non-POSIX prototype" compiles: NO 
Run-time dependency cmocka found: YES 1.1.7
Build targets in project: 5

apk-tools 3.0.0_pre20241113

  User defined options
    Cross files    : /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/openwrt-cross.txt
    Native files   : /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/openwrt-native.txt
    buildtype      : plain
    default_library: both
    compressed-help: false
    crypto_backend : mbedtls
    docs           : disabled
    help           : enabled
    lua_version    : 5.1
    url_backend    : wget
    zstd           : false

Found ninja-1.12.1 at /sync/workspace/openwrt/staging_dir/host/bin/ninja
touch /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/.configured_68b329da9893e34099c7d8ad5cb9c940                                                                                                                                                                            
rm -f /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/.built
touch /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/.built_check
MAKEFLAGS="" /sync/workspace/openwrt/staging_dir/host/bin/ninja  -j1 -C /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/openwrt-build 
ninja: Entering directory `/sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/openwrt-build'
[63/68] Compiling C object test/unit/unit_tests.p/blob_test.c.o
In file included from /usr/include/bits/endian.h:35,
                 from /usr/include/ctype.h:39,
                 from ../src/apk_blob.h:13,
                 from ../test/unit/blob_test.c:2:
/usr/include/bits/endianness.h:9: warning: "__BYTE_ORDER" redefined
    9 | #define __BYTE_ORDER __LITTLE_ENDIAN
      | 
In file included from /sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/include/stddef.h:19,
                 from ../test/unit/apk_test.h:2,
                 from ../test/unit/blob_test.c:1:
/sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/include/bits/alltypes.h:8: note: this is the location of the previous definition
    8 | #define __BYTE_ORDER 1234
      | 
In file included from ../src/apk_defines.h:15,
                 from ../src/apk_blob.h:16:
/usr/include/stdint.h:98: warning: "__INT64_C" redefined
   98 | #  define __INT64_C(c)  c ## LL
      | 
<built-in>: note: this is the location of the previous definition
/usr/include/stdint.h:99: warning: "__UINT64_C" redefined
   99 | #  define __UINT64_C(c) c ## ULL
      | 
<built-in>: note: this is the location of the previous definition
[64/68] Compiling C object test/unit/unit_tests.p/version_test.c.o
FAILED: test/unit/unit_tests.p/version_test.c.o 
aarch64-openwrt-linux-musl-gcc -Itest/unit/unit_tests.p -Itest/unit -I../test/unit -Isrc -I../src -Iportability -I../portability -I/usr/include -I/sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/usr/include -I/sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/include -I/sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/include/fortify -fdiagnostics-color=always -Wall -Winvalid-pch -std=gnu11 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -ffile-prefix-map=/sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113=apk-3.0.0_pre20241113 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -D_ATFILE_SOURCE '-DAPK_VERSION="3.0.0_pre20241113"' -DCRYPTO_USE_MBEDTLS '-DRELATIVE_LIBEXECDIR="usr/libexec"' -MD -MQ test/unit/unit_tests.p/version_test.c.o -MF test/unit/unit_tests.p/version_test.c.o.d -o test/unit/unit_tests.p/version_test.c.o -c ../test/unit/version_test.c
In file included from /usr/include/bits/endian.h:35,
                 from /usr/include/endian.h:24,
                 from ../portability/endian.h:12,
                 from /usr/include/sys/types.h:176,
                 from ../src/apk_io.h:12,
                 from ../test/unit/version_test.c:2:
/usr/include/bits/endianness.h:9: warning: "__BYTE_ORDER" redefined
    9 | #define __BYTE_ORDER __LITTLE_ENDIAN
      | 
In file included from /sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/include/stddef.h:19,
                 from ../test/unit/apk_test.h:2,
                 from ../test/unit/version_test.c:1:
/sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/include/bits/alltypes.h:8: note: this is the location of the previous definition
    8 | #define __BYTE_ORDER 1234
      | 
In file included from ../src/apk_defines.h:15,
                 from ../src/apk_io.h:16:
/usr/include/stdint.h:98: warning: "__INT64_C" redefined
   98 | #  define __INT64_C(c)  c ## LL
      | 
<built-in>: note: this is the location of the previous definition
/usr/include/stdint.h:99: warning: "__UINT64_C" redefined
   99 | #  define __UINT64_C(c) c ## ULL
      | 
<built-in>: note: this is the location of the previous definition
In file included from /sync/workspace/openwrt/staging_dir/target-aarch64_generic_musl/usr/include/mbedtls/bignum.h:20,
                 from /sync/workspace/openwrt/staging_dir/target-aarch64_generic_musl/usr/include/mbedtls/rsa.h:22,
                 from /sync/workspace/openwrt/staging_dir/target-aarch64_generic_musl/usr/include/mbedtls/pk.h:20,
                 from ../src/apk_crypto_mbedtls.h:13,
                 from ../src/apk_crypto.h:19,
                 from ../src/apk_io.h:19:
/usr/include/stdio.h:53:9: error: unknown type name '__gnuc_va_list'
   53 | typedef __gnuc_va_list va_list;
      |         ^~~~~~~~~~~~~~
/usr/include/stdio.h:53:24: error: conflicting types for 'va_list'; have 'int'
   53 | typedef __gnuc_va_list va_list;
      |                        ^~~~~~~
In file included from /sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/include/stdarg.h:10,
                 from ../test/unit/apk_test.h:1:
/sync/workspace/openwrt/staging_dir/toolchain-aarch64_generic_gcc-13.3.0_musl/include/bits/alltypes.h:334:27: note: previous declaration of 'va_list' with type 'va_list'
  334 | typedef __builtin_va_list va_list;
      |                           ^~~~~~~
/usr/include/stdio.h:373:22: error: unknown type name '__gnuc_va_list'
  373 |                      __gnuc_va_list __arg) __nonnull ((1));
      |                      ^~~~~~~~~~~~~~
/usr/include/stdio.h:378:54: error: unknown type name '__gnuc_va_list'
  378 | extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
      |                                                      ^~~~~~~~~~~~~~
/usr/include/stdio.h:381:22: error: unknown type name '__gnuc_va_list'
  381 |                      __gnuc_va_list __arg) __THROWNL;
      |                      ^~~~~~~~~~~~~~
/usr/include/stdio.h:390:56: error: unknown type name '__gnuc_va_list'
  390 |                       const char *__restrict __format, __gnuc_va_list __arg)
      |                                                        ^~~~~~~~~~~~~~
/usr/include/stdio.h:398:23: error: unknown type name '__gnuc_va_list'
  398 |                       __gnuc_va_list __arg)
      |                       ^~~~~~~~~~~~~~
/usr/include/stdio.h:411:22: error: unknown type name '__gnuc_va_list'
  411 |                      __gnuc_va_list __arg)
      |                      ^~~~~~~~~~~~~~
/usr/include/stdio.h:491:21: error: unknown type name '__gnuc_va_list'
  491 |                     __gnuc_va_list __arg)
      |                     ^~~~~~~~~~~~~~
/usr/include/stdio.h:498:53: error: unknown type name '__gnuc_va_list'
  498 | extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
      |                                                     ^~~~~~~~~~~~~~
/usr/include/stdio.h:503:54: error: unknown type name '__gnuc_va_list'
  503 |                     const char *__restrict __format, __gnuc_va_list __arg)
      |                                                      ^~~~~~~~~~~~~~
In file included from /usr/include/features.h:511,
                 from /usr/include/setjmp.h:25,
                 from ../test/unit/apk_test.h:3:
/usr/include/stdio.h:511:12: error: unknown type name '__gnuc_va_list'
  511 | extern int __REDIRECT (vfscanf,
      |            ^~~~~~~~~~
/usr/include/stdio.h:516:12: error: unknown type name '__gnuc_va_list'
  516 | extern int __REDIRECT (vscanf, (const char *__restrict __format,
      |            ^~~~~~~~~~
/usr/include/stdio.h:519:12: error: unknown type name '__gnuc_va_list'
  519 | extern int __REDIRECT_NTH (vsscanf,
      |            ^~~~~~~~~~~~~~
/usr/include/stdio.h:922:29: error: unknown type name '__gnuc_va_list'
  922 |                             __gnuc_va_list __args)
      |                             ^~~~~~~~~~~~~~
In file included from /usr/include/stdio.h:954:
/usr/include/bits/stdio2-decl.h:31:28: error: unknown type name '__gnuc_va_list'
   31 |                            __gnuc_va_list __ap) __THROW
      |                            ^~~~~~~~~~~~~~
/usr/include/bits/stdio2-decl.h:42:29: error: unknown type name '__gnuc_va_list'
   42 |                             __gnuc_va_list __ap) __THROW
      |                             ^~~~~~~~~~~~~~
/usr/include/bits/stdio2.h:55:1: error: unknown type name '__gnuc_va_list'
   55 | __NTH (vsprintf (__fortify_clang_overload_arg (char *, __restrict, __s),
      | ^~~~~
/usr/include/bits/stdio2.h:93:1: error: unknown type name '__gnuc_va_list'
   93 | __NTH (vsnprintf (__fortify_clang_overload_arg (char *, __restrict, __s),
      | ^~~~~
ninja: build stopped: subcommand failed.
make[3]: *** [Makefile:97: /sync/workspace/openwrt/build_dir/target-aarch64_generic_musl/apk-mbedtls/apk-3.0.0_pre20241113/.built] Error 1
make[3]: Leaving directory '/sync/workspace/openwrt/package/system/apk'
time: package/system/apk/mbedtls/compile#4.77#0.87#5.46
    ERROR: package/system/apk failed to build (build variant: mbedtls).
make[2]: *** [package/Makefile:185: package/system/apk/compile] Error 1
make[2]: Leaving directory '/sync/workspace/openwrt'
make[1]: *** [package/Makefile:179: /sync/workspace/openwrt/staging_dir/target-aarch64_generic_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/sync/workspace/openwrt'
make: *** [/sync/workspace/openwrt/include/toplevel.mk:248: world] Error 2

It seems like a defect. Shall I report that?

I may also try to build an image in an isolated environment.

How can I fix or workaround this?

I created a defect:

It was a cross-compiling issue, fixed by disabling some tests.
Main branch is stable now. Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.