ubifs-utils: defs.h: Include <fcntl.h>
PATCH 1/5 ubifs-utils: defs.h: Include <fcntl.h>
Include the <fcntl.h> header file to fix the following build error when building with musl:
| In file included from ../git/ubifs-utils/common/defs.h:18, | from ../git/ubifs-utils/common/bitops.c:7: | ../git/ubifs-utils/libubifs/ubifs.h:313:9: error: unknown type name 'loff_t'; did you mean 'off_t'? | 313 | loff_t ui_size; | | ^~~~~~ | | off_t | ../git/ubifs-utils/libubifs/ubifs.h:1341:9: error: unknown type name 'loff_t'; did you mean 'off_t'? | 1341 | loff_t i_size; | | ^~~~~~ | | off_t | ../git/ubifs-utils/libubifs/ubifs.h:1342:9: error: unknown type name 'loff_t'; did you mean 'off_t'? | 1342 | loff_t d_size; | | ^~~~~~ | | off_t | ../git/ubifs-utils/libubifs/ubifs.h:1899:44: error: unknown type name 'loff_t'; did you mean 'off_t'? | 1899 | int deletion, loff_t new_size); | | ^~~~~~ | | off_t | make: *** [Makefile:4822: ubifs-utils/common/mkfs_ubifs-bitops.o] Error 1
--- ubifs-utils/common/defs.h | 1 + 1 file changed, 1 insertion(+)
ubifs-utils/common/defs.h +1 -0
@@ -6,6 +6,7 @@#ifndef __UBIFS_DEFS_H__#define __UBIFS_DEFS_H__ +#include <fcntl.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h>
Signature · 6 lines
2.34.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH 2/5 ubifs-utils: ubifs.h: Include <fcntl.h>
Include the <fcntl.h> header file to fix the following error when building with musl:
| In file included from ../git/ubifs-utils/common/compr.c:42: | ../git/ubifs-utils/libubifs/ubifs.h:313:9: error: unknown type name 'loff_t'; did you mean 'off_t'? | 313 | loff_t ui_size; | | ^~~~~~ | | off_t | ../git/ubifs-utils/libubifs/ubifs.h:1341:9: error: unknown type name 'loff_t'; did you mean 'off_t'? | 1341 | loff_t i_size; | | ^~~~~~ | | off_t | ../git/ubifs-utils/libubifs/ubifs.h:1342:9: error: unknown type name 'loff_t'; did you mean 'off_t'? | 1342 | loff_t d_size; | | ^~~~~~ | | off_t | ../git/ubifs-utils/libubifs/ubifs.h:1899:44: error: unknown type name 'loff_t'; did you mean 'off_t'? | 1899 | int deletion, loff_t new_size); | | ^~~~~~ | | off_t | make: *** [Makefile:4878: ubifs-utils/common/mkfs_ubifs-compr.o] Error 1
--- ubifs-utils/libubifs/ubifs.h | 1 + 1 file changed, 1 insertion(+)
ubifs-utils/libubifs/ubifs.h +1 -0
@@ -11,6 +11,7 @@#ifndef __UBIFS_H__#define __UBIFS_H__ +#include <fcntl.h> #include <string.h> #include "linux_types.h"
Signature · 6 lines
2.34.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH mtd-utils 2/5] ubifs-utils: ubifs.h: Include <fcntl.h>
Quoted 33 lines · Fabio Estevam
Include the <
fcntl.h> header file to fix the following error when building with musl:| In file included from ../git/ubifs-utils/common/compr.c:42: | ../git/ubifs-utils/libubifs/ubifs.h:313:9: error: unknown type name 'loff_t'; did you mean 'off_t'? | 313 | loff_t ui_size; | | ^~~~~~ | | off_t | ../git/ubifs-utils/libubifs/ubifs.h:1341:9: error: unknown type name 'loff_t'; did you mean 'off_t'? | 1341 | loff_t i_size; | | ^~~~~~ | | off_t | ../git/ubifs-utils/libubifs/ubifs.h:1342:9: error: unknown type name 'loff_t'; did you mean 'off_t'? | 1342 | loff_t d_size; | | ^~~~~~ | | off_t | ../git/ubifs-utils/libubifs/ubifs.h:1899:44: error: unknown type name 'loff_t'; did you mean 'off_t'? | 1899 | int deletion, loff_t new_size); | | ^~~~~~ | | off_t | make: *** [Makefile:4878: ubifs-utils/common/mkfs_ubifs-compr.o] Error 1Signed-off-by Fabio Estevam <[email protected]>--- ubifs-utils/libubifs/ubifs.h | 1 + 1 file changed, 1 insertion(+)ubifs-utils/libubifs/ubifs.h +0
-0
ubifs-utils/libubifs/ubifs.h line 17
Quoted 7 lines
ubifs-utils/libubifs/ubifs.h +1
-0@@ -11,6 +11,7 @@#ifndef __UBIFS_H__#define __UBIFS_H__ +#include <fcntl.h> #include <string.h> #include "linux_types.h"
The 'ubifs.h' is included in 'defs.h', so the problem described in first patch can be fixed by this patch?
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH 3/5 ubifs-utils: journal: Include <sys/stat.h>
In reply to Fabio EstevamInclude the <sys/stat.h> header file to fix the following error when building with musl:
| ../git/ubifs-utils/libubifs/journal.c: In function 'ubifs_get_dent_type':
| ../git/ubifs-utils/libubifs/journal.c:414:24: error: 'S_IFMT' undeclared (first use in this function)
| 414 | switch (mode & S_IFMT) {
| | ^~~~~~
| ../git/ubifs-utils/libubifs/journal.c:414:24: note: each undeclared identifier is reported only once for each function it appears in
| ../git/ubifs-utils/libubifs/journal.c:415:14: error: 'S_IFREG' undeclared (first use in this function)
| 415 | case S_IFREG:--- ubifs-utils/libubifs/journal.c | 1 + 1 file changed, 1 insertion(+)
ubifs-utils/libubifs/journal.c +1 -0
@@ -46,6 +46,7 @@* all the nodes. */ +#include <sys/stat.h> #include "bitops.h" #include "kmem.h" #include "ubifs.h"
Signature · 6 lines
2.34.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH 4/5 configure.ac: Add a check for execinfo and backtrace
In reply to Fabio Estevammusl relies on an extenal execinfo library to provide backtrace functionality.
Add support for it.
| /work/festevam/oe/poky/build/tmp/work/core2-64-poky-linux-musl/mtd-utils/2.3.0/recipe-sysroot-native/usr/bin/x86_64-poky-linux-musl/../../libexec/x86_64-poky-linux-musl/gcc/x86_64-poky-linux-musl/14.2.0/ld: ubifs-utils/libubifs/mkfs_ubifs-io.o: in function `dump_stack':
| /usr/src/debug/mtd-utils/2.3.0/ubifs-utils/common/defs.h:71:(.text+0x25): undefined reference to `backtrace'
....
| collect2: error: ld returned 1 exit status
| make: *** [Makefile:2959: mkfs.ubifs] Error 1
--- configure.ac | 1 + 1 file changed, 1 insertion(+)
configure.ac +1 -0
@@ -238,6 +238,7 @@ if test "x$need_cmocka" = "xyes"; then PKG_CHECK_MODULES(CMOCKA, [cmocka], [], [cmocka_missing="yes"]) fi +AC_CHECK_LIB([execinfo], [backtrace]) AC_CHECK_HEADERS([execinfo.h]) ##### produce summary on dependencies #####
Signature · 6 lines
2.34.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH mtd-utils 4/5] configure.ac: Add a check for execinfo and backtrace
Quoted 21 lines · Fabio Estevam
musl relies on an extenal execinfo library to provide backtrace functionality.
Add support for it.
| /work/festevam/oe/poky/build/tmp/work/core2-64-poky-linux-musl/mtd-utils/2.3.0/recipe-sysroot-native/usr/bin/x86_64-poky-linux-musl/../../libexec/x86_64-poky-linux-musl/gcc/x86_64-poky-linux-musl/14.2.0/ld:
ubifs-utils/libubifs/mkfs_ubifs-io.o: in function `dump_stack':
| /usr/src/debug/mtd-utils/2.3.0/ubifs-utils/common/defs.h:71:(.text+0x25): undefined reference to `backtrace'
....
| collect2: error: ld returned 1 exit status
| make: *** [Makefile:2959: mkfs.ubifs] Error 1Signed-off-by Fabio Estevam <[email protected]>--- configure.ac | 1 + 1 file changed, 1 insertion(+)configure.ac +0
-0
configure.ac if test "x$need_cmocka" = "xyes"; then · line 242
Quoted 5 lines
configure.ac +1
-0@@ -238,6 +238,7 @@ if test "x$need_cmocka" = "xyes"; then PKG_CHECK_MODULES(CMOCKA, [cmocka], [], [cmocka_missing="yes"]) fi +AC_CHECK_LIB([execinfo], [backtrace]) AC_CHECK_HEADERS([execinfo.h])
Hi Fabio,
I'm not sure which lib is depended for execinfo by musl. We don't depend any libs for other common compilers, otherwise we could get following messgags for doing configure:
checking for sys/random.h... yes
checking for backtrace in -lexecinfo... no # In fact backtrace is supported, but the message tells us not.
checking execinfo.h usability... yes
checking execinfo.h presence... yes
configure.ac if test "x$need_cmocka" = "xyes"; then · line 244
Quoted 3 lines
configure.ac +0
-0##### produce summary on dependencies #####
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH mtd-utils 4/5] configure.ac: Add a check for execinfo and backtrace
Hi Zhihao,
Thanks for your review.
Quoted 4 lines · Zhihao Cheng
Hi Fabio,
I'm not sure which lib is depended for execinfo by musl. We don't depend any libs for other common compilers, otherwise we could get following messgags for doing configure:
The musl library doe not provide execinfo.
It relies on an external execinfo library to provide backtrace support.
Quoted 3 lines
checking for
sys/random.h... yes
checking for backtrace in -lexecinfo... no # In fact backtrace is supported, but the message tells us not.
That message is OK. In this case, the backtrace does not come from the external libexecinfo.
It comes from the C library. It does not mean that backtrace is not supported. It only means that
backtrace does not come from the external libexecinfo.
With musl, the following is seen:
checking for backtrace in -lexecinfo... yes
This means that backtrace comes from the external libexecinfo.
I will address your other comments and submit a v2 soon.
Thanks
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH mtd-utils 4/5] configure.ac: Add a check for execinfo and backtrace
Quoted 24 lines · Fabio Estevam
Hi Zhihao,
Thanks for your review.
Quoted 4 lines · Zhihao Cheng
Hi Fabio,
I'm not sure which lib is depended for execinfo by musl. We don't depend any libs for other common compilers, otherwise we could get following messgags for doing configure:The musl library doe not provide execinfo.
It relies on an external execinfo library to provide backtrace support.Quoted 3 lines
checking for
sys/random.h... yes
checking for backtrace in -lexecinfo... no # In fact backtrace is supported, but the message tells us not.That message is OK. In this case, the backtrace does not come from the external libexecinfo.
It comes from the C library. It does not mean that backtrace is not supported. It only means that
backtrace does not come from the external libexecinfo.
Quoted 5 lines
With musl, the following is seen:
checking for backtrace in -lexecinfo... yes
This means that backtrace comes from the external libexecinfo.
maybe check for backtrace function in libc first and if not found then try libexecinfo check.
Quoted 4 lines
I will address your other comments and submit a v2 soon.
Thanks
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH mtd-utils 4/5] configure.ac: Add a check for execinfo and backtrace
Hi Khem,
Quoted 2 lines · Khem Raj
maybe check for backtrace function in libc first and if not found then try libexecinfo check.
I implemented your suggestion like this:
configure.ac +6 -0
@@ -238,6 +238,17 @@ if test "x$need_cmocka" = "xyes"; then PKG_CHECK_MODULES(CMOCKA, [cmocka], [], [cmocka_missing="yes"]) fi +AC_CHECK_FUNC([backtrace], [have_backtrace=yes], [have_backtrace=no]) + +if test "x$have_backtrace" = "xno"; then + AC_CHECK_LIB([execinfo], [backtrace], + [LIBS="$LIBS -lexecinfo" + AC_DEFINE([HAVE_BACKTRACE], [1], [backtrace is available via
libexecinfo])],
+ [AC_MSG_WARN([backtrace support not found])])
+else
+ AC_DEFINE([HAVE_BACKTRACE], [1], [backtrace is available via libc])
+fi
+
AC_CHECK_HEADERS([execinfo.h])
And tested in two cases:
With glibc:
checking for backtrace... yes
With musl:
checking for backtrace... no
checking for backtrace in -lexecinfo... yes
Does this look good?
Thanks
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH 5/5 ubifs-utils: extract_files: Define XATTR_LIST_MAX locally
In reply to Fabio Estevammusl does not define XATTR_LIST_MAX.
Define it locally to fix the following build error when building with musl:
| ../git/ubifs-utils/fsck.ubifs/extract_files.c: In function 'parse_ino_node':
| ../git/ubifs-utils/fsck.ubifs/extract_files.c:144:47: error: 'XATTR_LIST_MAX' undeclared (first use in this function)
| 144 | if (ino_node->xnms + ino_node->xcnt > XATTR_LIST_MAX) {
| | ^~~~~~~~~~~~~~
| ../git/ubifs-utils/fsck.ubifs/extract_files.c:144:47: note: each undeclared identifier is reported only once for each function it appears in
| make: *** [Makefile:4374: ubifs-utils/fsck.ubifs/fsck_ubifs-extract_files.o] Error 1--- ubifs-utils/fsck.ubifs/extract_files.c | 4 ++++ 1 file changed, 4 insertions(+)
ubifs-utils/fsck.ubifs/extract_files.c +4 -0
@@ -21,6 +21,10 @@#include "misc.h" #include "fsck.ubifs.h" +#ifndef XATTR_LIST_MAX +#define XATTR_LIST_MAX 65536 +#endif +static void parse_node_header (int lnum,int offs,int len,unsigned long long sqnum,struct scanned_node *header)
Signature · 6 lines
2.34.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
Re: [PATCH mtd-utils 5/5] ubifs-utils: extract_files: Define XATTR_LIST_MAX locally
Quoted 21 lines · Fabio Estevam
musl does not define
XATTR_LIST_MAX.Define it locally to fix the following build error when building with musl:
| ../git/ubifs-utils/fsck.ubifs/extract_files.c: In function 'parse_ino_node': | ../git/ubifs-utils/fsck.ubifs/extract_files.c:144:47: error: 'XATTR_LIST_MAX' undeclared (first use in this function) | 144 | if (ino_node->xnms + ino_node->xcnt > XATTR_LIST_MAX) { | | ^~~~~~~~~~~~~~ | ../git/ubifs-utils/fsck.ubifs/extract_files.c:144:47: note: each undeclared identifier is reported only once for each function it appears in | make: *** [Makefile:4374: ubifs-utils/fsck.ubifs/fsck_ubifs-extract_files.o] Error 1Signed-off-by Fabio Estevam <[email protected]>--- ubifs-utils/fsck.ubifs/extract_files.c | 4 ++++ 1 file changed, 4 insertions(+)ubifs-utils/fsck.ubifs/extract_files.c +0
-0
ubifs-utils/fsck.ubifs/extract_files.c line 23
Quoted 3 lines
ubifs-utils/fsck.ubifs/extract_files.c +0
-0@@ -21,6 +21,10 @@#include "misc.h" #include "fsck.ubifs.h"
How about adding the new header file '<linux/limits.h>'?
ubifs-utils/fsck.ubifs/extract_files.c line 30
Quoted 8 lines
ubifs-utils/fsck.ubifs/extract_files.c +4
-0+#ifndef XATTR_LIST_MAX +#define XATTR_LIST_MAX 65536 +#endif +static void parse_node_header (int lnum,int offs,int len,unsigned long long sqnum,struct scanned_node *header)
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/