Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/libiio: fix python bindings without glibc utils
@ 2025-12-22 17:26 Marcus Hoffmann via buildroot
  2025-12-22 17:26 ` [Buildroot] [PATCH 2/2] support/testing: add libiio python bindings runtime test Marcus Hoffmann via buildroot
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Marcus Hoffmann via buildroot @ 2025-12-22 17:26 UTC (permalink / raw)
  To: buildroot; +Cc: Paul Cercueil

Libiio python bindings use ctypes and specifically the find_library()
function from there to load the libiio.so shared library. This is not
working unless glibc utils (specifically ldconfig) is installed to the
target (alternatively the target would need gcc or binutils, for objdump
or ld).

The easy fix here is to just bypass the find_library() machinery
altogether as it's not needed on a buildroot system.

Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
---
 ...-bindings-python-fix-library-loading.patch | 41 +++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 package/libiio/0001-bindings-python-fix-library-loading.patch

diff --git a/package/libiio/0001-bindings-python-fix-library-loading.patch b/package/libiio/0001-bindings-python-fix-library-loading.patch
new file mode 100644
index 0000000000..f8715b4c5b
--- /dev/null
+++ b/package/libiio/0001-bindings-python-fix-library-loading.patch
@@ -0,0 +1,41 @@
+From 4d4d17e2810f793b9f7fd8acad2a3c551dbff2b5 Mon Sep 17 00:00:00 2001
+From: Marcus Hoffmann <marcus.hoffmann@othermo.de>
+Date: Fri, 31 Mar 2023 20:13:07 +0200
+Subject: [PATCH] bindings: python: fix library loading
+
+On Linux the find_library() function requires ld, gcc, objdump
+or ldconfig on the target, which might not be present on a
+buildroot system. [1]
+We do not actually need this function at all, as we know the iio library
+will be referencable in the system under the name "libiio.so".
+So instead of kicking of this complicated cross-platform/cross-distro
+compatible machinery, we just pass in the name of the library we already
+know.
+
+[1] https://docs.python.org/3/library/ctypes.html#finding-shared-libraries
+
+Upstream: N/A, buildroot doesn't have to care about different OS's and
+distro setups, so we can just hardcode the lib name, but we cannot
+submit that upstream.
+
+Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
+---
+ bindings/python/iio.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/bindings/python/iio.py b/bindings/python/iio.py
+index b91260cc..bde17694 100644
+--- a/bindings/python/iio.py
++++ b/bindings/python/iio.py
+@@ -224,7 +224,7 @@ else:
+     # Non-windows, possibly Posix system
+     _iiolib = "iio"
+ 
+-_lib = _cdll(find_library(_iiolib), use_errno=True, use_last_error=True)
++_lib = _cdll("libiio.so", use_errno=True, use_last_error=True)
+ 
+ _get_backends_count = _lib.iio_get_backends_count
+ _get_backends_count.restype = c_uint
+-- 
+2.25.1
+
-- 
2.52.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-01-07 17:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-22 17:26 [Buildroot] [PATCH 1/2] package/libiio: fix python bindings without glibc utils Marcus Hoffmann via buildroot
2025-12-22 17:26 ` [Buildroot] [PATCH 2/2] support/testing: add libiio python bindings runtime test Marcus Hoffmann via buildroot
2026-01-07 17:50   ` Arnout Vandecappelle via buildroot
2025-12-24  1:39 ` [Buildroot] [PATCH 1/2] package/libiio: fix python bindings without glibc utils Fiona Klute via buildroot
2025-12-27 15:57 ` Thomas Petazzoni via buildroot
2025-12-30 23:18   ` Fiona Klute via buildroot
2026-01-07 17:50 ` Arnout Vandecappelle via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox