Skip to contentSkip to conversation

package/libxml2: fix build of packages detecting libxml2 using libxml2-config.cmake

PATCH In review Bernd Kuhls 2 participants 4 messages Oct 29, 2025 – Jan 7

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 package/libxml2: fix build of packages detecting libxml2 using libxml2-config.cmake

Fixes build error seen with libiio:

mips64el-buildroot-linux-gnu-gcc: ERROR: unsafe header/library path used
in cross-compilation: '-I/usr/include/libxml2'

caused by bump of libxml2 to 2.15.0 with buildroot commit d81922c1ef8825f10b802984d9721412a1a1a377.

Upstream acknowledged the problem and waits for a fix
https://gitlab.gnome.org/GNOME/libxml2/-/issues/898#note_2453923
so we revert the offending commit for now.

Fixes:
https://autobuild.buildroot.net/results/fde/fde40a3d6ac58f568e49419e5176db5a62a0a4d9/

---
v2: added comment about buildroot commit causing the problem

 ...-installation-directories-in-libxml2.patch | 85 +++++++++++++++++++
 package/libxml2/libxml2.mk                    |  2 +
 2 files changed, 87 insertions(+)
 create mode 100644 package/libxml2/0001-Revert-cmake-Fix-installation-directories-in-libxml2.patch
package/libxml2/0001-Revert-cmake-Fix-installation-directories-in-libxml2.patch new file +85 -0
new file mode 100644
index 0000000000..75232b6f00
@@ -0,0 +1,85 @@
+From 81992efb40b37cc893c55575a83cdd1cec1fde2a Mon Sep 17 00:00:00 2001
+From: Bernd Kuhls <[email protected]>
+Date: Wed, 29 Oct 2025 21:45:09 +0100
+Subject: [PATCH] Revert "cmake: Fix installation directories in
+ libxml2-config.cmake"
+
+This reverts commit 75dde50b20215a2a3a445b62f36a67c8ed337cab.
+
+Upstream: https://gitlab.gnome.org/GNOME/libxml2/-/issues/898#note_2452864
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+---
+ configure.ac            | 11 -----------
+ libxml2-config.cmake.in | 11 +++++++----
+ meson.build             |  3 ---
+ 3 files changed, 7 insertions(+), 18 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 4eb629bb..150e06eb 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1006,17 +1006,6 @@ AC_SUBST(XML_PRIVATE_LIBS)
+ AC_SUBST(XML_PRIVATE_CFLAGS)
+ AC_SUBST(XML_INCLUDEDIR)
+ 
+-# for libxml2-config.cmake.in
+-AX_RECURSIVE_EVAL(["$bindir"], [INSTALL_BINDIR])
+-AX_RECURSIVE_EVAL(["$includedir"], [INSTALL_INCLUDEDIR])
+-AX_RECURSIVE_EVAL(["$libdir"], [INSTALL_LIBDIR])
+-AC_SUBST(INSTALL_BINDIR)
+-AC_SUBST(INSTALL_INCLUDEDIR)
+-AC_SUBST(INSTALL_LIBDIR)
+-AM_SUBST_NOTMAKE(INSTALL_BINDIR)
+-AM_SUBST_NOTMAKE(INSTALL_INCLUDEDIR)
+-AM_SUBST_NOTMAKE(INSTALL_LIBDIR)
+-
+ AX_RECURSIVE_EVAL(["$sysconfdir"], [XML_SYSCONFDIR])
+ AC_DEFINE_UNQUOTED([XML_SYSCONFDIR], ["$XML_SYSCONFDIR"],
+                    [System configuration directory (/etc)])
+diff --git a/libxml2-config.cmake.in b/libxml2-config.cmake.in
+index ff6433fa..b775cfee 100644
+--- a/libxml2-config.cmake.in
++++ b/libxml2-config.cmake.in
+@@ -24,17 +24,20 @@
+ #   LibXml2::LibXml2          - the LibXml2 library
+ #   LibXml2::xmllint          - the xmllint command-line executable
+ 
++get_filename_component(_libxml2_rootdir ${CMAKE_CURRENT_LIST_DIR}/../../../ ABSOLUTE)
++
+ set(LIBXML2_VERSION_MAJOR  @LIBXML_MAJOR_VERSION@)
+ set(LIBXML2_VERSION_MINOR  @LIBXML_MINOR_VERSION@)
+ set(LIBXML2_VERSION_MICRO  @LIBXML_MICRO_VERSION@)
+ set(LIBXML2_VERSION_STRING "@VERSION@")
+ set(LIBXML2_DEFINITIONS    "@XML_CFLAGS@")
+-set(LIBXML2_INCLUDE_DIR    @INSTALL_INCLUDEDIR@/libxml2)
+-set(LIBXML2_LIBRARY_DIR    @INSTALL_LIBDIR@)
++set(LIBXML2_INSTALL_PREFIX ${_libxml2_rootdir})
++set(LIBXML2_INCLUDE_DIR    ${_libxml2_rootdir}/include/libxml2)
++set(LIBXML2_LIBRARY_DIR    ${_libxml2_rootdir}/lib)
+ 
+ find_library(LIBXML2_LIBRARY NAMES xml2 HINTS ${LIBXML2_LIBRARY_DIR} NO_DEFAULT_PATH)
+-find_program(LIBXML2_XMLCATALOG_EXECUTABLE NAMES xmlcatalog HINTS @INSTALL_BINDIR@ NO_DEFAULT_PATH)
+-find_program(LIBXML2_XMLLINT_EXECUTABLE NAMES xmllint HINTS @INSTALL_BINDIR@ NO_DEFAULT_PATH)
++find_program(LIBXML2_XMLCATALOG_EXECUTABLE NAMES xmlcatalog HINTS ${_libxml2_rootdir}/bin NO_DEFAULT_PATH)
++find_program(LIBXML2_XMLLINT_EXECUTABLE NAMES xmllint HINTS ${_libxml2_rootdir}/bin NO_DEFAULT_PATH)
+ 
+ set(LIBXML2_LIBRARIES ${LIBXML2_LIBRARY})
+ set(LIBXML2_INCLUDE_DIRS ${LIBXML2_INCLUDE_DIR})
+diff --git a/meson.build b/meson.build
+index 31c73b62..8728852c 100644
+--- a/meson.build
++++ b/meson.build
+@@ -577,9 +577,6 @@ config_cmake = configuration_data()
+ config_cmake.set('LIBXML_MAJOR_VERSION', v_maj)
+ config_cmake.set('LIBXML_MINOR_VERSION', v_min)
+ config_cmake.set('LIBXML_MICRO_VERSION', v_mic)
+-config_cmake.set('INSTALL_BINDIR', dir_bin)
+-config_cmake.set('INSTALL_INCLUDEDIR', dir_include)
+-config_cmake.set('INSTALL_LIBDIR', dir_lib)
+ config_cmake.set('VERSION', meson.project_version())
+ config_cmake.set10('BUILD_SHARED_LIBS',
+                    get_option('default_library') != 'static')
+-- 
+2.47.3
+
package/libxml2/libxml2.mk +2 -0
index bf83ec2041..de0ec42eca 100644
@@ -14,6 +14,8 @@ LIBXML2_LICENSE = MIT
 LIBXML2_LICENSE_FILES = Copyright
 LIBXML2_CPE_ID_VENDOR = xmlsoft
 LIBXML2_CONFIG_SCRIPTS = xml2-config
+# 0001-Revert-cmake-Fix-installation-directories-in-libxml2.patch
+LIBXML2_AUTORECONF = YES
 
 # relocation truncated to fit: R_68K_GOT16O
 ifeq ($(BR2_m68k_cf),y)
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 package/libxml2: bump version to 2.15.1

Release notes:
https://download.gnome.org/sources/libxml2/2.15/libxml2-2.15.1.news

---
 package/libxml2/libxml2.hash | 4 ++--
 package/libxml2/libxml2.mk   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
package/libxml2/libxml2.hash +2 -2
index 59f1ef2ac0..637ba52bb8 100644
@@ -1,4 +1,4 @@
-# From https://download.gnome.org/sources/libxml2/2.15/libxml2-2.15.0.sha256sum
-sha256  5abc766497c5b1d6d99231f662e30c99402a90d03b06c67b62d6c1179dedd561  libxml2-2.15.0.tar.xz
+# From https://download.gnome.org/sources/libxml2/2.15/libxml2-2.15.1.sha256sum
+sha256  c008bac08fd5c7b4a87f7b8a71f283fa581d80d80ff8d2efd3b26224c39bc54c  libxml2-2.15.1.tar.xz
 # License files, locally calculated
 sha256  5d4873884a890122a4b9b20ad56ac6f7da1d796a5bfcf04a427970ac96217626  Copyright
package/libxml2/libxml2.mk +1 -1
index de0ec42eca..35d373e130 100644
@@ -5,7 +5,7 @@
 ################################################################################
 
 LIBXML2_VERSION_MAJOR = 2.15
-LIBXML2_VERSION = $(LIBXML2_VERSION_MAJOR).0
+LIBXML2_VERSION = $(LIBXML2_VERSION_MAJOR).1
 LIBXML2_SOURCE = libxml2-$(LIBXML2_VERSION).tar.xz
 LIBXML2_SITE = \
 	https://download.gnome.org/sources/libxml2/$(LIBXML2_VERSION_MAJOR)
Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw

Re: [Buildroot] [PATCH 2/2] package/libxml2: bump version to 2.15.1

Quoted 4 lines · Bernd Kuhls

Release notes:
https://download.gnome.org/sources/libxml2/2.15/libxml2-2.15.1.news

Applied to 2025.02.x. Thanks

Quoted 21 lines
---
  package/libxml2/libxml2.hash | 4 ++--
  package/libxml2/libxml2.mk   | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)
package/libxml2/libxml2.hash +2 -2
index 59f1ef2ac0..637ba52bb8 100644
@@ -1,4 +1,4 @@
-# From https://download.gnome.org/sources/libxml2/2.15/libxml2-2.15.0.sha256sum
-sha256  5abc766497c5b1d6d99231f662e30c99402a90d03b06c67b62d6c1179dedd561  libxml2-2.15.0.tar.xz
+# From https://download.gnome.org/sources/libxml2/2.15/libxml2-2.15.1.sha256sum
+sha256  c008bac08fd5c7b4a87f7b8a71f283fa581d80d80ff8d2efd3b26224c39bc54c  libxml2-2.15.1.tar.xz
  # License files, locally calculated
  sha256  5d4873884a890122a4b9b20ad56ac6f7da1d796a5bfcf04a427970ac96217626  Copyright
package/libxml2/libxml2.mk +0 -0
index de0ec42eca..35d373e130 100644

package/libxml2/libxml2.mk line 11

Quoted 8 lines
package/libxml2/libxml2.mk +1 -1
@@ -5,7 +5,7 @@
  ################################################################################
 
  LIBXML2_VERSION_MAJOR = 2.15
-LIBXML2_VERSION = $(LIBXML2_VERSION_MAJOR).0
+LIBXML2_VERSION = $(LIBXML2_VERSION_MAJOR).1
  LIBXML2_SOURCE = libxml2-$(LIBXML2_VERSION).tar.xz
  LIBXML2_SITE = \
  	https://download.gnome.org/sources/libxml2/$(LIBXML2_VERSION_MAJOR)

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
In reply to Bernd Kuhls
Quoted 8 lines · Bernd Kuhls

Fixes build error seen with libiio:

mips64el-buildroot-linux-gnu-gcc: ERROR: unsafe header/library path used
in cross-compilation: '-I/usr/include/libxml2'

caused by bump of libxml2 to 2.15.0 with buildroot commit d81922c1ef8825f10b802984d9721412a1a1a377.

Quoted 8 lines

Upstream acknowledged the problem and waits for a fix
https://gitlab.gnome.org/GNOME/libxml2/-/issues/898#note_2453923
so we revert the offending commit for now.

Fixes:
https://autobuild.buildroot.net/results/fde/fde40a3d6ac58f568e49419e5176db5a62a0a4d9/

Series applied to master, thanks.
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot