How to fix gettext-full undefined reference to `u8_uctomb_aux'

How to fix gettext-full undefined reference to u8_uctomb_aux

libtool: link: x86_64-openwrt-linux-musl-gcc -DINSTALLDIR="/usr/bin" -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -fmacro-prefix-map=/home/openwrt/master/openwrt/build_dir/target-x86_64_musl/gettext-0.21.1=gettext-0.21.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z -Wl,now -Wl,-z -Wl,relro -DPIC -fpic -znow -zrelro -o .libs/gettext gettext-gettext.o -L/home/openwrt/master/openwrt/staging_dir/toolchain-x86_64_gcc-13.1.0_musl/usr/lib -L/home/openwrt/master/openwrt/staging_dir/toolchain-x86_64_gcc-13.1.0_musl/lib ../gnulib-lib/libgrt.a ../intl/.libs/libintl.so
/home/openwrt/master/openwrt/staging_dir/toolchain-x86_64_gcc-13.1.0_musl/lib/gcc/x86_64-openwrt-linux-musl/13.1.0/../../../../x86_64-openwrt-linux-musl/bin/ld: ../gnulib-lib/libgrt.a(libgrt_a-iconv.o): in function rpl_iconv': iconv.c:(.text+0x34b): undefined reference to u8_mbtoucr'
/home/openwrt/master/openwrt/staging_dir/toolchain-x86_64_gcc-13.1.0_musl/lib/gcc/x86_64-openwrt-linux-musl/13.1.0/../../../../x86_64-openwrt-linux-musl/bin/ld: iconv.c:(.text+0x4ba): undefined reference to `u8_uctomb_aux'
collect2: error: ld returned 1 exit status
make[8]: *** [Makefile:1645: gettext] Error 1
make[8]: Leaving directory '/home/openwrt/master/openwrt/build_dir/target-x86_64_musl/gettext-0.21.1/gettext-runtime/src'
make[7]: *** [Makefile:1643: all-recursive] Error 1
make[7]: Leaving directory '/home/openwrt/master/openwrt/build_dir/target-x86_64_musl/gettext-0.21.1/gettext-runtime'
make[6]: *** [Makefile:1548: all] Error 2
make[6]: Leaving directory '/home/openwrt/master/openwrt/build_dir/target-x86_64_musl/gettext-0.21.1/gettext-runtime'
make[5]: *** [Makefile:406: all-recursive] Error 1
make[5]: Leaving directory '/home/openwrt/master/openwrt/build_dir/target-x86_64_musl/gettext-0.21.1'
make[4]: *** [Makefile:362: all] Error 2
make[4]: Leaving directory '/home/openwrt/master/openwrt/build_dir/target-x86_64_musl/gettext-0.21.1'
make[3]: *** [Makefile:189: /home/openwrt/master/openwrt/build_dir/target-x86_64_musl/gettext-0.21.1/.built] Error 2
make[3]: Leaving directory '/home/openwrt/master/openwrt/package/libs/gettext-full'
time: package/libs/gettext-full/compile#381.42#118.66#437.73
ERROR: package/libs/gettext-full failed to build.
make[2]: *** [package/Makefile:116: package/libs/gettext-full/compile] Error 1
make[2]: *** Waiting for unfinished jobs....
data written to "hd.ids"
log written to "hd.log"

Hi @xiaobo,

  • What is the host you're trying to compile running on (Ubuntu, Fedora, Debian)?
  • What are the commands you're executing to compile? Can you post what exactly you're doing?
  • What branch (release, snapshot, master)?

1, ubuntu 22.04
2 time make V=s VERBOSE=1 -j$(nproc) JOBS=$(nproc) 2>&1 | tee build.log | grep -i -E "^make.*(error|[1-9]...Entering dir)"
3, master
4, target x86_64

I'm experiencing this on an aarch64 platform right now.

Trying to compile a complete build of master for aarch64/bpi-r3

  • make -j 4 world failed
  • make V=sc package/gettext-full/clean, compile also then failed
make[7]: Entering directory '/mnt/nbd/devel/openwrt/build_dir/target-aarch64_cortex-a53_musl/gettext-0.21.1/gettext-runtime/src'
aarch64-openwrt-linux-musl-gcc -DLOCALEDIR=\"/usr/share/locale\" -DHAVE_CONFIG_H -I. -I..  -I. -I. -I.. -I../intl -I./../intl -I../gnulib-lib -I./../gnulib-lib -I/mnt/nbd/devel/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-12.2.0_musl/usr/include -I/mnt/nbd/devel/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-12.2.0_musl/include/fortify -I/mnt/nbd/devel/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-12.2.0_musl/include  -DINSTALLDIR=\"/usr/bin\" -Os -pipe -mcpu=cortex-a53 -fno-caller-saves -fno-plt -fhonour-copts -ffile-prefix-map=/mnt/nbd/devel/openwrt/build_dir/target-aarch64_cortex-a53_musl/gettext-0.21.1=gettext-0.21.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DPIC -fPIC  -c -o gettext-gettext.o `test -f 'gettext.c' || echo './'`gettext.c
/bin/sh ../libtool  --tag=CC   --mode=link aarch64-openwrt-linux-musl-gcc -DINSTALLDIR=\"/usr/bin\" -Os -pipe -mcpu=cortex-a53 -fno-caller-saves -fno-plt -fhonour-copts -ffile-prefix-map=/mnt/nbd/devel/openwrt/build_dir/target-aarch64_cortex-a53_musl/gettext-0.21.1=gettext-0.21.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -DPIC -fPIC   -L/mnt/nbd/devel/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-12.2.0_musl/usr/lib -L/mnt/nbd/devel/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-12.2.0_musl/lib -znow -zrelro  -o gettext gettext-gettext.o ../gnulib-lib/libgrt.a ../intl/libintl.la     
libtool: link: aarch64-openwrt-linux-musl-gcc "-DINSTALLDIR=\"/usr/bin\"" -Os -pipe -mcpu=cortex-a53 -fno-caller-saves -fno-plt -fhonour-copts -ffile-prefix-map=/mnt/nbd/devel/openwrt/build_dir/target-aarch64_cortex-a53_musl/gettext-0.21.1=gettext-0.21.1 -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z -Wl,now -Wl,-z -Wl,relro -DPIC -fPIC -znow -zrelro -o .libs/gettext gettext-gettext.o  -L/mnt/nbd/devel/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-12.2.0_musl/usr/lib -L/mnt/nbd/devel/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-12.2.0_musl/lib ../gnulib-lib/libgrt.a ../intl/.libs/libintl.so
/mnt/nbd/devel/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-12.2.0_musl/lib/gcc/aarch64-openwrt-linux-musl/12.2.0/../../../../aarch64-openwrt-linux-musl/bin/ld: ../gnulib-lib/libgrt.a(libgrt_a-iconv.o): in function `rpl_iconv':
iconv.c:(.text+0x3a4): undefined reference to `u8_mbtoucr'
/mnt/nbd/devel/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-12.2.0_musl/lib/gcc/aarch64-openwrt-linux-musl/12.2.0/../../../../aarch64-openwrt-linux-musl/bin/ld: iconv.c:(.text+0x3a8): undefined reference to `u8_mbtoucr'
/mnt/nbd/devel/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-12.2.0_musl/lib/gcc/aarch64-openwrt-linux-musl/12.2.0/../../../../aarch64-openwrt-linux-musl/bin/ld: iconv.c:(.text+0x3e4): undefined reference to `u8_uctomb_aux'
/mnt/nbd/devel/openwrt/staging_dir/toolchain-aarch64_cortex-a53_gcc-12.2.0_musl/lib/gcc/aarch64-openwrt-linux-musl/12.2.0/../../../../aarch64-openwrt-linux-musl/bin/ld: iconv.c:(.text+0x3e8): undefined reference to `u8_uctomb_aux'
collect2: error: ld returned 1 exit status

Testing it on a up-to-date Linux Mint which is based on Ubuntu 22.04 it works for me. But I compile it with one additional step which reduces errors due to parallel compile for me:

  • time make -j$(nproc) toolchain/install
  • time make -j$(nproc) world

unfortunately it fails in buildbot too
https://downloads.openwrt.org/snapshots/faillogs/i386_pentium4/base/gettext-full/compile.txt

looks like it still tries to pick some external packages

They are from May 6 ... well I'm not much of a help here. Being on latest master (commit 218ce40cd738f3373438aab82467807a8707fb9c) with above commands it compiles fine for me for x86-64 and bpi-r3.

add:
DEPENDS:=+libunistring

and
TARGET_LDFLAGS += -lunistring

just a work-around, missing feature should be patched in instead of making a depency that previously was unnecessary.. or replaced by something else.