Compile error: C SOURCE FILE Test Iconv_IS_BUILT_IN failed

Hey folks, I've started a port to the Synology RT2600AC (ipq8065) and am having difficulty getting my first image to compile.

Error I'm getting is;

Performing C SOURCE FILE Test Iconv_IS_BUILT_IN failed with the following output:
Change Dir: /home/cc/openwrt-build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/libxml2-2.10.3/CMakeFiles/CMakeTmp

Run Build Command(s):/home/cc/openwrt-build/openwrt/staging_dir/host/bin/ninja cmTC_76c5d && [1/2] Building C object CMakeFiles/cmTC_76c5d.dir/src.c.o
[2/2] Linking C executable cmTC_76c5d
FAILED: cmTC_76c5d
: && /home/cc/openwrt-build/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/bin/arm-openwrt-linux-muslgnueabi-gcc -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -mfloat-abi=hard -ffile-prefix-map=/home/cc/openwrt-build/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/libxml2-2.10.3=libxml2-2.10.3 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I/home/cc/openwrt-build/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libiconv-stub/include -I/home/kodi/openwrt-build/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libintl-stub/include -L/home/cc/openwrt-build/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/usr/lib -L/home/cc/openwrt-build/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/lib -znow -zrelro -L/home/cc/openwrt-build/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libiconv-stub/lib -Wl,-rpath-link=/home/cc/openwrt-build/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libiconv-stub/lib -L/home/cc/openwrt-build/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libintl-stub/lib -Wl,-rpath-link=/home/cc/openwrt-build/openwrt/staging_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usr/lib/libintl-stub/lib CMakeFiles/cmTC_76c5d.dir/src.c.o -o cmTC_76c5d   && :
/home/cc/openwrt-build/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/lib/gcc/arm-openwrt-linux-muslgnueabi/11.2.0/../../../../arm-openwrt-linux-muslgnueabi/bin/ld: CMakeFiles/cmTC_76c5d.dir/src.c.o: in function `main':
src.c:(.text.startup+0x10): undefined reference to `libiconv_open'
/home/cc/openwrt-build/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/lib/gcc/arm-openwrt-linux-muslgnueabi/11.2.0/../../../../arm-openwrt-linux-muslgnueabi/bin/ld: src.c:(.text.startup+0x2c): undefined reference to `libiconv'
/home/cc/openwrt-build/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-11.2.0_musl_eabi/lib/gcc/arm-openwrt-linux-muslgnueabi/11.2.0/../../../../arm-openwrt-linux-muslgnueabi/bin/ld: src.c:(.text.startup+0x34): undefined reference to `libiconv_close'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Anyone have any ideas? OS is Ubuntu 22.04.1, I've installed all the build deps from the 'Build System' wiki page.

Not really a solution, but a piece of advice

Is libxml really needed for the "first image" ?
XML is rarely needed for the basic router functionality. You should first build just the minimal package set, when porting to a new device.

The libxml2 is in the packages repo, not in the main OpenWrt source repo, meaning that is it not used by any router for the core functionality.

The error seems to be related to the iconv library, which means that something requires Unicode or so. You might look into build options and set NLS support enabled, or something like that in the build options. (Natural language support)

But a strong suggestion is that first get the device ported, and only then tinker with more complex packages.

You seem to be using GCC 11.2, which is used in OpenWrt 22.03
Note that all new devices will get added into master, so you should do your porting with master, not the old 22.03


Good point, a barebones config compiled without issue. Previous config was the default 22.03 build conf for the ipq806x

I will move my changes to master before submission, but prefer to do the bring up on a stable version to minimise any risk of the snapshot version having its own problems

Default for ipq806x in 22.03 doesn't include libxml2.

(I regularly build also 22.03 ipq806x/R7800 and my build does not contain libxml2. I built r20042-28e1770a3b for 22.03 just two hours ago :wink: )

If you really want the default, you should start with an empty .config and just select the router (and LuCI GUI).

It is so easy to test some package, then remove it, but the .config will still contain the dependencies temporarily pulled in by that package.

I always start my own build from a really short .config recipe in order to avoid accumulating crust in .config. See

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