Skip to contentSkip to conversation

mdadm 2.2 compile problem

DISCUSSION Robert Heinzmann 2 participants 2 messages Dec 15, 2005 – Dec 16, 2005 MD RAID

lore
Share & tools
lore
#0 lore raw

Hello,
I tried to compile mdadm 2.2 on my machine (sles8)

Kernel: 2.4.21-295-athlon
gcc: gcc version 2.95.3 20010315

The compile fails with this error message:

cc1: warnings being treated as errors
In file included from mdadm.h:219,

                from bitmap.c:23:

/usr/include/ftw.h:93: warning: struct stat64' declared inside parameter list /usr/include/ftw.h:93: warning: its scope is only this definition or declaration, which is probably not what you want. /usr/include/ftw.h:102: warning: struct stat64' declared inside parameter list
bitmap.c: In function `bitmap_fd_read':
bitmap.c:130: warning: unknown conversion type character `z' in format
bitmap.c:130: warning: too many arguments for format
make: *** [bitmap.o] Error 1

I changed the makefile and removed -Werror. Is there another way to fix this issue ?

Regards,
Robert Heinzmann

#1 lore raw
Quoted 22 lines · On Thursday December 15, [email protected] wrote:

Hello,
I tried to compile mdadm 2.2 on my machine (sles8)

Kernel: 2.4.21-295-athlon
gcc: gcc version 2.95.3 20010315

The compile fails with this error message:

cc1: warnings being treated as errors
In file included from mdadm.h:219,

                 from bitmap.c:23:

/usr/include/ftw.h:93: warning: `struct stat64' declared inside parameter list
/usr/include/ftw.h:93: warning: its scope is only this definition or declaration, which is probably not what you want. /usr/include/ftw.h:102: warning: `struct stat64' declared inside parameter list
bitmap.c: In function `bitmap_fd_read':
bitmap.c:130: warning: unknown conversion type character `z' in format bitmap.c:130: warning: too many arguments for format
make: *** [bitmap.o] Error 1

Quoted 2 lines

I changed the makefile and removed -Werror. Is there another way to fix this issue ?

Yes. You can
make CWFLAGS=

or you can report it like you did (thanks) and get a patch. (One of the reasons I still have -Werror in there is to encourage people to report these warnings, so I can fix them for the next version).

The following allows mdadm to compile with gcc-2.95

Thanks,
NeilBrown

### Diffstat output

 ./bitmap.c |    5 +++++
 ./mdadm.h  |    4 ++++
 2 files changed, 9 insertions(+)
bitmap.c renamed from bitmap.c~current~ +5 -0
diff ./bitmap.c~current~ ./bitmap.c
@@ -126,8 +126,13 @@ bitmap_info_t *bitmap_fd_read(int fd, in
 
 	info = malloc(sizeof(*info));
 	if (info == NULL) {
+#if __GNUC__ < 3
+		fprintf(stderr, Name ": failed to allocate %d bytes\n",
+				(int)sizeof(*info));
+#else
 		fprintf(stderr, Name ": failed to allocate %zd bytes\n",
 				sizeof(*info));
+#endif
 		return NULL;
 	}
 
mdadm.h renamed from mdadm.h~current~ +4 -0
diff ./mdadm.h~current~ ./mdadm.h
@@ -211,6 +211,10 @@ struct supertype {
 extern struct supertype *super_by_version(int vers, int minor);
 extern struct supertype *guess_super(int fd);
 
+#if __GNUC__ < 3
+struct stat64;
+#endif
+
 #ifdef UCLIBC
   struct FTW {};
 # define FTW_PHYS 1