Skip to contentSkip to conversation

xfsdump doesn't compile: undefined reference to 'min'

PATCH Detlef Vollmann 2 participants 3 messages Aug 6, 2015 – Aug 7, 2015

lore
Share & tools
lore
#0 lore raw
Quoted 7 lines

commit 5a2985233c390d59d2a9757b119cb0e001c87a96

Author: Dave Chinner <[email protected]>
Date:   Fri Jul 18 08:02:26 2014 +1000

dump: don't redefine min() or max()

They are included from other header files.

The message doesn't say from which header and configure doesn't test for it.
If I compile it (cross-compilation, gcc, uclibc, xfsprogs 3.1.11, xfsdump 3.1.4), I get lots of errors:
warning: implicit declaration of function 'max'
undefined reference to 'min'

Attached is a pragmatic patch.

Detlef

PS: I'm not on the list.

common/util.h +6 -0
index 86ea8d2..460aea5 100644
@@ -66,6 +66,12 @@ extern intgen_t read_buf( char *bufp,
 			  rrbfp_t return_read_buf_funcp,
 			  intgen_t *statp );
 
+#ifndef min
+#define min( a, b )	( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
+#endif
+#ifndef max
+#define max( a, b )	( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
+#endif
 
 
 /* strncpyterm - like strncpy, but guarantees the destination is null-terminated
restore/dirattr.c +4 -0
index fcfa0c8..6413c15 100644
@@ -51,6 +51,10 @@
 
 /* structure definitions used locally ****************************************/
 
+#ifndef max
+#define max( a, b )	( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
+#endif
+
 /* node handle limits
  */
 #ifdef DIRATTRCHK
restore/namreg.c +4 -0
index 41362d1..4630605 100644
@@ -34,6 +34,10 @@
 
 /* structure definitions used locally ****************************************/
 
+#ifndef max
+#define max( a, b )	( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
+#endif
+
 #define NAMREG_AVGLEN	10
 
 /* persistent context for a namreg - placed in first page
restore/node.c +7 -0
index 4cc8fb0..97d46e1 100644
@@ -30,6 +30,13 @@
 #include "node.h"
 #include "mmap.h"
 
+#ifndef max
+#define max( a, b )	( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
+#endif
+#ifndef min
+#define min( a, b )	( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
+#endif
+
 extern size_t pgsz;
 extern size_t pgmask;
 

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#1 lore raw
Quoted 6 lines · Detlef Vollmann
Quoted 6 lines

commit 5a2985233c390d59d2a9757b119cb0e001c87a96

Author: Dave Chinner <[email protected]>
Date:   Fri Jul 18 08:02:26 2014 +1000

dump: don't redefine min() or max()

Quoted 7 lines
Quoted 1 line

They are included from other header files.

The message doesn't say from which header and configure doesn't test for it.
If I compile it (cross-compilation, gcc, uclibc, xfsprogs 3.1.11, xfsdump 3.1.4), I get lots of errors:
warning: implicit declaration of function 'max'
undefined reference to 'min'

#include <xfs/xfs.h>
-> /usr/include/xfs/xfs.h

     #include <xfs/platform_defs.h>
       -> /usr/include/xfs/platform_defs.h
          #define min(a,b)	(((a)<(b))?(a):(b))

These headers come from xfsprogs, and you'll need to upgrade that package to 3.2.x....

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#2 lore raw
Quoted 8 lines · Dave Chinner
Quoted 6 lines · Detlef Vollmann

The message doesn't say from which header and configure doesn't test for it.
If I compile it (cross-compilation, gcc, uclibc, xfsprogs 3.1.11, xfsdump 3.1.4), I get lots of errors:
warning: implicit declaration of function 'max'
undefined reference to 'min'

Quoted 8 lines
#include <xfs/xfs.h>
   -> /usr/include/xfs/xfs.h
      #include <xfs/platform_defs.h>
        -> /usr/include/xfs/platform_defs.h
           #define min(a,b)	(((a)<(b))?(a):(b))

These headers come from xfsprogs, and you'll need to upgrade that package to 3.2.x....

Thank.
Unfortunately that doesn't seem to be an option, so sticking with xfsdump-3.1.3.

Detlef

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs