All of lore.kernel.org
 help / color / mirror / Atom feed
* xfsdump doesn't compile: undefined reference to 'min'
@ 2015-08-06  7:54 Detlef Vollmann
  2015-08-06 21:26 ` Dave Chinner
  0 siblings, 1 reply; 3+ messages in thread
From: Detlef Vollmann @ 2015-08-06  7:54 UTC (permalink / raw)
  To: xfs

[-- Attachment #1: Type: text/plain, Size: 565 bytes --]

 > commit 5a2985233c390d59d2a9757b119cb0e001c87a96
 > Author: Dave Chinner <dchinner@redhat.com>
 > 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.

[-- Attachment #2: 001-minmax.patch --]
[-- Type: text/x-patch, Size: 1624 bytes --]

diff --git a/common/util.h b/common/util.h
index 86ea8d2..460aea5 100644
--- a/common/util.h
+++ b/common/util.h
@@ -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
diff --git a/restore/dirattr.c b/restore/dirattr.c
index fcfa0c8..6413c15 100644
--- a/restore/dirattr.c
+++ b/restore/dirattr.c
@@ -51,6 +51,10 @@
 
 /* structure definitions used locally ****************************************/
 
+#ifndef max
+#define max( a, b )	( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
+#endif
+
 /* node handle limits
  */
 #ifdef DIRATTRCHK
diff --git a/restore/namreg.c b/restore/namreg.c
index 41362d1..4630605 100644
--- a/restore/namreg.c
+++ b/restore/namreg.c
@@ -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
diff --git a/restore/node.c b/restore/node.c
index 4cc8fb0..97d46e1 100644
--- a/restore/node.c
+++ b/restore/node.c
@@ -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;
 

[-- Attachment #3: Type: text/plain, Size: 121 bytes --]

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: xfsdump doesn't compile: undefined reference to 'min'
  2015-08-06  7:54 xfsdump doesn't compile: undefined reference to 'min' Detlef Vollmann
@ 2015-08-06 21:26 ` Dave Chinner
  2015-08-07 12:16   ` Detlef Vollmann
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2015-08-06 21:26 UTC (permalink / raw)
  To: Detlef Vollmann; +Cc: xfs

On Thu, Aug 06, 2015 at 09:54:55AM +0200, Detlef Vollmann wrote:
> > commit 5a2985233c390d59d2a9757b119cb0e001c87a96
> > Author: Dave Chinner <dchinner@redhat.com>
> > 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'

#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.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: xfsdump doesn't compile: undefined reference to 'min'
  2015-08-06 21:26 ` Dave Chinner
@ 2015-08-07 12:16   ` Detlef Vollmann
  0 siblings, 0 replies; 3+ messages in thread
From: Detlef Vollmann @ 2015-08-07 12:16 UTC (permalink / raw)
  To: Dave Chinner; +Cc: xfs

On 08/06/15 23:26, Dave Chinner wrote:
> On Thu, Aug 06, 2015 at 09:54:55AM +0200, Detlef Vollmann wrote:
>> 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....
Thank.
Unfortunately that doesn't seem to be an option, so sticking with xfsdump-3.1.3.

   Detlef

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-08-07 12:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-06  7:54 xfsdump doesn't compile: undefined reference to 'min' Detlef Vollmann
2015-08-06 21:26 ` Dave Chinner
2015-08-07 12:16   ` Detlef Vollmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.