[LU-5018] e2fsprogs build failed Created: 07/May/14  Updated: 04/Nov/14  Resolved: 23/May/14

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.6.0
Fix Version/s: Lustre 2.6.0, Lustre 2.5.4

Type: Bug Priority: Critical
Reporter: Niu Yawei (Inactive) Assignee: Andreas Dilger
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocker
is blocking LU-4504 User quota problem after Lustre upgra... Resolved
Related
is related to LU-3963 cleanup libcfs wrappers Resolved
is related to LU-5501 new e2fsprogs causes llverfs build fa... Resolved
Severity: 3
Rank (Obsolete): 13889

 Description   

Looks e2fsprogs failed to build for a long time:

	CC unix.c
In file included from /var/lib/jenkins/workspace/e2fsprogs-master/arch/x86_64/distro/el6/../usr/src/lustre-2.5.57/lustre/include/lustre/lustre_user.h:51,
                 from /var/lib/jenkins/workspace/e2fsprogs-master/arch/x86_64/distro/el6/../usr/src/lustre-2.5.57/lustre/include/lustre/lustreapi.h:46,
                 from ../lib/ext2fs/lfsck.h:10,
                 from unix.c:60:
/var/lib/jenkins/workspace/e2fsprogs-master/arch/x86_64/distro/el6/../usr/src/lustre-2.5.57/libcfs/include/libcfs/posix/posix-types.h:60: error: redefinition of typedef '__s8'
../lib/ext2fs/ext2_types.h:26: note: previous declaration of '__s8' was here
/var/lib/jenkins/workspace/e2fsprogs-master/arch/x86_64/distro/el6/../usr/src/lustre-2.5.57/libcfs/include/libcfs/posix/posix-types.h:63: error: redefinition of typedef '__u8'
../lib/ext2fs/ext2_types.h:20: note: previous declaration of '__u8' was here
/var/lib/jenkins/workspace/e2fsprogs-master/arch/x86_64/distro/el6/../usr/src/lustre-2.5.57/libcfs/include/libcfs/posix/posix-types.h:67: error: redefinition of typedef '__s16'
../lib/ext2fs/ext2_types.h:46: note: previous declaration of '__s16' was here
/var/lib/jenkins/workspace/e2fsprogs-master/arch/x86_64/distro/el6/../usr/src/lustre-2.5.57/libcfs/include/libcfs/posix/posix-types.h:70: error: redefinition of typedef '__u16'
../lib/ext2fs/ext2_types.h:32: note: previous declaration of '__u16' was here
/var/lib/jenkins/workspace/e2fsprogs-master/arch/x86_64/distro/el6/../usr/src/lustre-2.5.57/libcfs/include/libcfs/posix/posix-types.h:74: error: redefinition of typedef '__s32'
../lib/ext2fs/ext2_types.h:79: note: previous declaration of '__s32' was here
/var/lib/jenkins/workspace/e2fsprogs-master/arch/x86_64/distro/el6/../usr/src/lustre-2.5.57/libcfs/include/libcfs/posix/posix-types.h:77: error: redefinition of typedef '__u32'
../lib/ext2fs/ext2_types.h:61: note: previous declaration of '__u32' was here
/var/lib/jenkins/workspace/e2fsprogs-master/arch/x86_64/distro/el6/../usr/src/lustre-2.5.57/libcfs/include/libcfs/posix/posix-types.h:93: error: redefinition of typedef '__s64'
../lib/ext2fs/ext2_types.h:113: note: previous declaration of '__s64' was here
/var/lib/jenkins/workspace/e2fsprogs-master/arch/x86_64/distro/el6/../usr/src/lustre-2.5.57/libcfs/include/libcfs/posix/posix-types.h:96: error: redefinition of typedef '__u64'
../lib/ext2fs/ext2_types.h:97: note: previous declaration of '__u64' was here
	CC e2fsck.c
make[3]: *** [unix.o] Error 1

Seems those macros defined in lustre posix-types.h are conflicting with ext2_types.h

e2fsprogs include lustre posix-types.h in following path:
unix.c -> lfsck.h -> lustreapi.h -> lustre_user.h -> posix-types.h



 Comments   
Comment by Niu Yawei (Inactive) [ 07/May/14 ]

Probably we need to check if e2fsprogs header already been included? Something like:

#ifndef __U8_TYPEDEF  /* already defined in e2fsprogs header */

#ifndef HAVE___S8
typedef __signed__ char __s8;
#endif
#ifndef HAVE___U8
typedef unsigned
...
#endif
Comment by John Hammond [ 07/May/14 ]

Niu, can you post the exact version of the lustre source being used here? I see that it says 2.5.57 above, but IIRC if I checkout 2.5.58-79-ge345778, make rpms, and install the source then it goes in /usr/src/lustre-2.5.58/.

Comment by John Hammond [ 07/May/14 ]

The last successful build of e2fsprogs was on the same day that 001b8dbfacb747f1649a2eb047a5f118ce32fdc7 landed.

# git log -p libcfs/include/libcfs/posix/posix-types.h
commit 001b8dbfacb747f1649a2eb047a5f118ce32fdc7
Author: Alexey Lyashkov <alexey_lyashkov@xyratex.com>
Date:   Mon Sep 30 13:38:10 2013 +0300

    LU-3963 cleanup: C89 and build cleanups
    
    use C99 initialization for a types, remove some platform depended code
    and use POSIX compatible instead.
    don't build a lhsmtool is none utils allowed.
    
    Signed-off-by: Alexey Lyashkov <alexey_lyashkov@xyratex.com>
    Change-Id: I6e2837953902520240e9ceb251c92329d328d715
    Reviewed-on: http://review.whamcloud.com/7803
    Tested-by: Jenkins
    Tested-by: Maloo <hpdd-maloo@intel.com>
    Reviewed-by: Bob Glossman <bob.glossman@intel.com>
    Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>

diff --git a/libcfs/include/libcfs/posix/posix-types.h b/libcfs/include/libcfs/posix/posix-types.h
index 446db6e..510b178 100644
--- a/libcfs/include/libcfs/posix/posix-types.h
+++ b/libcfs/include/libcfs/posix/posix-types.h
@@ -42,7 +42,9 @@
 #ifndef _LUSTRE_POSIX_TYPES_H
 #define _LUSTRE_POSIX_TYPES_H
 
-#include <asm/types.h>
+#ifdef HAVE_LINUX_TYPES_H
+# include <linux/types.h>
+#endif
 #include <stdbool.h> /* for bool */
 #ifndef HAVE_UMODE_T
 typedef unsigned short umode_t;

posix-types.h is an packaged header. Its contents must not depend on config.h.

Comment by Andreas Dilger [ 07/May/14 ]

Returning the unconditional <asm/types.h> header instead of the conditional <linux/types.h> fixes the problem. However, I can't see what in the include chain in <asm/types.h> -> <asm-generic/types.h> -> <asm-generic/int-ll64.h> is actually fixing the problem. The <libcfs/posix/posix-types.h> header defines the fixed-width types as:

#ifndef HAVE___S8
typedef __signed__ char __s8;
#endif
#ifndef HAVE___U8
typedef unsigned char __u8;
#endif

while in <asm/types.h> (at least on my system, in both /usr/include/asm/types.h and linux/include/asm/types.h) it defines the types without any checking:

#ifndef __ASSEMBLY__
/*
 * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
 * header files exported to user space
 */

typedef __signed__ char __s8;
typedef unsigned char __u8;

There was some attempt to avoid such conflicts in lib/ext2fs/ext2_types.h using:

#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \
        !defined(_EXT2_TYPES_H))

#define __S8_TYPEDEF __signed__ char
#define __U8_TYPEDEF unsigned char
#define __S16_TYPEDEF __signed__ short
#define __U16_TYPEDEF unsigned short
#define __S32_TYPEDEF __signed__ int
#define __U32_TYPEDEF unsigned int
#define __S64_TYPEDEF __signed__ long long
#define __U64_TYPEDEF unsigned long long

#ifdef __U8_TYPEDEF
typedef __U8_TYPEDEF __u8;
#else
typedef unsigned char __u8;
#endif

#ifdef __S8_TYPEDEF
typedef __S8_TYPEDEF __s8;
#else
typedef signed char __s8;
#endif

but this fails due to _LINUX_TYPES_H not being #defined. However, I don't see how that is avoided when <asm/types.h> is included. Sadly, the types are defined exactly the same way and it would be nice if GCC didn't complain in that case.

Comment by Andreas Dilger [ 07/May/14 ]

The patch http://review.whamcloud.com/10258 should resolve the breakage of the e2fsprogs build induced by http://review.whamcloud.com/7803 changing the include of <asm/types.h> to a conditional include of <linux/types.h> that depended on the HAVE_LINUX_TYPES_H configure macro that was not normally defined for userspace headers.

Comment by John Hammond [ 08/May/14 ]

This would also be addressed by http://review.whamcloud.com/10273.

Comment by Andreas Dilger [ 13/May/14 ]

http://review.whamcloud.com/10319 should fix the problem on the e2fsprogs side while the Lustre patch is waiting to land

Comment by Jodi Levi (Inactive) [ 23/May/14 ]

Patches landed to Master. Please reopen ticket if more work is needed.

Comment by Andreas Dilger [ 26/Sep/14 ]

Patch for b2_5: http://review.whamcloud.com/11840

Generated at Sat Feb 10 01:47:49 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.