diff mbox series

[uclibc-ng-devel] Re: uClibc-ng build failure with GCC14 for arc

Message ID ZkRXpTGqj0Qm70hH@octofox.metropolis
State Accepted
Headers show
Series [uclibc-ng-devel] Re: uClibc-ng build failure with GCC14 for arc | expand

Commit Message

Max Filippov May 15, 2024, 6:38 a.m. UTC
Hi Chris,

On Wed, May 15, 2024 at 09:02:27AM +1200, Chris Packham wrote:
> (Max, Waldemar sorry for the duplicate. My subscription to the list
> seems to have been stuck in pending for ages so I grabbed your
> addresses from the git repo)
> 
> I'm in the process of adding GCC14 to crosstool-ng. I've grabbed the
> latest uClibc-ng tarball and the commits from master since the
> release. I'm hitting the following build failure with an
> arc-multilib-linux-uclibc configuration.
> 
> [ALL  ]      libc/sysdeps/linux/common/fstat64.c: In function 'fstat64':
> [ERROR]      libc/sysdeps/linux/common/fstat64.c:33:38: error: passing
> argument 2 of '__syscall_fstat64' from incompatible pointer type
> [-Wincompatible-pointer-types]
> [ALL  ]         33 |         return __syscall_fstat64(fd, buf);
> [ALL  ]            |                                      ^~~
> [ALL  ]            |                                      |
> [ALL  ]            |                                      struct stat64 *
> [ALL  ]      In file included from ./include/sys/syscall.h:34,
> [ALL  ]                       from libc/sysdeps/linux/common/fstat64.c:10:
> [ALL  ]      libc/sysdeps/linux/common/fstat64.c:18:72: note: expected
> 'struct stat *' but argument is of type 'struct stat64 *'
> [ALL  ]         18 |                                  int, filedes,
> struct kernel_stat64 *, buf)
> [ALL  ]            |
> ~~~~~~~~~~~~~~~~~~~~~~~~^~~
> [ALL  ]      ./include/bits/syscalls-common.h:82:43: note: in
> definition of macro 'C_DECL_ARGS_1'
> [ALL  ]         82 | #define C_DECL_ARGS_1(t, v)             t v
> [ALL  ]            |                                           ^
> [ALL  ]      ./include/bits/syscalls-common.h:98:11: note: in
> expansion of macro 'C_DECL_ARGS_2'
> [ALL  ]         98 | type name(C_DECL_ARGS_##nargs(args)) {
>                             |           ^~~~~~~~~~~~
> [ALL  ]      ./include/bits/syscalls-common.h:141:41: note: in
> expansion of macro 'SYSCALL_FUNC'
> [ALL  ]        141 | #define _syscall2(args...)
> SYSCALL_FUNC(2, args)
> [ALL  ]            |                                         ^~~~~~~~~~~~
> [ALL  ]      libc/sysdeps/linux/common/fstat64.c:17:24: note: in
> expansion of macro '_syscall2'
> [ALL  ]         17 | static __always_inline _syscall2(int, __syscall_fstat64,
> [ALL  ]            |                        ^~~~~~~~~
> [ERROR]      make[1]: *** [Makerules:373:
> libc/sysdeps/linux/common/fstat64.os] Error 1
> [ALL  ]      make[1]: Leaving directory
> '/home/ctng/crosstool-ng/.build/arc-multilib-linux-uclibc/build/build-libc/multilib'
> 
> It looks like maybe arc should be defining
> __ARCH_HAS_DEPRECATED_SYSCALLS__ or perhaps declaring kernel_stat64
> differently. Any advice would be much appreciated.

Looking at how the code is written in the failing #if condition block of the
fstat64.c I'd think that struct kernel_stat64 should be the same as the struct
stat64. The history of libc/sysdeps/linux/common-generic/bits/kernel_stat.h
suggests that that was so until the commit
  74ca8d6f5d2e ("remove UCLIBC_HAS_LFS")
removed that definition. It seems to me that that commit removed the wrong
leg of the condition, and that the attached change (completely untested)
should fix it.

Comments

Chris Packham May 15, 2024, 7:36 a.m. UTC | #1
Hi Max,

On Wed, May 15, 2024 at 6:38 PM Max Filippov <jcmvbkbc@gmail.com> wrote:
>
> Hi Chris,
>
> On Wed, May 15, 2024 at 09:02:27AM +1200, Chris Packham wrote:
> > (Max, Waldemar sorry for the duplicate. My subscription to the list
> > seems to have been stuck in pending for ages so I grabbed your
> > addresses from the git repo)
> >
> > I'm in the process of adding GCC14 to crosstool-ng. I've grabbed the
> > latest uClibc-ng tarball and the commits from master since the
> > release. I'm hitting the following build failure with an
> > arc-multilib-linux-uclibc configuration.
> >
> > [ALL  ]      libc/sysdeps/linux/common/fstat64.c: In function 'fstat64':
> > [ERROR]      libc/sysdeps/linux/common/fstat64.c:33:38: error: passing
> > argument 2 of '__syscall_fstat64' from incompatible pointer type
> > [-Wincompatible-pointer-types]
> > [ALL  ]         33 |         return __syscall_fstat64(fd, buf);
> > [ALL  ]            |                                      ^~~
> > [ALL  ]            |                                      |
> > [ALL  ]            |                                      struct stat64 *
> > [ALL  ]      In file included from ./include/sys/syscall.h:34,
> > [ALL  ]                       from libc/sysdeps/linux/common/fstat64.c:10:
> > [ALL  ]      libc/sysdeps/linux/common/fstat64.c:18:72: note: expected
> > 'struct stat *' but argument is of type 'struct stat64 *'
> > [ALL  ]         18 |                                  int, filedes,
> > struct kernel_stat64 *, buf)
> > [ALL  ]            |
> > ~~~~~~~~~~~~~~~~~~~~~~~~^~~
> > [ALL  ]      ./include/bits/syscalls-common.h:82:43: note: in
> > definition of macro 'C_DECL_ARGS_1'
> > [ALL  ]         82 | #define C_DECL_ARGS_1(t, v)             t v
> > [ALL  ]            |                                           ^
> > [ALL  ]      ./include/bits/syscalls-common.h:98:11: note: in
> > expansion of macro 'C_DECL_ARGS_2'
> > [ALL  ]         98 | type name(C_DECL_ARGS_##nargs(args)) {
> >                             |           ^~~~~~~~~~~~
> > [ALL  ]      ./include/bits/syscalls-common.h:141:41: note: in
> > expansion of macro 'SYSCALL_FUNC'
> > [ALL  ]        141 | #define _syscall2(args...)
> > SYSCALL_FUNC(2, args)
> > [ALL  ]            |                                         ^~~~~~~~~~~~
> > [ALL  ]      libc/sysdeps/linux/common/fstat64.c:17:24: note: in
> > expansion of macro '_syscall2'
> > [ALL  ]         17 | static __always_inline _syscall2(int, __syscall_fstat64,
> > [ALL  ]            |                        ^~~~~~~~~
> > [ERROR]      make[1]: *** [Makerules:373:
> > libc/sysdeps/linux/common/fstat64.os] Error 1
> > [ALL  ]      make[1]: Leaving directory
> > '/home/ctng/crosstool-ng/.build/arc-multilib-linux-uclibc/build/build-libc/multilib'
> >
> > It looks like maybe arc should be defining
> > __ARCH_HAS_DEPRECATED_SYSCALLS__ or perhaps declaring kernel_stat64
> > differently. Any advice would be much appreciated.
>
> Looking at how the code is written in the failing #if condition block of the
> fstat64.c I'd think that struct kernel_stat64 should be the same as the struct
> stat64. The history of libc/sysdeps/linux/common-generic/bits/kernel_stat.h
> suggests that that was so until the commit
>   74ca8d6f5d2e ("remove UCLIBC_HAS_LFS")
> removed that definition. It seems to me that that commit removed the wrong
> leg of the condition, and that the attached change (completely untested)
> should fix it.

Yes, that seems to do the trick.

Tested-by: Chris Packham <judge.packham@gmail.com>
Waldemar Brodkorb May 15, 2024, 8:23 a.m. UTC | #2
Hi Max,
Max Filippov wrote,

> Hi Chris,
> 
> On Wed, May 15, 2024 at 09:02:27AM +1200, Chris Packham wrote:
> > (Max, Waldemar sorry for the duplicate. My subscription to the list
> > seems to have been stuck in pending for ages so I grabbed your
> > addresses from the git repo)
> > 
> > I'm in the process of adding GCC14 to crosstool-ng. I've grabbed the
> > latest uClibc-ng tarball and the commits from master since the
> > release. I'm hitting the following build failure with an
> > arc-multilib-linux-uclibc configuration.
> > 
> > [ALL  ]      libc/sysdeps/linux/common/fstat64.c: In function 'fstat64':
> > [ERROR]      libc/sysdeps/linux/common/fstat64.c:33:38: error: passing
> > argument 2 of '__syscall_fstat64' from incompatible pointer type
> > [-Wincompatible-pointer-types]
> > [ALL  ]         33 |         return __syscall_fstat64(fd, buf);
> > [ALL  ]            |                                      ^~~
> > [ALL  ]            |                                      |
> > [ALL  ]            |                                      struct stat64 *
> > [ALL  ]      In file included from ./include/sys/syscall.h:34,
> > [ALL  ]                       from libc/sysdeps/linux/common/fstat64.c:10:
> > [ALL  ]      libc/sysdeps/linux/common/fstat64.c:18:72: note: expected
> > 'struct stat *' but argument is of type 'struct stat64 *'
> > [ALL  ]         18 |                                  int, filedes,
> > struct kernel_stat64 *, buf)
> > [ALL  ]            |
> > ~~~~~~~~~~~~~~~~~~~~~~~~^~~
> > [ALL  ]      ./include/bits/syscalls-common.h:82:43: note: in
> > definition of macro 'C_DECL_ARGS_1'
> > [ALL  ]         82 | #define C_DECL_ARGS_1(t, v)             t v
> > [ALL  ]            |                                           ^
> > [ALL  ]      ./include/bits/syscalls-common.h:98:11: note: in
> > expansion of macro 'C_DECL_ARGS_2'
> > [ALL  ]         98 | type name(C_DECL_ARGS_##nargs(args)) {
> >                             |           ^~~~~~~~~~~~
> > [ALL  ]      ./include/bits/syscalls-common.h:141:41: note: in
> > expansion of macro 'SYSCALL_FUNC'
> > [ALL  ]        141 | #define _syscall2(args...)
> > SYSCALL_FUNC(2, args)
> > [ALL  ]            |                                         ^~~~~~~~~~~~
> > [ALL  ]      libc/sysdeps/linux/common/fstat64.c:17:24: note: in
> > expansion of macro '_syscall2'
> > [ALL  ]         17 | static __always_inline _syscall2(int, __syscall_fstat64,
> > [ALL  ]            |                        ^~~~~~~~~
> > [ERROR]      make[1]: *** [Makerules:373:
> > libc/sysdeps/linux/common/fstat64.os] Error 1
> > [ALL  ]      make[1]: Leaving directory
> > '/home/ctng/crosstool-ng/.build/arc-multilib-linux-uclibc/build/build-libc/multilib'
> > 
> > It looks like maybe arc should be defining
> > __ARCH_HAS_DEPRECATED_SYSCALLS__ or perhaps declaring kernel_stat64
> > differently. Any advice would be much appreciated.
> 
> Looking at how the code is written in the failing #if condition block of the
> fstat64.c I'd think that struct kernel_stat64 should be the same as the struct
> stat64. The history of libc/sysdeps/linux/common-generic/bits/kernel_stat.h
> suggests that that was so until the commit
>   74ca8d6f5d2e ("remove UCLIBC_HAS_LFS")
> removed that definition. It seems to me that that commit removed the wrong
> leg of the condition, and that the attached change (completely untested)
> should fix it.

Thanks for finding a solution for this ugly bug.

Commited and pushed,
 best regards
  Waldemar
Waldemar Brodkorb May 15, 2024, 8:25 a.m. UTC | #3
Hi Chris,
Chris Packham wrote,

> Hi Max,
> 
> On Wed, May 15, 2024 at 6:38 PM Max Filippov <jcmvbkbc@gmail.com> wrote:
> >
> > Hi Chris,
> >
> > On Wed, May 15, 2024 at 09:02:27AM +1200, Chris Packham wrote:
> > > (Max, Waldemar sorry for the duplicate. My subscription to the list
> > > seems to have been stuck in pending for ages so I grabbed your
> > > addresses from the git repo)
> > >
> > > I'm in the process of adding GCC14 to crosstool-ng. I've grabbed the
> > > latest uClibc-ng tarball and the commits from master since the
> > > release. I'm hitting the following build failure with an
> > > arc-multilib-linux-uclibc configuration.
> > >
> > > [ALL  ]      libc/sysdeps/linux/common/fstat64.c: In function 'fstat64':
> > > [ERROR]      libc/sysdeps/linux/common/fstat64.c:33:38: error: passing
> > > argument 2 of '__syscall_fstat64' from incompatible pointer type
> > > [-Wincompatible-pointer-types]
> > > [ALL  ]         33 |         return __syscall_fstat64(fd, buf);
> > > [ALL  ]            |                                      ^~~
> > > [ALL  ]            |                                      |
> > > [ALL  ]            |                                      struct stat64 *
> > > [ALL  ]      In file included from ./include/sys/syscall.h:34,
> > > [ALL  ]                       from libc/sysdeps/linux/common/fstat64.c:10:
> > > [ALL  ]      libc/sysdeps/linux/common/fstat64.c:18:72: note: expected
> > > 'struct stat *' but argument is of type 'struct stat64 *'
> > > [ALL  ]         18 |                                  int, filedes,
> > > struct kernel_stat64 *, buf)
> > > [ALL  ]            |
> > > ~~~~~~~~~~~~~~~~~~~~~~~~^~~
> > > [ALL  ]      ./include/bits/syscalls-common.h:82:43: note: in
> > > definition of macro 'C_DECL_ARGS_1'
> > > [ALL  ]         82 | #define C_DECL_ARGS_1(t, v)             t v
> > > [ALL  ]            |                                           ^
> > > [ALL  ]      ./include/bits/syscalls-common.h:98:11: note: in
> > > expansion of macro 'C_DECL_ARGS_2'
> > > [ALL  ]         98 | type name(C_DECL_ARGS_##nargs(args)) {
> > >                             |           ^~~~~~~~~~~~
> > > [ALL  ]      ./include/bits/syscalls-common.h:141:41: note: in
> > > expansion of macro 'SYSCALL_FUNC'
> > > [ALL  ]        141 | #define _syscall2(args...)
> > > SYSCALL_FUNC(2, args)
> > > [ALL  ]            |                                         ^~~~~~~~~~~~
> > > [ALL  ]      libc/sysdeps/linux/common/fstat64.c:17:24: note: in
> > > expansion of macro '_syscall2'
> > > [ALL  ]         17 | static __always_inline _syscall2(int, __syscall_fstat64,
> > > [ALL  ]            |                        ^~~~~~~~~
> > > [ERROR]      make[1]: *** [Makerules:373:
> > > libc/sysdeps/linux/common/fstat64.os] Error 1
> > > [ALL  ]      make[1]: Leaving directory
> > > '/home/ctng/crosstool-ng/.build/arc-multilib-linux-uclibc/build/build-libc/multilib'
> > >
> > > It looks like maybe arc should be defining
> > > __ARCH_HAS_DEPRECATED_SYSCALLS__ or perhaps declaring kernel_stat64
> > > differently. Any advice would be much appreciated.
> >
> > Looking at how the code is written in the failing #if condition block of the
> > fstat64.c I'd think that struct kernel_stat64 should be the same as the struct
> > stat64. The history of libc/sysdeps/linux/common-generic/bits/kernel_stat.h
> > suggests that that was so until the commit
> >   74ca8d6f5d2e ("remove UCLIBC_HAS_LFS")
> > removed that definition. It seems to me that that commit removed the wrong
> > leg of the condition, and that the attached change (completely untested)
> > should fix it.
> 
> Yes, that seems to do the trick.

Thanks for testing. BTW, you haven't found this bug for when you
have had enabled time64 support. Shouldn't crosstool-ng enable
time64 by default?

Best regards
 Waldemar
Chris Packham May 15, 2024, 8:45 a.m. UTC | #4
On Wed, May 15, 2024 at 8:25 PM Waldemar Brodkorb <wbx@openadk.org> wrote:
>
> Hi Chris,
> Chris Packham wrote,
>
> > Hi Max,
> >
> > On Wed, May 15, 2024 at 6:38 PM Max Filippov <jcmvbkbc@gmail.com> wrote:
> > >
> > > Hi Chris,
> > >
> > > On Wed, May 15, 2024 at 09:02:27AM +1200, Chris Packham wrote:
> > > > (Max, Waldemar sorry for the duplicate. My subscription to the list
> > > > seems to have been stuck in pending for ages so I grabbed your
> > > > addresses from the git repo)
> > > >
> > > > I'm in the process of adding GCC14 to crosstool-ng. I've grabbed the
> > > > latest uClibc-ng tarball and the commits from master since the
> > > > release. I'm hitting the following build failure with an
> > > > arc-multilib-linux-uclibc configuration.
> > > >
> > > > [ALL  ]      libc/sysdeps/linux/common/fstat64.c: In function 'fstat64':
> > > > [ERROR]      libc/sysdeps/linux/common/fstat64.c:33:38: error: passing
> > > > argument 2 of '__syscall_fstat64' from incompatible pointer type
> > > > [-Wincompatible-pointer-types]
> > > > [ALL  ]         33 |         return __syscall_fstat64(fd, buf);
> > > > [ALL  ]            |                                      ^~~
> > > > [ALL  ]            |                                      |
> > > > [ALL  ]            |                                      struct stat64 *
> > > > [ALL  ]      In file included from ./include/sys/syscall.h:34,
> > > > [ALL  ]                       from libc/sysdeps/linux/common/fstat64.c:10:
> > > > [ALL  ]      libc/sysdeps/linux/common/fstat64.c:18:72: note: expected
> > > > 'struct stat *' but argument is of type 'struct stat64 *'
> > > > [ALL  ]         18 |                                  int, filedes,
> > > > struct kernel_stat64 *, buf)
> > > > [ALL  ]            |
> > > > ~~~~~~~~~~~~~~~~~~~~~~~~^~~
> > > > [ALL  ]      ./include/bits/syscalls-common.h:82:43: note: in
> > > > definition of macro 'C_DECL_ARGS_1'
> > > > [ALL  ]         82 | #define C_DECL_ARGS_1(t, v)             t v
> > > > [ALL  ]            |                                           ^
> > > > [ALL  ]      ./include/bits/syscalls-common.h:98:11: note: in
> > > > expansion of macro 'C_DECL_ARGS_2'
> > > > [ALL  ]         98 | type name(C_DECL_ARGS_##nargs(args)) {
> > > >                             |           ^~~~~~~~~~~~
> > > > [ALL  ]      ./include/bits/syscalls-common.h:141:41: note: in
> > > > expansion of macro 'SYSCALL_FUNC'
> > > > [ALL  ]        141 | #define _syscall2(args...)
> > > > SYSCALL_FUNC(2, args)
> > > > [ALL  ]            |                                         ^~~~~~~~~~~~
> > > > [ALL  ]      libc/sysdeps/linux/common/fstat64.c:17:24: note: in
> > > > expansion of macro '_syscall2'
> > > > [ALL  ]         17 | static __always_inline _syscall2(int, __syscall_fstat64,
> > > > [ALL  ]            |                        ^~~~~~~~~
> > > > [ERROR]      make[1]: *** [Makerules:373:
> > > > libc/sysdeps/linux/common/fstat64.os] Error 1
> > > > [ALL  ]      make[1]: Leaving directory
> > > > '/home/ctng/crosstool-ng/.build/arc-multilib-linux-uclibc/build/build-libc/multilib'
> > > >
> > > > It looks like maybe arc should be defining
> > > > __ARCH_HAS_DEPRECATED_SYSCALLS__ or perhaps declaring kernel_stat64
> > > > differently. Any advice would be much appreciated.
> > >
> > > Looking at how the code is written in the failing #if condition block of the
> > > fstat64.c I'd think that struct kernel_stat64 should be the same as the struct
> > > stat64. The history of libc/sysdeps/linux/common-generic/bits/kernel_stat.h
> > > suggests that that was so until the commit
> > >   74ca8d6f5d2e ("remove UCLIBC_HAS_LFS")
> > > removed that definition. It seems to me that that commit removed the wrong
> > > leg of the condition, and that the attached change (completely untested)
> > > should fix it.
> >
> > Yes, that seems to do the trick.
>
> Thanks for testing. BTW, you haven't found this bug for when you
> have had enabled time64 support. Shouldn't crosstool-ng enable
> time64 by default?

We could. I don't think anyone has touched the config snippet we embed
in some time.

I see UCLIBC_USE_TIME64 is default n in extra/Configs/Config.in so
we'd be deviating from the uClibc-ng default.
diff mbox series

Patch

From c73701dae0ca5a679e67945a6da4d1c395c2e2aa Mon Sep 17 00:00:00 2001
From: Max Filippov <jcmvbkbc@gmail.com>
Date: Tue, 14 May 2024 23:18:56 -0700
Subject: [PATCH] fix kernel_stat64 definition

The commit 74ca8d6f5d2e ("remove UCLIBC_HAS_LFS") removed conditional
compilation dependent on __UCLIBC_HAS_LFS__, assuming it to be always
defined, but removed the wrong branch in the definition of
kernel_stat64.
Fix kernel_stat64 definition to be stat64.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 libc/sysdeps/linux/common-generic/bits/kernel_stat.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/sysdeps/linux/common-generic/bits/kernel_stat.h b/libc/sysdeps/linux/common-generic/bits/kernel_stat.h
index 7a97bb4d7090..e874a4a9f8ed 100644
--- a/libc/sysdeps/linux/common-generic/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/common-generic/bits/kernel_stat.h
@@ -18,7 +18,7 @@ 
  * However that requires more #ifndef in relevant wrappers,
  * further uglifying them
  */
-#define kernel_stat64	stat
+#define kernel_stat64	stat64
 
 #endif	/*  _BITS_STAT_STRUCT_H */
 
-- 
2.39.2