There is a conflict between the struct user defined in Redis server, and the one defined in <sys/user.h>, which prevents to build Redis 6 against uclibc:

    CC server.o
In file included from server.c:30:0:
server.h:735:16: error: redefinition of ‘struct user’
 typedef struct user {
                ^
In file included from /home/titou/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/sys/procfs.h:33:0,
                 from /home/titou/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/sys/ucontext.h:25,
                 from /home/titou/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/signal.h:329,
                 from server.h:51,
                 from server.c:30:
/home/titou/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/sys/user.h:48:8: note: originally defined here
 struct user
        ^

See full build log at http://paste.awesom.eu/epEK

Comment From: antirez

@titouanc thanks for the report. user is not a reserved word in C, so uclibc here is doing something wrong... The fix could be very simple probably, have you tried to:

#define _SYS_USER_H 1

in server.h before all the other includes? We can make such include conditional, only if uclibc is detected. However such fix is not idea, would be much better if uclibc could fix their stuff, this is likely to create issues with other programs in the future.

Comment From: titouanc

Thanks for suggesting this workaround @antirez . I tried to add -D_SYS_USER_H=1 to the compile flags.

Unfortunately, this does not work either, as some structures defined in are needed elsewhere in uclibc headers:

    CC server.o
In file included from /home/titou/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/sys/ucontext.h:25:0,
                 from /home/titou/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/signal.h:329,
                 from server.h:51,
                 from server.c:30:
/home/titou/br-test-pkg/br-arm-full/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/sys/procfs.h:45:34: error: invalid application of ‘sizeof’ to incomplete type ‘struct user_regs’
 typedef elf_greg_t elf_gregset_t[ELF_NGREG];

However, I managed to get Redis to compile with the following patch:

From 3b264fd91f1e1ea06564e2ef29b3dd0d3f068c5c Mon Sep 17 00:00:00 2001
From: Titouan Christophe <titouan.christophe@railnova.eu>
Date: Mon, 4 May 2020 14:11:43 +0200
Subject: [PATCH 1/1] make struct user anonymous (only typedef)

This prevents a conflict with struct user from <sys/user.h>
when compiling against uclibc

Signed-off-by: Titouan Christophe <titouan.christophe@railnova.eu>
---
 src/server.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/server.h b/src/server.h
index 41d767e13..9f68bfbb8 100644
--- a/src/server.h
+++ b/src/server.h
@@ -732,7 +732,7 @@ typedef struct readyList {
                                            no AUTH is needed, and every
                                            connection is immediately
                                            authenticated. */
-typedef struct user {
+typedef struct {
     sds name;       /* The username as an SDS string. */
     uint64_t flags; /* See USER_FLAG_* */

-- 
2.25.3

Is there any chance to upstream this patch (or some variation of it) ?

Comment From: antirez

I think that's fine, I guess we never reference the structure directly but always via its type, so it is not colliding with the structure name. @oranagra @yossigo do you see any issue with that?

Comment From: oranagra

seems fine to me.

Comment From: titouanc

Thanks for reviewing @antirez @oranagra and @yossigo

I've therefore opened a PR with the patch above; see https://github.com/antirez/redis/pull/7200