Skip to content

Commit

Permalink
perf tools: Fix build errors with mipsel-linux-uclibc compiler
Browse files Browse the repository at this point in the history
linux/tools$ make ARCH=mips CROSS_COMPILE=mipsel-linux- perf
...
config/Makefile:256: *** No gnu/libc-version.h found, please install
glibc-dev[el].  Stop.
make[1]: *** [all] Error 2
make: *** [perf] Error 2

...
In file included from builtin-sched.c:13:0:
util/cloexec.h:8:12: error: redundant redeclaration of ‘sched_getcpu’
 [-Werror=redundant-decls]
 extern int sched_getcpu(void) __THROW;

mipsel-buildroot-linux-uclibc/sysroot/usr/include/bits/sched.h:88:12:
 note: previous declaration of ‘sched_getcpu’ was here
 extern int sched_getcpu (void) __THROW;

uclibc info:
sysroot/usr/include/bits/uClibc_config.h
__UCLIBC_MAJOR__ 0
__UCLIBC_MINOR__ 9
__UCLIBC_SUBLEVEL__ 33

sysroot/usr/include/features.h
__UCLIBC__ 1
__GLIBC__ 2
__GLIBC_MINOR__ 2

Signed-off-by: Petri Gynther <pgynther@google.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1438735081-24131-1-git-send-email-pgynther@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Petri Gynther authored and Arnaldo Carvalho de Melo committed Aug 5, 2015
1 parent 007d66a commit f151f53
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions tools/build/feature/test-glibc.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
#include <stdlib.h>

#if !defined(__UCLIBC__)
#include <gnu/libc-version.h>
#else
#define XSTR(s) STR(s)
#define STR(s) #s
#endif

int main(void)
{
#if !defined(__UCLIBC__)
const char *version = gnu_get_libc_version();
#else
const char *version = XSTR(__GLIBC__) "." XSTR(__GLIBC_MINOR__);
#endif

return (long)version;
}
2 changes: 1 addition & 1 deletion tools/perf/util/cloexec.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
unsigned long perf_event_open_cloexec_flag(void);

#ifdef __GLIBC_PREREQ
#if !__GLIBC_PREREQ(2, 6)
#if !__GLIBC_PREREQ(2, 6) && !defined(__UCLIBC__)
extern int sched_getcpu(void) __THROW;
#endif
#endif
Expand Down

0 comments on commit f151f53

Please sign in to comment.