bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: struct rusage redefinition issues on ppc - gnu time-1.7


From: Bob Proulx
Subject: Re: struct rusage redefinition issues on ppc - gnu time-1.7
Date: Tue, 25 Jun 2013 21:35:02 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

This message originally went to the coreutils project but I am
redirecting the discussion here to bug-gnu-utils.

  http://lists.gnu.org/archive/html/coreutils/2013-06/msg00069.html

Aijaz Baig wrote:
> hi.

Hi.

> Im trying to compile Gnu time 1.7 for a powerpc system using the windriver
> build system which is based on yocto.

I am unfamiliar with this system.

> The build fails with an error at resuse.h:44:error: redefinition of 'struct
> rusage'.

Normally struct rusage is defined by including <sys/time.h> and
<sys/resources.h>.

  #include <sys/time.h>
  #include <sys/resource.h>

That will include the system's definition.

> On searching the internet found  benoit sibaud facing same problem on
> solaris. He commented out system definition and it worked for him. For me
> however it doesn't work. On doing that itvfails to link the various object
> files time.o getopt.o error.o resuse.o and version.o.

Instead of only commenting out that section also include the above two
header files.  I think you must have only commented out the definition
but not added the include statement.

> On another thread here, paul eggert's suggestion to Jim McMaster who seemed
> to be facing something simiar while compiling it for solaris 8 is to define
> HAVE_WAIT3. I've tried that too but it fails as well. And its again while
> linking the aforementioned object files.

In the original code (as seen in the patch below) defining that would
cause the #ifdef section to include <sys/resources.h> and not to use
the inlined local copy of struct rusage.

> Please help me in getting this fixed. Where do I check for the build logs
> in detail. As what exactly is causing the linking to fail? By the way
> errors of the sort 'crt1.o: No such file: No such filevor directory are
> link time errors right? At times I've seen people saying they signify a
> corrupted libc. Hoeever when i manually search for it in my sysroot i can
> find it.

Please when asking questions such as these do include the cut and
pasted copy of the commands you are typing and the error messages you
are seeing.  Otherwise it is difficult to know exactly what is
happening.

> Im confused. Pls elaborate. Keen to hear.

There is a patch usually included in software distributions that may
be useful to you.  Try this patch and please report back to this
mailing list on your results.  The patch changes things to look for
<sys/resource.h> and if it is available then include it.  It contains
the system's definition of struct rusage which is the one that should
be used.

Bob

--- time-1.7.orig/resuse.h
+++ time-1.7/resuse.h
@@ -36,19 +36,8 @@
 # include <sys/rusage.h>
 #else
 # define TV_MSEC tv_usec / 1000
-# if HAVE_WAIT3
+# if HAVE_SYS_RESOURCE_H
 #  include <sys/resource.h>
-# else
-/* Process resource usage structure.  */
-struct rusage
-{
-  struct timeval ru_utime;     /* User time used.  */
-  struct timeval ru_stime;     /* System time used.  */
-  int ru_maxrss, ru_ixrss, ru_idrss, ru_isrss,
-  ru_minflt, ru_majflt, ru_nswap, ru_inblock, 
-  ru_oublock, ru_msgsnd, ru_msgrcv, ru_nsignals,
-  ru_nvcsw, ru_nivcsw;
-};
 # endif
 #endif
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]