Skip to contentSkip to conversation

package/kodi: fix build errors with uClibc-ng

PATCH Applied Bernd Kuhls 2 participants 3 messages Oct 24 – Oct 30

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/kodi: fix build errors with uClibc-ng

uClibc-ng 1.0.58 includes commit
https://github.com/wbx-github/uclibc-ng/commit/487af14988c3c923aa661f204642597cff356a83
which removes "#define PAGE_SIZE" causing build errors detected by the Gitlab pipelines for all uClibc-ng toolchains:

/builds/bkuhls/buildroot/br-test-pkg/bootlin-powerpc-e500mc-uclibc/build/kodi-21.3-Omega/xbmc/utils/UDMABufferObject.cpp:26:12:
error: expected unqualified-id before numeric constant

Patch 0015 fixes the problem.

Buildroot commit f82f5fe177b7f884d424c7ce22aff670ed13f359 bumped uClibc to version 1.0.56 which includes gettid() causing a build error. Patch 0016 fixes the problem.

---
Gitlab pipelines passed:
https://gitlab.com/bkuhls/buildroot/-/commits/36995903d2789de0f541b543c4c7f9890b28f5d6

 ...-Use-sysconf-_SC_PAGESIZE-to-retriev.patch | 42 +++++++++++++++++
 ...dImplLinux-uClibc-ng-provides-gettid.patch | 47 +++++++++++++++++++
 2 files changed, 89 insertions(+)
 create mode 100644 package/kodi/0015-UDMABufferObject-Use-sysconf-_SC_PAGESIZE-to-retriev.patch
 create mode 100644 package/kodi/0016-CThreadImplLinux-uClibc-ng-provides-gettid.patch
package/kodi/0015-UDMABufferObject-Use-sysconf-_SC_PAGESIZE-to-retriev.patch new file +42 -0
new file mode 100644
index 0000000000..3b7e359844
@@ -0,0 +1,42 @@
+From da89dfce2da4c68ef3a7f89a4fba1cd6f861e363 Mon Sep 17 00:00:00 2001
+From: fossdd <[email protected]>
+Date: Sat, 22 Feb 2025 22:52:11 +0100
+Subject: [PATCH] [UDMABufferObject] Use sysconf(_SC_PAGESIZE) to retrieve page
+ size
+
+getpagesize() is deprecated and legacy since POSIX.1-2001 and is not available
+on architectures where PAGESIZE is not defined. Instead query the
+current page size at runtime.
+
+Upstream: https://github.com/xbmc/xbmc/commit/da89dfce2da4c68ef3a7f89a4fba1cd6f861e363
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+---
+ xbmc/utils/UDMABufferObject.cpp | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/xbmc/utils/UDMABufferObject.cpp b/xbmc/utils/UDMABufferObject.cpp
+index 2b8336bcea..f6ba81c18f 100644
+--- a/xbmc/utils/UDMABufferObject.cpp
++++ b/xbmc/utils/UDMABufferObject.cpp
+@@ -23,8 +23,6 @@
+ namespace
+ {
+ 
+-const auto PAGESIZE = getpagesize();
+-
+ int RoundUp(int num, int factor)
+ {
+   return num + factor - 1 - (num - 1) % factor;
+@@ -93,7 +91,7 @@ bool CUDMABufferObject::CreateBufferObject(uint32_t format, uint32_t width, uint
+ bool CUDMABufferObject::CreateBufferObject(uint64_t size)
+ {
+   // Must be rounded to the system page size
+-  m_size = RoundUp(size, PAGESIZE);
++  m_size = RoundUp(size, sysconf(_SC_PAGESIZE));
+ 
+   m_memfd = memfd_create("kodi", MFD_CLOEXEC | MFD_ALLOW_SEALING);
+   if (m_memfd < 0)
+-- 
+2.47.3
+
package/kodi/0016-CThreadImplLinux-uClibc-ng-provides-gettid.patch new file +47 -0

47 lines not on this page · raw message

Signature · 6 lines
2.47.3

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw
Quoted 8 lines · Bernd Kuhls

uClibc-ng 1.0.58 includes commit
https://github.com/wbx-github/uclibc-ng/commit/487af14988c3c923aa661f204642597cff356a83
which removes "#define PAGE_SIZE" causing build errors detected by the Gitlab pipelines for all uClibc-ng toolchains:

/builds/bkuhls/buildroot/br-test-pkg/bootlin-powerpc-e500mc-uclibc/build/kodi-21.3-Omega/xbmc/utils/UDMABufferObject.cpp:26:12:
error: expected unqualified-id before numeric constant

Quoted 7 lines

Patch 0015 fixes the problem.

Buildroot commit f82f5fe177b7f884d424c7ce22aff670ed13f359 bumped uClibc to version 1.0.56 which includes gettid() causing a build error. Patch 0016 fixes the problem.

Applied to master, thanks!

Best regards,

Thomas Petazzoni

Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#2 lore raw
In reply to Bernd Kuhls

In reply of:

Quoted 8 lines

uClibc-ng 1.0.58 includes commit
https://github.com/wbx-github/uclibc-ng/commit/487af14988c3c923aa661f204642597cff356a83
which removes "#define PAGE_SIZE" causing build errors detected by the Gitlab pipelines for all uClibc-ng toolchains:

/builds/bkuhls/buildroot/br-test-pkg/bootlin-powerpc-e500mc-uclibc/build/kodi-21.3-Omega/xbmc/utils/UDMABufferObject.cpp:26:12:
error: expected unqualified-id before numeric constant

Quoted 7 lines

Patch 0015 fixes the problem.

Buildroot commit f82f5fe177b7f884d424c7ce22aff670ed13f359 bumped uClibc to version 1.0.56 which includes gettid() causing a build error. Patch 0016 fixes the problem.

Applied to 2025.02.x, 2026.08.x. Thanks

Quoted 101 lines

---
Gitlab pipelines passed:
https://gitlab.com/bkuhls/buildroot/-/commits/36995903d2789de0f541b543c4c7f9890b28f5d6

 ...-Use-sysconf-_SC_PAGESIZE-to-retriev.patch | 42 +++++++++++++++++
 ...dImplLinux-uClibc-ng-provides-gettid.patch | 47 +++++++++++++++++++
 2 files changed, 89 insertions(+)
 create mode 100644 package/kodi/0015-UDMABufferObject-Use-sysconf-_SC_PAGESIZE-to-retriev.patch
 create mode 100644 package/kodi/0016-CThreadImplLinux-uClibc-ng-provides-gettid.patch
package/kodi/0015-UDMABufferObject-Use-sysconf-_SC_PAGESIZE-to-retriev.patch new file +42 -0
new file mode 100644
index 0000000000..3b7e359844
@@ -0,0 +1,42 @@
+From da89dfce2da4c68ef3a7f89a4fba1cd6f861e363 Mon Sep 17 00:00:00 2001
+From: fossdd <[email protected]>
+Date: Sat, 22 Feb 2025 22:52:11 +0100
+Subject: [PATCH] [UDMABufferObject] Use sysconf(_SC_PAGESIZE) to retrieve page
+ size
+
+getpagesize() is deprecated and legacy since POSIX.1-2001 and is not available
+on architectures where PAGESIZE is not defined. Instead query the
+current page size at runtime.
+
+Upstream: https://github.com/xbmc/xbmc/commit/da89dfce2da4c68ef3a7f89a4fba1cd6f861e363
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+---
+ xbmc/utils/UDMABufferObject.cpp | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/xbmc/utils/UDMABufferObject.cpp b/xbmc/utils/UDMABufferObject.cpp
+index 2b8336bcea..f6ba81c18f 100644
+--- a/xbmc/utils/UDMABufferObject.cpp
++++ b/xbmc/utils/UDMABufferObject.cpp
+@@ -23,8 +23,6 @@
+ namespace
+ {
+ 
+-const auto PAGESIZE = getpagesize();
+-
+ int RoundUp(int num, int factor)
+ {
+   return num + factor - 1 - (num - 1) % factor;
+@@ -93,7 +91,7 @@ bool CUDMABufferObject::CreateBufferObject(uint32_t format, uint32_t width, uint
+ bool CUDMABufferObject::CreateBufferObject(uint64_t size)
+ {
+   // Must be rounded to the system page size
+-  m_size = RoundUp(size, PAGESIZE);
++  m_size = RoundUp(size, sysconf(_SC_PAGESIZE));
+ 
+   m_memfd = memfd_create("kodi", MFD_CLOEXEC | MFD_ALLOW_SEALING);
+   if (m_memfd < 0)
+-- 
+2.47.3
+
package/kodi/0016-CThreadImplLinux-uClibc-ng-provides-gettid.patch new file +37 -0
new file mode 100644
index 0000000000..87c71a525e
@@ -0,0 +1,47 @@
+From 6b2fd8c0691426be9e8d36276e5f3a8153fa3262 Mon Sep 17 00:00:00 2001
+From: Bernd Kuhls <[email protected]>
+Date: Fri, 23 Oct 2026 08:03:18 +0200
+Subject: [PATCH] CThreadImplLinux: uClibc-ng provides gettid()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+https://github.com/xbmc/xbmc/commit/b5b2be7121f750b5f27d205e2b11ce0179b388cf
+added gettid() back in 2022 for older glibc and all uClibc versions.
+
+uClibc-ng added gettid() in version 1.0.56:
+https://github.com/wbx-github/uclibc-ng/commit/47c15dbb50f07be1ef5a1ffc9559205584078fbc
+
+causing a build error now:
+
+/builds/bkuhls/buildroot/br-test-pkg/bootlin-x86-64-uclibc/build/kodi-22.0rc1-Piers/xbmc/platform/linux/threads/ThreadImplLinux.cpp:
+ In constructor ‘CThreadImplLinux::CThreadImplLinux(std::thread::native_handle_type)’:
+/builds/bkuhls/buildroot/br-test-pkg/bootlin-x86-64-uclibc/build/kodi-22.0rc1-Piers/xbmc/platform/linux/threads/ThreadImplLinux.cpp:76:43:
+ error: call of overloaded ‘gettid()’ is ambiguous
+
+To fix the problem the kodi implementation of gettid() should only be
+used for older glibc versions.
+
+Upstream: https://github.com/xbmc/xbmc/pull/30055
+
+Signed-off-by: Bernd Kuhls <[email protected]>
+---
+ xbmc/platform/linux/threads/ThreadImplLinux.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/xbmc/platform/linux/threads/ThreadImplLinux.cpp b/xbmc/platform/linux/threads/ThreadImplLinux.cpp
+index 8c7edbb591..ebf4ebe82b 100644
+--- a/xbmc/platform/linux/threads/ThreadImplLinux.cpp
++++ b/xbmc/platform/linux/threads/ThreadImplLinux.cpp
+@@ -52,7 +52,7 @@ constexpr int ThreadPriorityToNativePriority(const ThreadPriority& priority)
+   }

package/kodi/0016-CThreadImplLinux-uClibc-ng-provides-gettid.patch line 47

Quoted 10 lines
package/kodi/0016-CThreadImplLinux-uClibc-ng-provides-gettid.patch new file +10 -0
+ }
+ 
+-#if !defined(TARGET_ANDROID) && (defined(__GLIBC__) || defined(__UCLIBC__))
++#if !defined(TARGET_ANDROID) && defined(__GLIBC__) && !defined(__UCLIBC__)
+ #if defined(__UCLIBC__) || !__GLIBC_PREREQ(2, 30)
+ static pid_t gettid()
+ {
+-- 
+2.47.3
+

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