[PATCH master] scripts: include/linux/types.h: define loff_t for musl

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Jan 27 03:15:09 PST 2025


musl doesn't define loff_t, but glibc does and both of them define
__linux__. This leads to build errors with musl when code makes it into
scripts/ that uses loff_t. This was already fixed once e.g. in commit
c0d065fb0aa0 ("scripts: bareboximd: remove usage of loff_t").
Instead of playing whack-a-mole in future, let's just define loff_t
for non-glibc builds of scripts/.

Fixes: 5171f4d0696f ("scripts: implement read_fd and pread_full for tools")
Reported-by: Enrico Jörns <ejo at pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 scripts/include/linux/types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/include/linux/types.h b/scripts/include/linux/types.h
index e81d7e810126..02a330cd4e79 100644
--- a/scripts/include/linux/types.h
+++ b/scripts/include/linux/types.h
@@ -14,7 +14,7 @@ typedef int16_t __s16;
 typedef uint8_t __u8;
 typedef int8_t __s8;
 
-#ifndef __linux__
+#ifndef __GLIBC__
 typedef long long loff_t;
 #endif
 
-- 
2.39.5




More information about the barebox mailing list