Skip to contentSkip to conversation

f2fs-tools: Fix build with gcc-15

PATCH In review Nguyen Dat Tho 2 participants 2 messages Apr 3, 2025 – Apr 4, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 f2fs-tools: Fix build with gcc-15

From: Nguyen Dat Tho <[email protected]>

To fix error: https://errors.yoctoproject.org/Errors/Details/850170/

---
 ...-f2fs_fs.h-fix-std-c23-build-failure.patch | 42 +++++++++++++++++++
 .../f2fs-tools/f2fs-tools_1.16.0.bb           |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools/0001-include-f2fs_fs.h-fix-std-c23-build-failure.patch
meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools/0001-include-f2fs_fs.h-fix-std-c23-build-failure.patch new file +42 -0
new file mode 100644
index 0000000000..7b81b93715
@@ -0,0 +1,42 @@
+From 4a66e47406a9c651ddba035e5f6e8b1f2cc90a40 Mon Sep 17 00:00:00 2001
+From: Nguyen Dat Tho <[email protected]>
+Date: Thu, 3 Apr 2025 12:37:26 +0900
+Subject: [PATCH] include/f2fs_fs.h: fix -std=c23 build failure
+
+gcc-15 switched to -std=c23 by default:
+
+    https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212
+
+As a result `f2fs-tools` fails as below, so only typedef u8 bool
+for __STDC_VERSION__ <= 201710L (C17)
+
+In file included from ../../git/lib/libf2fs_zoned.c:11:
+../../git/include/f2fs_fs.h:107:25: error: two or more data types in declaration specifiers
+  107 | typedef u8              bool;
+      |                         ^~~~
+../../git/include/f2fs_fs.h:107:1: warning: useless type name in empty declaration
+  107 | typedef u8              bool;
+
+Signed-off-by: Nguyen Dat Tho <[email protected]>
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-f2fs-devel/[email protected]/T/#u]
+---
+ include/f2fs_fs.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
+index f890634..1be77f1 100644
+--- a/include/f2fs_fs.h
++++ b/include/f2fs_fs.h
+@@ -103,7 +103,7 @@ typedef uint16_t	u16;
+ typedef uint8_t		u8;
+ typedef u32		block_t;
+ typedef u32		nid_t;
+-#ifndef bool
++#if defined __STDC__ && defined __STDC_VERSION__ && __STDC_VERSION__ <= 201710L
+ typedef u8		bool;
+ #endif
+ typedef unsigned long	pgoff_t;
+-- 
+2.34.1
+
meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools_1.16.0.bb +1 -0
index 997fa1240a..48f20b7220 100644
@@ -9,6 +9,7 @@ DEPENDS = "util-linux"
 
 SRCREV = "06c027abc6153c4a97cba5317844e8dcaaee3cf7"
 SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git;branch=master \
+           file://0001-include-f2fs_fs.h-fix-std-c23-build-failure.patch \
            file://0002-f2fs_io-Define-_FILE_OFFSET_BITS-64.patch \
            "
 UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
Signature · 1 line
2.34.1
#1 lore raw

while it might fix gcc-15, it is regressing gcc-14 build see -
https://autobuilder.yoctoproject.org/valkyrie/#/builders/81/builds/539/steps/14/logs/stdio

Quoted 84 lines · Nguyen Dat Tho via lists.openembedded.org

From: Nguyen Dat Tho <[email protected]>

To fix error: https://errors.yoctoproject.org/Errors/Details/850170/

---
 ...-f2fs_fs.h-fix-std-c23-build-failure.patch | 42 +++++++++++++++++++
 .../f2fs-tools/f2fs-tools_1.16.0.bb           |  1 +
 2 files changed, 43 insertions(+)
 create mode 100644 meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools/0001-include-f2fs_fs.h-fix-std-c23-build-failure.patch
meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools/0001-include-f2fs_fs.h-fix-std-c23-build-failure.patch new file +42 -0
new file mode 100644
index 0000000000..7b81b93715
@@ -0,0 +1,42 @@
+From 4a66e47406a9c651ddba035e5f6e8b1f2cc90a40 Mon Sep 17 00:00:00 2001
+From: Nguyen Dat Tho <[email protected]>
+Date: Thu, 3 Apr 2025 12:37:26 +0900
+Subject: [PATCH] include/f2fs_fs.h: fix -std=c23 build failure
+
+gcc-15 switched to -std=c23 by default:
+
+    https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212
+
+As a result `f2fs-tools` fails as below, so only typedef u8 bool
+for __STDC_VERSION__ <= 201710L (C17)
+
+In file included from ../../git/lib/libf2fs_zoned.c:11:
+../../git/include/f2fs_fs.h:107:25: error: two or more data types in declaration specifiers
+  107 | typedef u8              bool;
+      |                         ^~~~
+../../git/include/f2fs_fs.h:107:1: warning: useless type name in empty declaration
+  107 | typedef u8              bool;
+
+Signed-off-by: Nguyen Dat Tho <[email protected]>
+
+Upstream-Status: Submitted [https://lore.kernel.org/linux-f2fs-devel/[email protected]/T/#u]
+---
+ include/f2fs_fs.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/f2fs_fs.h b/include/f2fs_fs.h
+index f890634..1be77f1 100644
+--- a/include/f2fs_fs.h
++++ b/include/f2fs_fs.h
+@@ -103,7 +103,7 @@ typedef uint16_t   u16;
+ typedef uint8_t               u8;
+ typedef u32           block_t;
+ typedef u32           nid_t;
+-#ifndef bool
++#if defined __STDC__ && defined __STDC_VERSION__ && __STDC_VERSION__ <= 201710L
+ typedef u8            bool;
+ #endif
+ typedef unsigned long pgoff_t;
+--
+2.34.1
+
meta-filesystems/recipes-utils/f2fs-tools/f2fs-tools_1.16.0.bb +1 -1
index 997fa1240a..48f20b7220 100644
@@ -9,6 +9,7 @@ DEPENDS = "util-linux"
 
 SRCREV = "06c027abc6153c4a97cba5317844e8dcaaee3cf7"
 SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git;branch=master \
+           file://0001-include-f2fs_fs.h-fix-std-c23-build-failure.patch \
            file://0002-f2fs_io-Define-_FILE_OFFSET_BITS-64.patch \
            "
 UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#116535): https://lists.openembedded.org/g/openembedded-devel/message/116535
Mute This Topic: https://lists.openembedded.org/mt/112061986/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-