From e5955cd62a4069b1e2c9fb1536c55dc399a8bcb3 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Wed, 18 Dec 2024 10:48:14 +0800 Subject: [PATCH] gettext: Fix build issue with system libxml2 The upstream fix is explicitly checking libxml2 version so it's not practical to be turned into a sed. But I don't want to upload another patch just for such a "temporary" issue (as it'll be fixed for 0.23.1 anyway). This alternative fix relies on: 1. The fact that the return type of xmlCtxtGetLastError and the arg type of xmlStructuredErrorFunc are changed in the same commit 61034116d0a3 ("error: Make more xmlError structs constant"). 2. GCC supports typeof(expr) to get the type of expr w/o really evaluating it. So it should have the same effect as the upstream fix. Tested with both --with-included-libxml2 and --without-included-libxml2 on BLFS. --- chapter08/gettext.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/chapter08/gettext.xml b/chapter08/gettext.xml index f26d15536..d8fbc8f20 100644 --- a/chapter08/gettext.xml +++ b/chapter08/gettext.xml @@ -43,6 +43,14 @@ Installation of Gettext + At first, fix an issue causing the package fail to build with + libxml-2.12 or later. The fix is optional for building LFS, but + required if rebuilding this package in BLFS with libxml + installed: + +sed -e '/^structured/s/xmlError \*/typeof(xmlCtxtGetLastError(NULL)) /' \ + -i gettext-tools/src/its.c + Prepare Gettext for compilation: ./configure --prefix=/usr \