Recent builds failing on gettext-full

My recent builds of snapshot have been failing on the gettext-full host package. It fails on attempting to link xgettext, where it complains it cannot find symbols from zlib:

make[8]: Entering directory '/mnt/extnbd/devel/openwrt/build_dir/hostpkg/gettext-0.21.1/gettext-tools/src'
/usr/bin/env bash ../libtool  --tag=CC   --mode=link gcc  -O2 -I/mnt/extnbd/devel/openwrt/staging_dir/host/include -I/mnt/extnbd/devel/openwrt/staging_dir/hostpkg/include -I/mnt/extnbd/devel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/host/include -DPIC -fPIC  -L/mnt/extnbd/devel/openwrt/staging_dir/host/lib -L/mnt/extnbd/devel/openwrt/staging_dir/hostpkg/lib -L/mnt/extnbd/devel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/host/lib -o msgconv msgconv-msgconv.o libgettextsrc.la   
OpenWrt-libtool: link: gcc -O2 -I/mnt/extnbd/devel/openwrt/staging_dir/host/include -I/mnt/extnbd/devel/openwrt/staging_dir/hostpkg/include -I/mnt/extnbd/devel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/host/include -DPIC -fPIC -o msgconv msgconv-msgconv.o  -L/mnt/extnbd/devel/openwrt/staging_dir/host/lib -L/mnt/extnbd/devel/openwrt/staging_dir/hostpkg/lib -L/mnt/extnbd/devel/openwrt/staging_dir/target-aarch64_cortex-a53_musl/host/lib ./.libs/libgettextsrc.a /mnt/extnbd/devel/openwrt/build_dir/hostpkg/gettext-0.21.1/gettext-tools/gnulib-lib/.libs/libgettextlib.a -lxml2 /mnt/extnbd/devel/openwrt/build_dir/hostpkg/gettext-0.21.1/libtextstyle/lib/.libs/libtextstyle.a -lm -lncurses -lc
/usr/bin/ld: /mnt/extnbd/devel/openwrt/staging_dir/hostpkg/lib/libxml2.a(xmlIO.c.o): in function `xmlGzfileOpenW':
xmlIO.c:(.text+0x1be): undefined reference to `gzdopen'
/usr/bin/ld: xmlIO.c:(.text+0x203): undefined reference to `gzopen64'
/usr/bin/ld: /mnt/extnbd/devel/openwrt/staging_dir/hostpkg/lib/libxml2.a(xmlIO.c.o): in function `xmlGzfileClose':
xmlIO.c:(.text+0x759): undefined reference to `gzclose'
/usr/bin/ld: /mnt/extnbd/devel/openwrt/staging_dir/hostpkg/lib/libxml2.a(xmlIO.c.o): in function `xmlGzfileRead':
xmlIO.c:(.text+0x789): undefined reference to `gzread'
/usr/bin/ld: /mnt/extnbd/devel/openwrt/staging_dir/hostpkg/lib/libxml2.a(xmlIO.c.o): in function `xmlGzfileWrite':
xmlIO.c:(.text+0x8f9): undefined reference to `gzwrite'
/usr/bin/ld: /mnt/extnbd/devel/openwrt/staging_dir/hostpkg/lib/libxml2.a(xmlIO.c.o): in function `xmlGzfileOpen_real':
xmlIO.c:(.text+0xf17): undefined reference to `gzdopen'
/usr/bin/ld: /mnt/extnbd/devel/openwrt/staging_dir/hostpkg/lib/libxml2.a(xmlIO.c.o): in function `__xmlParserInputBufferCreateFilename':
xmlIO.c:(.text+0x13af): undefined reference to `gzdirect'
/usr/bin/ld: /mnt/extnbd/devel/openwrt/staging_dir/hostpkg/lib/libxml2.a(xmlIO.c.o): in function `__xmlOutputBufferCreateFilename':
xmlIO.c:(.text+0x18a6): undefined reference to `gzclose'
/usr/bin/ld: /mnt/extnbd/devel/openwrt/staging_dir/hostpkg/lib/libxml2.a(xmlIO.c.o): in function `xmlGzfileOpen_real':
xmlIO.c:(.text+0xf7a): undefined reference to `gzopen64'
collect2: error: ld returned 1 exit status

The issue, of course, is that it's not even trying to link libz.

Is anyone else having this issue? I can only get past it by going to some heroics - wait for a failure, manually complete the linking of xgettext, set it immutable, then make -i package/gettext-full/compile to ignore the compile error.

If someone else is able to successfully build gettext-full, I would appreciate a V=sc log of its compilation.

What target are you compiling for and what is your host system?
For me compiling for e.g. Xiaomi AX3600 works.

And

make -j$(nproc) toolchain/install
make -j$(nproc) package/gettext-full/compile

does succeed.

Mediatek - BPI-R2, BPI-R64, and BPI-R3 targets.
Host is an up-to-date Linux Mint, based on Ubuntu 22.04.

It keeps happening - for most of the gettext/gettext-tools/src tools now. It appears that when libxml is compiled it is compiled to require zlib, and then when it's linked in with all the gettext tools they also require zlib which isn't being added. In a few cases it misses linking in libm too.

The next time you build, can you please compile make -j$(nproc) package/gettext-full/compile V=sc and paste in a copy of the log for when msgconv is compiled? I am interested to see if when it works for you if -lz is on the command line, or if your libxml doesn't need it.

are you using ccache by chance?

My host system is also Linux Mint Vanessa and I run into a different compiling error.

A side note: if you use V=sc always use it with -j 1 , otherwise due to the parallels processes the output will also be intermixed.

I run the following and after the last make distclean I get one:

$ git clone https://github.com/openwrt/openwrt.git openwrt-getfull
$ make distclean
$ ./scripts/feeds update -a
$ ./scripts/feeds install -a
# make menuconfig > Mediatek ARM > 7623 > BPI-R2
$ time make -j$(nproc) toolchain/install
$ time make -j1 package/gettext-full/compile V=sc 2>&1 | tee openwrt-gettext-full-compile_-j1V=s-build.log
# no errors
$ make clean
$ time make -j1 package/gettext-full/compile V=sc 2>&1 | tee openwrt-gettext-full-compile_-j1V=s-build-again.log
# still no errors
$ make dirclean
$ time make -j1 package/gettext-full/compile V=sc 2>&1 | tee openwrt-gettext-full-compile_-j1V=s-build-3.log
# and boom, error
make[3]: Entering directory '/media/plex/Projects/openwrt-getfull/build_dir/hostpkg/gettext-0.21.1'
CDPATH="${ZSH_VERSION+.}:" && cd . && /usr/bin/env bash '/media/plex/Projects/openwrt-getfull/build_dir/hostpkg/gettext-0.21.1/build-aux/missing' aclocal-1.16 -I m4
autom4te: error: need GNU m4 1.4 or later: /media/plex/Projects/openwrt-getfull/staging_dir/host/bin/m4
aclocal-1.16: error: autom4te failed with exit status: 1
make[3]: *** [Makefile:396: aclocal.m4] Error 1

The version of m4 on the system should be current enough

$ apt show m4
Package: m4
Version: 1.4.18-5ubuntu2
[snip]

Not like that, no, but like -Wl,-z,now

msgconv related entries when no error
/bin/sh ../libtool  --tag=CC   --mode=link arm-openwrt-linux-muslgnueabi-gcc  -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -mfloat-abi=hard -fmacro-prefix-map=/media/plex/Projects/openwrt-getfull/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/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/media/plex/Projects/openwrt-getfull/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-12.2.0_musl_eabi/usr/lib -L/media/plex/Projects/openwrt-getfull/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-12.2.0_musl_eabi/lib -znow -zrelro  -o msgcomm msgcomm-msgcomm.o libgettextsrc.la   
OpenWrt-libtool: link: arm-openwrt-linux-muslgnueabi-gcc -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -mfloat-abi=hard -fmacro-prefix-map=/media/plex/Projects/openwrt-getfull/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/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/msgcomm msgcomm-msgcomm.o  -L/media/plex/Projects/openwrt-getfull/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-12.2.0_musl_eabi/usr/lib -L/media/plex/Projects/openwrt-getfull/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-12.2.0_musl_eabi/lib ./.libs/libgettextsrc.so /media/plex/Projects/openwrt-getfull/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/gettext-0.21.1/gettext-tools/gnulib-lib/.libs/libgettextlib.so /media/plex/Projects/openwrt-getfull/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/gettext-0.21.1/libtextstyle/lib/.libs/libtextstyle.so /media/plex/Projects/openwrt-getfull/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/gettext-0.21.1/gettext-tools/intl/.libs/libintl.so -lc
arm-openwrt-linux-muslgnueabi-gcc -DLOCALEDIR=\"/usr/share/locale\" -DBISON_LOCALEDIR=\"/usr/share/locale\" -DLOCALE_ALIAS_PATH=\"/usr/share/locale\" -DUSEJAVA=0 -DGETTEXTJAR=\"/usr/share/gettext/gettext.jar\" -DLIBDIR=\"/usr/lib\" -DGETTEXTDATADIR=\"/usr/share/gettext\" -DPROJECTSDIR=\"/usr/share/gettext/projects\" -DEXEEXT=\"\" -DHAVE_CONFIG_H -I. -I..  -I. -I. -I.. -I.. -I../libgrep -I../gnulib-lib -I../gnulib-lib -I../intl -I../../gettext-runtime/intl -DINSTALLDIR=\"/usr/bin\" -I/media/plex/Projects/openwrt-getfull/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-12.2.0_musl_eabi/usr/include -I/media/plex/Projects/openwrt-getfull/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-12.2.0_musl_eabi/include/fortify -I/media/plex/Projects/openwrt-getfull/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-12.2.0_musl_eabi/include   -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -mfloat-abi=hard -fmacro-prefix-map=/media/plex/Projects/openwrt-getfull/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/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 msgconv-msgconv.o `test -f 'msgconv.c' || echo './'`msgconv.c
/bin/sh ../libtool  --tag=CC   --mode=link arm-openwrt-linux-muslgnueabi-gcc  -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -mfloat-abi=hard -fmacro-prefix-map=/media/plex/Projects/openwrt-getfull/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/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/media/plex/Projects/openwrt-getfull/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-12.2.0_musl_eabi/usr/lib -L/media/plex/Projects/openwrt-getfull/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-12.2.0_musl_eabi/lib -znow -zrelro  -o msgconv msgconv-msgconv.o libgettextsrc.la   
OpenWrt-libtool: link: arm-openwrt-linux-muslgnueabi-gcc -Os -pipe -fno-caller-saves -fno-plt -fhonour-copts -mfloat-abi=hard -fmacro-prefix-map=/media/plex/Projects/openwrt-getfull/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/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/msgconv msgconv-msgconv.o  -L/media/plex/Projects/openwrt-getfull/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-12.2.0_musl_eabi/usr/lib -L/media/plex/Projects/openwrt-getfull/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-12.2.0_musl_eabi/lib ./.libs/libgettextsrc.so /media/plex/Projects/openwrt-getfull/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/gettext-0.21.1/gettext-tools/gnulib-lib/.libs/libgettextlib.so /media/plex/Projects/openwrt-getfull/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/gettext-0.21.1/libtextstyle/lib/.libs/libtextstyle.so /media/plex/Projects/openwrt-getfull/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/gettext-0.21.1/gettext-tools/intl/.libs/libintl.so 

Thank-you for the log. -Wl,-z,now is different. Your build is not linking in zlib, and not requiring it.

I have discovered the build system is sensitive to the order that you make things. I think I've exposed a bug in the dependencies in OpenWrt. For example, if I am doing a full (all packages build) then if I do this:

make -j$(nproc) toolchain/install
make -j$(nproc) target/linux/compile
make -j$(nproc) package/kernel/mt76/compile
make -j$(nproc) world

Then building gettext-full fails with the errors in my OP. if I add gettext-full explicitly early on, then it succeeds:

make -j$(nproc) toolchain/install
make -j$(nproc) target/linux/compile
make -j$(nproc) package/gettext-full/compile
make -j$(nproc) package/kernel/mt76/compile
make -j$(nproc) world
...fails on gettext-full...

I haven't yet identified the package that kills gettext-full. Something is putting zlib in staging_dir in such a way that when gettext's libxml is configured it sees it and decides to use it. Which causes gettext-full to fail because it isn't linking in zlib.

I suspect the answer will be to see if libxml's build options can be changed to explicitly exclude zlib, or to add zlib as a dependency of libxml AND of gettext-full.

no.... the version of m4 that matters is the one in staging_dir

staging_dir/host/bin/m4 --version

our m4 is up to date, so automake is behaving like its not installed at all

Can you try if this patch works for you?
With this patch those errors are gone on our buildbot.

in my opinion we should fix our own libxml package instead

anyone have any idea what's wrong with libxml?

libxml2 is only available in packages feed.

Try my PR and let me know what you all think :smiley:

@1715173329 let me know if you want me to tag you in the commit for reporting the libxml issue (by the way, I have not experienced an error related to libxml, only other things like what the CI log shows).

1 Like

let me know if you want me to tag you in the commit for reporting the libxml issue

if applicable:
Reported-by: Tianling Shen <cnsztl@immortalwrt.org>

Try my PR and let me know what you all think

Will test it tomorrow, thank you!

also, what was the error regarding libxml? do you still have that log?

Same as the first post

Looks like miss -lz flag

you may have to delete the symlink copy of libxml2 when testing my PR

rm -rf package/feeds/packages/libxml2