diff --git a/config/comp_libs/gettext.in b/config/comp_libs/gettext.in index df7e3361..85e43873 100644 --- a/config/comp_libs/gettext.in +++ b/config/comp_libs/gettext.in @@ -1 +1,11 @@ # gettext options + +config GETTEXT_INCOMPATIBLE_WITH_UCLIBC_NG + def_bool y + depends on GETTEXT_0_21_or_later + +if GETTEXT_INCOMPATIBLE_WITH_UCLIBC_NG +comment "This version of gettext is not compatible with uClibc-NG. Select" +comment "a different version if uClibc-NG is used on the target or (in a" +comment "Canadian cross build) on the host." +endif diff --git a/packages/gettext/package.desc b/packages/gettext/package.desc index 99d493ff..2341b4bd 100644 --- a/packages/gettext/package.desc +++ b/packages/gettext/package.desc @@ -5,3 +5,4 @@ bootstrap='./autogen.sh' mirrors='$(CT_Mirrors GNU gettext)' archive_formats='.tar.xz .tar.gz' signature_format='packed/.sig' +milestones='0.21' diff --git a/samples/powerpc-unknown-linux-uclibc,m68k-unknown-uclinux-uclibc/crosstool.config b/samples/powerpc-unknown-linux-uclibc,m68k-unknown-uclinux-uclibc/crosstool.config index 40736a5e..29e7406b 100644 --- a/samples/powerpc-unknown-linux-uclibc,m68k-unknown-uclinux-uclibc/crosstool.config +++ b/samples/powerpc-unknown-linux-uclibc,m68k-unknown-uclinux-uclibc/crosstool.config @@ -4,3 +4,4 @@ CT_CANADIAN=y CT_HOST="powerpc-unknown-linux-uclibc" CT_KERNEL_LINUX=y CT_THREADS_LT=y +CT_GETTEXT_V_0_20_1=y diff --git a/samples/x86_64-multilib-linux-uclibc,powerpc-unknown-elf/crosstool.config b/samples/x86_64-multilib-linux-uclibc,powerpc-unknown-elf/crosstool.config index ee02ef7c..867ac133 100644 --- a/samples/x86_64-multilib-linux-uclibc,powerpc-unknown-elf/crosstool.config +++ b/samples/x86_64-multilib-linux-uclibc,powerpc-unknown-elf/crosstool.config @@ -6,6 +6,7 @@ CT_HOST="x86_64-multilib-linux-uclibc" CT_BINUTILS_PLUGINS=y CT_CC_LANG_CXX=y CT_DEBUG_GDB=y +CT_GETTEXT_V_0_20_1=y CT_COMP_TOOLS_FOR_HOST=y CT_COMP_TOOLS_M4=y CT_COMP_TOOLS_MAKE=y diff --git a/scripts/build/companion_libs/330-gettext.sh b/scripts/build/companion_libs/330-gettext.sh index 149d7d73..9fa3bdcc 100644 --- a/scripts/build/companion_libs/330-gettext.sh +++ b/scripts/build/companion_libs/330-gettext.sh @@ -80,6 +80,28 @@ do_gettext_backend() { return ;; + # Starting with 0.21, gettext cannot build against uClibc-NG: gettext + # checks if it needs to use fopen wrapper (using gnulib) and newer versions + # of gnulib also check if fopen provided by the system supports 'e' and 'x' + # modes. In cross-compile environment, gnulib falls back to assuming fopen + # does not support these modes unless the target tuple is glibc or musl + # (rightly so, since these fopen modes are optional in uClibc-NG). + # Unfortunately, the fopen() wrapper does not compile against uClibc-NG's + # stdio.h then because it includes after defining __need_FILE macro. + # It looks like two bugs, one in each of uClibc-ng and gnulib: + # - uClibc-ng does not include its internal headers with the definitions for the + # __BEGIN_NAMESPACE_STD/__END_NAMESPACE_STD macros, which therefore escape + # unsubstituted into the including code. + # - gnulib shouldn't expect the fopen() prototype if it only asked for FILE + # structure definition by defining the __need_FILE macro. + # Until the maintainers sort this out, disallow newer gettext versions if + # linking against uClibc-NG. + *-uclibc*) + if [ "${CT_GETTEXT_INCOMPATIBLE_WITH_UCLIBC_NG}" = "y" ]; then + CT_Abort "This version of gettext is incompatible with uClibc-NG" + fi + ;; + # A bit ugly. D__USE_MINGW_ANSI_STDIO=1 has its own {v}asprintf functions # but gettext configure doesn't see this flag when it checks for that. An # alternative may be to use CC="${host}-gcc ${cflags}" but that didn't