Skip to contentSkip to conversation

Fix perf build failure on glibc trunk

PATCH In review Markus Trippelsdorf 2 participants 4 messages Apr 4, 2012 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix perf build failure on glibc trunk

On a system running glibc trunk perf doesn't build:

CC builtin-sched.o
builtin-sched.c: In function ‘get_cpu_usage_nsec_parent’:
builtin-sched.c:399:16: error: storage size of ‘ru’ isn’t known
builtin-sched.c:403:2: error: implicit declaration of function ‘getrusage’ [-Werror=implicit-function-declaration] builtin-sched.c:403:2: error: nested extern declaration of ‘getrusage’ [-Werror=nested-externs] builtin-sched.c:403:18: error: ‘RUSAGE_SELF’ undeclared (first use in this function) builtin-sched.c:403:18: note: each undeclared identifier is reported only once for each function it appears in builtin-sched.c:399:16: error: unused variable ‘ru’ [-Werror=unused-variable]
cc1: all warnings being treated as errors

Fix it by including sys/resource.h.

---
 tools/perf/builtin-sched.c |    1 +
 1 file changed, 1 insertion(+)
tools/perf/builtin-sched.c +1 -0
index fb8b5f8..1cad3af 100644
@@ -17,6 +17,7 @@
 #include "util/debug.h"
 
 #include <sys/prctl.h>
+#include <sys/resource.h>
 
 #include <semaphore.h>
 #include <pthread.h>
Signature · 1 line
Markus
#1 lore raw
Quoted 12 lines · Markus Trippelsdorf

On a system running glibc trunk perf doesn't build:

CC builtin-sched.o
builtin-sched.c: In function ‘get_cpu_usage_nsec_parent’:
builtin-sched.c:399:16: error: storage size of ‘ru’ isn’t known
builtin-sched.c:403:2: error: implicit declaration of function ‘getrusage’ [-Werror=implicit-function-declaration] builtin-sched.c:403:2: error: nested extern declaration of ‘getrusage’ [-Werror=nested-externs] builtin-sched.c:403:18: error: ‘RUSAGE_SELF’ undeclared (first use in this function) builtin-sched.c:403:18: note: each undeclared identifier is reported only once for each function it appears in builtin-sched.c:399:16: error: unused variable ‘ru’ [-Werror=unused-variable]
cc1: all warnings being treated as errors

Quoted 4 lines

Fix it by including sys/resource.h.

---
 tools/perf/builtin-sched.c |    1 +
 1 file changed, 1 insertion(+)

Can I add:

?

Thanks,

Ingo

#2 lore raw
Quoted 15 lines · Ingo Molnar
Quoted 12 lines · Markus Trippelsdorf

On a system running glibc trunk perf doesn't build:

CC builtin-sched.o
builtin-sched.c: In function ‘get_cpu_usage_nsec_parent’:
builtin-sched.c:399:16: error: storage size of ‘ru’ isn’t known
builtin-sched.c:403:2: error: implicit declaration of function ‘getrusage’ [-Werror=implicit-function-declaration] builtin-sched.c:403:2: error: nested extern declaration of ‘getrusage’ [-Werror=nested-externs] builtin-sched.c:403:18: error: ‘RUSAGE_SELF’ undeclared (first use in this function) builtin-sched.c:403:18: note: each undeclared identifier is reported only once for each function it appears in builtin-sched.c:399:16: error: unused variable ‘ru’ [-Werror=unused-variable]
cc1: all warnings being treated as errors

Quoted 8 lines
Quoted 4 lines

Fix it by including sys/resource.h.

---
 tools/perf/builtin-sched.c |    1 +
 1 file changed, 1 insertion(+)

Can I add:

Yes sure. Sorry.

Signature · 1 line
Markus
#3 lore raw

[tip:perf/urgent] perf tools: Fix getrusage() related build failure on glibc trunk

In reply to Markus Trippelsdorf
Commit-ID:  7b78f13603c6fcb64e020a0bbe31a651ea2b657b
Gitweb:     http://git.kernel.org/tip/7b78f13603c6fcb64e020a0bbe31a651ea2b657b
Author:     Markus Trippelsdorf <[email protected]>
AuthorDate: Wed, 4 Apr 2012 10:45:27 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 4 Apr 2012 11:59:00 +0200

perf tools: Fix getrusage() related build failure on glibc trunk

On a system running glibc trunk perf doesn't build:

CC builtin-sched.o
builtin-sched.c: In function ‘get_cpu_usage_nsec_parent’: builtin-sched.c:399:16: error: storage size of ‘ru’ isn’t known builtin-sched.c:403:2: error: implicit declaration of function ‘getrusage’ [-Werror=implicit-function-declaration]

    [...]

Fix it by including sys/resource.h.

---
 tools/perf/builtin-sched.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tools/perf/builtin-sched.c +1 -0
index fb8b5f8..1cad3af 100644
@@ -17,6 +17,7 @@
 #include "util/debug.h"
 
 #include <sys/prctl.h>
+#include <sys/resource.h>
 
 #include <semaphore.h>
 #include <pthread.h>