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/. Also, make sure <linux/types.h> is always included for scripts/common.h, which is the only header currently making use of loff_t. Fixes: 5171f4d0696f ("scripts: implement read_fd and pread_full for tools") Reported-by: Enrico Jörns <ejo@xxxxxxxxxxxxxx> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- v1 -> v2: - include <linux/types.h> from scripts/common.h (Enrico) --- scripts/common.h | 2 ++ scripts/include/linux/types.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/common.h b/scripts/common.h index a0d16606b5d9..21ec576a5be9 100644 --- a/scripts/common.h +++ b/scripts/common.h @@ -1,6 +1,8 @@ #ifndef __COMMON_H #define __COMMON_H +#include <linux/types.h> + int read_file_2(const char *filename, size_t *size, void **outbuf, size_t max_size); void *read_file(const char *filename, size_t *size); void *read_fd(int fd, size_t *out_size); 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