• Arnaldo Carvalho de Melo's avatar
    tools lib subcmd: Don't add the kernel sources to the include path · dfa71e42
    Arnaldo Carvalho de Melo authored
    [ Upstream commit ece98049 ]
    
    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: default avatarJiri Olsa <jolsa@kernel.org>
    Tested-by: default avatarJiri Olsa <jolsa@kernel.org>
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Fixes: 4b6ab94e ("perf subcmd: Create subcmd library")
    Link: https://lkml.kernel.org/n/tip-5lhaoecrj12t0bqwvpiu14sm@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
    dfa71e42
Name
Last commit
Last update
..
accounting Loading commit data...
arch Loading commit data...
bpf Loading commit data...
build Loading commit data...
cgroup Loading commit data...
crypto Loading commit data...
firewire Loading commit data...
gpio Loading commit data...
hv Loading commit data...
iio Loading commit data...
include Loading commit data...
kvm/kvm_stat Loading commit data...
laptop Loading commit data...
leds Loading commit data...
lib Loading commit data...
memory-model Loading commit data...
nfsd Loading commit data...
objtool Loading commit data...
pci Loading commit data...
pcmcia Loading commit data...
perf Loading commit data...
power Loading commit data...
scripts Loading commit data...
spi Loading commit data...
testing Loading commit data...
thermal/tmon Loading commit data...
time Loading commit data...
usb Loading commit data...
virtio Loading commit data...
vm Loading commit data...
wmi Loading commit data...
Makefile Loading commit data...