[PATCH master 2/2] scripts: common.h: define loff_t on musl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Target tool build against musl fails, because loff_t is undefined,
despite _GNU_SOURCE being defined.

This is because glibc defines loff_t via <sys/types.h>, but musl defines
loff_t only in fcntl.h and the latter file isn't included beforehand in
imx-usb-loader-target.c.

Add the missing include to <linux/types.h> and include that header in
scripts/common.h to resolve the musl breakage.

This issue was noticedd during a Yocto build against musl, but can be
easily reproduced in Debian as well using the musl-tools package:

  export ARCH=sandbox
  make HOSTCC=musl-gcc CC=musl-gcc targettools_defconfig
  make HOSTCC=musl-gcc CC=musl-gcc

Changes to CI to build sandbox against musl will follow later.

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>
---
 scripts/common.h              | 2 ++
 scripts/include/linux/types.h | 1 +
 2 files changed, 3 insertions(+)

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..5b0133345bb9 100644
--- a/scripts/include/linux/types.h
+++ b/scripts/include/linux/types.h
@@ -4,6 +4,7 @@
 #include <stdbool.h>
 #include <stddef.h>
 #include <stdint.h>
+#include <fcntl.h>
 
 typedef uint64_t __u64;
 typedef int64_t __s64;
-- 
2.39.5





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux