linux-brain/tools/lib
Arnaldo Carvalho de Melo 7a6da62924 tools lib subcmd: Don't add the kernel sources to the include path
[ Upstream commit ece9804985 ]

At some point we decided not to directly include kernel sources files
when building tools/perf/, but when tools/lib/subcmd/ was forked from
tools/perf it somehow ended up adding it via these two lines in its
Makefile:

  CFLAGS += -I$(srctree)/include/uapi
  CFLAGS += -I$(srctree)/include

As $(srctree) points to the kernel sources.

Removing those lines and keeping just:

  CFLAGS += -I$(srctree)/tools/include/

Is enough to build tools/perf and tools/objtool.

This fixes the build when building from the sources in environments such
as the Android NDK crossbuilding from a fedora:26 system:

  subcmd-util.h:11:15: error: expected ',' or ';' before 'void'
   static inline void report(const char *prefix, const char *err, va_list params)
                 ^
  In file included from /git/perf/include/uapi/linux/stddef.h:2:0,
                   from /git/perf/include/uapi/linux/posix_types.h:5,
                   from /opt/android-ndk-r12b/platforms/android-24/arch-arm/usr/include/sys/types.h:36,
                   from /opt/android-ndk-r12b/platforms/android-24/arch-arm/usr/include/unistd.h:33,
                   from run-command.c:2:
  subcmd-util.h:18:17: error: '__no_instrument_function__' attribute applies only to functions

The /opt/android-ndk-r12b/platforms/android-24/arch-arm/usr/include/sys/types.h
file that includes linux/posix_types.h ends up getting the one in the kernel
sources causing the breakage. Fix it.

Test built tools/objtool/ too.

Reported-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Fixes: 4b6ab94eab ("perf subcmd: Create subcmd library")
Link: https://lkml.kernel.org/n/tip-5lhaoecrj12t0bqwvpiu14sm@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-01-26 09:38:35 +01:00
..
api tools lib api fs: Add hugetlbfs filesystem detector 2016-09-08 12:34:43 -03:00
bpf tools/libbpf: handle issues with bpf ELF objects containing .eh_frames 2018-05-30 07:50:26 +02:00
lockdep tools/lib/lockdep: Reduce MAX_LOCK_DEPTH to avoid overflowing lock_chain/: Depth 2017-07-21 07:42:20 +02:00
subcmd tools lib subcmd: Don't add the kernel sources to the include path 2019-01-26 09:38:35 +01:00
symbol tools lib symbol: Introduce kallsyms2elf_type 2015-09-30 18:34:31 -03:00
traceevent tools lib traceevent: Fix get_field_str() for dynamic strings 2018-05-30 07:50:19 +02:00
bitmap.c tools lib: Add bitmap_and function 2016-08-02 16:33:27 -03:00
find_bit.c tools lib: Add for_each_clear_bit macro 2018-06-05 10:28:55 +02:00
hweight.c tools: Copy lib/hweight.c from the kernel sources 2015-07-09 16:29:56 -03:00
rbtree.c tools: Copy lib/rbtree.c to tools/lib/ 2015-07-05 22:48:21 -03:00
str_error_r.c objtool, perf: Fix GCC 8 -Wrestrict error 2018-05-01 15:13:09 -07:00
string.c perf tools: Move strlcpy() from perf to tools/lib/string.c 2015-12-16 16:09:39 -03:00
vsprintf.c perf tools: Uninline scnprintf() and vscnprint() 2016-07-12 15:20:24 -03:00