Hi all,

I had problem with cpio building under Gentoo/FreeBSD (nearly same with
ordinary FreeBSD).

The build message was like this.

.-------------------------------------------------------------------------------
|   CC     copyin.o
| In file included from copyin.c:25:
| filetypes.h:85:11: error: macro "stat" requires 2 arguments, but only 1 given
| In file included from copyin.c:25:
| filetypes.h:85: error: 'stat' redeclared as different kind of symbol
| /usr/include/sys/stat.h:331: error: previous declaration of 'stat' was here
| gmake[2]: *** [copyin.o] Error 1
`-------------------------------------------------------------------------------

I found that "cpio/gnu/sys/stat.h" defines "stat" macro when
REPLACE_STAT is set to "1". This definition might cause the build
failure.

I've applied the patch below and was able to build cpio. (Maybe
declaring stat and lstat isn't necessary anymore? because now
"cpio/gnu/sys/stat.h" think of them?)

# I think this patch might fix Marius's bug too. Please try the patch if
# you don't mind.

Regards,
Naohiro

diff --git a/src/filetypes.h b/src/filetypes.h
index f80faab..63e7881 100644
--- a/src/filetypes.h
+++ b/src/filetypes.h
@@ -82,4 +82,6 @@
 #define lstat stat
 #endif
 int lstat ();
+#ifndef stat
 int stat ();
+#endif


Reply via email to