Snapshot build error: sqlite3 failed to build

When trying to build snapshot (target Rockchip/NanoPi R6S) with luci-app-vnstat2, sqlite3 is failing to build:

 make[3] -C feeds/packages/libs/sqlite3 compile
    ERROR: package/feeds/packages/sqlite3 failed to build.

When building with make -j1 V=s, the error is:

(...)
Build C compiler...cc
Checking for stdlib.h...not found
Error: Compiler does not work. See config.log
Try: 'configure --help' for options
make[3]: *** [Makefile:148: /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100/.configured_74ac956b2dc293c2d19aaada12bfc607] Error 1
make[3]: Leaving directory '/home/openwrt/openwrt/r6s-router-snapshot-20250611/feeds/packages/libs/sqlite3'
time: package/feeds/packages/sqlite3/compile#0.24#0.15#0.43
    ERROR: package/feeds/packages/sqlite3 failed to build.
Detailed build log
# Some package (base-files) manually append stuff to conffiles
# Append stuff from it and delete the CONTROL directory since everything else should be migrated
if [ -f /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/luci-lib-jsonc/ipkg-aarch64_generic/luci-lib-jsonc/CONTROL/conffiles ]; then echo $(IDIR_luci-lib-jsonc)/CONTROL/conffiles >> /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/luci-lib-jsonc/ipkg-aarch64_generic/luci-lib-jsonc/lib/apk/packages/luci-lib-jsonc.conffiles; for file in $(cat /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/luci-lib-jsonc/ipkg-aarch64_generic/luci-lib-jsonc/CONTROL/conffiles); do [ -f /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/luci-lib-jsonc/ipkg-aarch64_generic/luci-lib-jsonc/$file ] || continue; csum=$(/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/bin/mkhash sha256 /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/luci-lib-jsonc/ipkg-aarch64_generic/luci-lib-jsonc/$file); echo $file $csum >> /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/luci-lib-jsonc/ipkg-aarch64_generic/luci-lib-jsonc/lib/apk/packages/luci-lib-jsonc.conffiles_static; done; rm -rf /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/luci-lib-jsonc/ipkg-aarch64_generic/luci-lib-jsonc/CONTROL/conffiles; fi
if [ -z "$(ls -A /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/luci-lib-jsonc/ipkg-aarch64_generic/luci-lib-jsonc/CONTROL 2>/dev/null)" ]; then rm -rf /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/luci-lib-jsonc/ipkg-aarch64_generic/luci-lib-jsonc/CONTROL; else echo "CONTROL directory /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/luci-lib-jsonc/ipkg-aarch64_generic/luci-lib-jsonc/CONTROL is not empty! This is not right and should be checked!" >&2; exit 1; fi
/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/bin/fakeroot /home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/bin/apk mkpkg --info "name:luci-lib-jsonc" --info "version:25.162.54480~7e4d41e" --info "description:Lua binding for JSON-C" --info "arch:aarch64_generic" --info "license:Apache-2.0" --info "origin:feeds/luci/libs/luci-lib-jsonc" --info "url:https://github.com/openwrt/luci" --info "maintainer:OpenWrt LuCI community" --info "provides:"  --script "post-install:/home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/luci-lib-jsonc/apk-aarch64_generic/luci-lib-jsonc/post-install" --script "pre-deinstall:/home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/luci-lib-jsonc/apk-aarch64_generic/luci-lib-jsonc/pre-deinstall" --info "depends:libc liblua5.1.5 libjson-c5" --files "/home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/luci-lib-jsonc/ipkg-aarch64_generic/luci-lib-jsonc" --output "/home/openwrt/openwrt/r6s-router-snapshot-20250611/bin/packages/aarch64_generic/luci/luci-lib-jsonc-25.162.54480~7e4d41e.apk" --sign "/home/openwrt/openwrt/r6s-router-snapshot-20250611/private-key.pem"
echo "luci-lib-jsonc" >> /home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/target-aarch64_generic_musl/pkginfo/luci-lib-jsonc.default.install
make[3]: Leaving directory '/home/openwrt/openwrt/r6s-router-snapshot-20250611/feeds/luci/libs/luci-lib-jsonc'
time: package/feeds/luci/luci-lib-jsonc/compile#0.50#0.12#0.79
make[3]: Entering directory '/home/openwrt/openwrt/r6s-router-snapshot-20250611/feeds/packages/libs/sqlite3'
touch /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100/.prepared_084606e0570147292fbbb0ad5ff0fe2f_6664517399ebbbc92a37c5bb081b5c53_check
. /home/openwrt/openwrt/r6s-router-snapshot-20250611/include/shell.sh; /home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/bin/libdeflate-gzip -dc /home/openwrt/openwrt/r6s-router-snapshot-20250611/dl/sqlite-autoconf-3490100.tar.gz | tar -C /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100/.. -xf -
[ ! -d ./src/ ] || cp -fpR ./src/. /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100
touch /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100/.prepared_084606e0570147292fbbb0ad5ff0fe2f_6664517399ebbbc92a37c5bb081b5c53
rm -f /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100/.configured_*
rm -f /home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/target-aarch64_generic_musl/stamp/.sqlite3_installed
(cd /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100; rm -f aclocal.m4; if [ -f ./configure.ac ] || [ -f ./configure.in ]; then [ -d ./autom4te.cache ] && rm -rf ./autom4te.cache; [ -e ./config.rpath ] || ln -s /home/openwrt/openwrt/r6s-router-snapshot-20250611/scripts/config.rpath ./config.rpath; touch NEWS AUTHORS COPYING ABOUT-NLS ChangeLog; AUTOM4TE=/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/bin/autom4te AUTOCONF=/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/bin/autoconf AUTOMAKE=/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/bin/automake ACLOCAL=/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/bin/aclocal AUTOHEADER=/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/bin/autoheader LIBTOOLIZE=/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/bin/libtoolize LIBTOOL=/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/bin/libtool M4=/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/bin/m4 AUTOPOINT=true GTKDOCIZE=true LIBTOOLIZE='/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/bin/libtoolize --install' /home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/bin/autoreconf -v -f -i -B /home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/host/share/aclocal -I /home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/target-aarch64_generic_musl/host/share/aclocal -I /home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/hostpkg/share/aclocal -I /home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/target-aarch64_generic_musl/usr/share/aclocal -I m4 -I . . || true; fi; );
(cd /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100/./; if [ -x ./configure ]; then find /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100/ -name config.guess | xargs -r chmod u+w; find /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100/ -name config.guess | xargs -r -n1 cp --remove-destination /home/openwrt/openwrt/r6s-router-snapshot-20250611/scripts/config.guess; find /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100/ -name config.sub | xargs -r chmod u+w; find /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100/ -name config.sub | xargs -r -n1 cp --remove-destination /home/openwrt/openwrt/r6s-router-snapshot-20250611/scripts/config.sub; AR="aarch64-openwrt-linux-musl-gcc-ar" AS="aarch64-openwrt-linux-musl-gcc -c -Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100=sqlite-autoconf-3490100 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DHAVE_ISNAN -DHAVE_MALLOC_USABLE_SIZE -DSQLITE_ENABLE_UNLOCK_NOTIFY  -DSQLITE_ENABLE_COLUMN_METADATA" LD="aarch64-openwrt-linux-musl-ld.bfd" NM="aarch64-openwrt-linux-musl-gcc-nm" CC="aarch64-openwrt-linux-musl-gcc" GCC="aarch64-openwrt-linux-musl-gcc" CXX="aarch64-openwrt-linux-musl-g++" RANLIB="aarch64-openwrt-linux-musl-gcc-ranlib" STRIP=aarch64-openwrt-linux-musl-strip OBJCOPY=aarch64-openwrt-linux-musl-objcopy OBJDUMP=aarch64-openwrt-linux-musl-objdump SIZE=aarch64-openwrt-linux-musl-size CFLAGS="-Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100=sqlite-autoconf-3490100 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DHAVE_ISNAN -DHAVE_MALLOC_USABLE_SIZE -DSQLITE_ENABLE_UNLOCK_NOTIFY  -DSQLITE_ENABLE_COLUMN_METADATA " CXXFLAGS="-Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100=sqlite-autoconf-3490100 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DHAVE_ISNAN -DHAVE_MALLOC_USABLE_SIZE -DSQLITE_ENABLE_UNLOCK_NOTIFY  -DSQLITE_ENABLE_COLUMN_METADATA " CPPFLAGS="-I/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/toolchain-aarch64_generic_gcc-14.3.0_musl/usr/include -I/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/toolchain-aarch64_generic_gcc-14.3.0_musl/include -I/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/toolchain-aarch64_generic_gcc-14.3.0_musl/include/fortify " LDFLAGS="-L/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/toolchain-aarch64_generic_gcc-14.3.0_musl/usr/lib -L/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/toolchain-aarch64_generic_gcc-14.3.0_musl/lib -fuse-ld=bfd -znow -zrelro "   ./configure --host=aarch64-openwrt-linux --build=x86_64-pc-linux-gnu --disable-dependency-tracking --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-debug --disable-static-shell --enable-shared --enable-static --enable-threadsafe --soname=legacy --enable-load-extension --enable-fts3 --enable-fts4 --enable-fts5 --enable-rtree --disable-session --disable-editline --disable-readline ; fi; )
Host System...aarch64-openwrt-linux-gnu
Build System...x86_64-pc-linux-gnu
C compiler...ccache aarch64-openwrt-linux-musl-gcc -Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100=sqlite-autoconf-3490100 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DHAVE_ISNAN -DHAVE_MALLOC_USABLE_SIZE -DSQLITE_ENABLE_UNLOCK_NOTIFY  -DSQLITE_ENABLE_COLUMN_METADATA  -I/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/toolchain-aarch64_generic_gcc-14.3.0_musl/usr/include -I/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/toolchain-aarch64_generic_gcc-14.3.0_musl/include -I/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/toolchain-aarch64_generic_gcc-14.3.0_musl/include/fortify
C++ compiler...ccache aarch64-openwrt-linux-musl-g++ -Os -pipe -mcpu=generic -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100=sqlite-autoconf-3490100 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DHAVE_ISNAN -DHAVE_MALLOC_USABLE_SIZE -DSQLITE_ENABLE_UNLOCK_NOTIFY  -DSQLITE_ENABLE_COLUMN_METADATA  -I/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/toolchain-aarch64_generic_gcc-14.3.0_musl/usr/include -I/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/toolchain-aarch64_generic_gcc-14.3.0_musl/include -I/home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/toolchain-aarch64_generic_gcc-14.3.0_musl/include/fortify
Build C compiler...cc
Checking for stdlib.h...not found
Error: Compiler does not work. See config.log
Try: 'configure --help' for options
make[3]: *** [Makefile:148: /home/openwrt/openwrt/r6s-router-snapshot-20250611/build_dir/target-aarch64_generic_musl/sqlite-autoconf-3490100/.configured_74ac956b2dc293c2d19aaada12bfc607] Error 1
make[3]: Leaving directory '/home/openwrt/openwrt/r6s-router-snapshot-20250611/feeds/packages/libs/sqlite3'
time: package/feeds/packages/sqlite3/compile#0.24#0.15#0.43
    ERROR: package/feeds/packages/sqlite3 failed to build.
make[2]: *** [package/Makefile:183: package/feeds/packages/sqlite3/compile] Error 1
make[2]: Leaving directory '/home/openwrt/openwrt/r6s-router-snapshot-20250611'
make[1]: *** [package/Makefile:177: /home/openwrt/openwrt/r6s-router-snapshot-20250611/staging_dir/target-aarch64_generic_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/openwrt/openwrt/r6s-router-snapshot-20250611'
make: *** [/home/openwrt/openwrt/r6s-router-snapshot-20250611/include/toplevel.mk:233: world] Error 2

The error Checking for stdlib.h...not found seems strange, since the build is sucessfull when luci-app-vnstat2 is not selected.

Has anyone seen this issue? Does sqlite3 need to be updated?

Does it build after resetting/without ccache?

1 Like

Thanks. Sorry for my lack of knwoledge. Which option should I use to disable and/or reset ccachein the OpenWrt build?

To disable, Select [*] Advanced configuration options (for developers) ---> and set CCACHE=N

Symbol: CCACHE [=y]
Type  : bool
Defined at config/Config-devel.in:135
  Prompt: Use ccache
  Visible if: DEVEL [=y]
  Location:
    -> Advanced configuration options (for developers) (DEVEL [=y])
(1)   -> Use ccache (CCACHE [=y])

To clear ccache dir, rm -r ./.ccache

You probably need a make targetclean as well. YMMV

1 Like

Thank you! I am happy I learned a new thing today! :grin: I will try and share the results.

Well, in the end it was an issue in my build system. Probably something I installed that was causing this issue.

I just did the build in a new clean build system and it worked perfectly fine (without needing to enable the Advanced configuration settings).

Sorry for the false alarm, and than you @RuralRoots for your help!

i am facing this failure too:
build orangepi zero3 on branch v24.10. Since yesterday the build goes fail. stdlib.h not resolved and clean makes no effect. Before some days ago the build worked.

I am building on Ubuntu on WSL2 (mainly Rockchip and Mediatek targets for the devices I own).

I reinstalled the WSL2 Ubuntu 24.04 from scratch, and installed the OpenWrt build system prerequisites as documented in OpenWrt wiki here. I also had to install python3-pyelftools which is not included in the above OpenWrt build requirements Wiki, but it is a Rockchip's u-boot build requirement

Then I did a new build and the sqlite3 build issue did not happen anymore. I believe there might be some package (*) that I had installed in the build system (other than the ones recommended by OpenWrt) that was interfering/breaking sqlite3 build.


(*) Due to OpenWrt issues with NanoPi R4S, I was forced, against my will, to use FriendlyWrt on the R4S. And I had installed FriendlyWrt build environment on the same as OpenWrt, and I suspect this was what caused the sqlite3 build issue reported here in this topic. Now I have two separated WSL2 instances to build OpenWrt and FriendlyWrt.

Hi dsouza,

thanks!

i checked my build, it seems the gcc is changed from 12 to 13 and the qlite3 package is new dowloaded. If i fall back i get other compile error, there are must be other changes in the build, but not easy to figure out:-(

fallback to kernel 6.6.83 works

1 Like

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