WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Solved] Kernel tool: perf ?  (Read 11041 times)

Offline polikuo

  • Hero Member
  • *****
  • Posts: 758
[Solved] Kernel tool: perf ?
« on: October 07, 2020, 09:23:43 AM »
Hi, I'm taking a course in school.

The teacher wants us to install "perf" to see how our coding performs.

I've seen posts about compiling one with no luck. (aarch64)

Most of them say make -C <kernel source root directory>/tools/perf would do the trick.

On some web pages I see java may be required. (keyword: export JDIR="/usr/lib/jvm/open-jdk")

Is it perhaps locked in the kernel ?

I've never successfully compiled a kernel before.

Or do you have it around in your kernel build directory ?
« Last Edit: October 09, 2020, 10:34:14 AM by Rich »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14851
Re: Kernel tool: perf ?
« Reply #1 on: October 07, 2020, 09:52:00 AM »
You don't need to compile the kernel, this worked for me:
Code: [Select]
$ cd linux-5.4.3
$ make -C tools/perf

It looks like you need compiletc elftools-dev openssl-1.1.1-dev perl5 liblzma-dev zstd-dev libcap-dev

You'll also need to add the arch specific flags.
« Last Edit: October 07, 2020, 09:53:47 AM by Juanito »

Offline polikuo

  • Hero Member
  • *****
  • Posts: 758
Re: Kernel tool: perf ?
« Reply #2 on: October 07, 2020, 10:22:57 AM »
It looks like you need compiletc elftools-dev openssl-1.1.1-dev perl5 liblzma-dev zstd-dev libcap-dev

Which arch are you using ?

I don't see elftools-dev anywhere.

P.S. I'm using aarch64.
I don't have any other machine around right now.
Perhaps I should make a USB and boot into it  :-\

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14851
Re: Kernel tool: perf ?
« Reply #3 on: October 07, 2020, 10:24:48 AM »
I did a test on x86_64 - you need libelf-dev on aarch64

Offline polikuo

  • Hero Member
  • *****
  • Posts: 758
Re: Kernel tool: perf ?
« Reply #4 on: October 07, 2020, 10:46:12 AM »
 :(

Code: [Select]
tc@box:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51$ tce-load -i compiletc libelf-dev openssl-dev perl5 liblzma-dev zstd-dev libcap-dev
compiletc is already installed!
libelf-dev is already installed!
openssl-dev is already installed!
perl5 is already installed!
liblzma-dev is already installed!
zstd-dev is already installed!
libcap-dev is already installed!
tc@box:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51$ CC="gcc -march=armv8-a+crc -mtune=cortex-a72 -Os -pipe"
tc@box:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51$ CXX="g++ -march=armv8-a+crc -mtune=cortex-a72 -Os -pipe -fno-exceptions -fno-rtti"
tc@box:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51$ LDFLAGS="-Wl,-O1"
tc@box:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51$ export CC CXX LDFLAGS
tc@box:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51$ make -C tools/perf
make: Entering directory '/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf'
  BUILD:   Doing 'make -j4' parallel build
Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
Warning: Kernel ABI header at 'tools/include/uapi/linux/sched.h' differs from latest version at 'include/uapi/linux/sched.h'
diff -u tools/include/uapi/linux/sched.h include/uapi/linux/sched.h
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/unistd.h' differs from latest version at 'arch/x86/include/uapi/asm/unistd.h'
diff -u tools/arch/x86/include/uapi/asm/unistd.h arch/x86/include/uapi/asm/unistd.h
sh: command: line 1: illegal option -c

Auto-detecting system features:
...                         dwarf: [ OFF ]
...            dwarf_getlocations: [ OFF ]
...                         glibc: [ on  ]
...                          gtk2: [ OFF ]
...                      libaudit: [ OFF ]
...                        libbfd: [ on  ]
...                        libcap: [ on  ]
...                        libelf: [ on  ]
...                       libnuma: [ OFF ]
...        numa_num_possible_cpus: [ OFF ]
...                       libperl: [ OFF ]
...                     libpython: [ OFF ]
...                     libcrypto: [ on  ]
...                     libunwind: [ OFF ]
...            libdw-dwarf-unwind: [ OFF ]
...                          zlib: [ on  ]
...                          lzma: [ on  ]
...                     get_cpuid: [ OFF ]
...                           bpf: [ on  ]
...                        libaio: [ on  ]
...                       libzstd: [ on  ]
...        disassembler-four-args: [ on  ]

Makefile.config:389: No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR
Makefile.config:394: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
Makefile.config:465: gelf_getnote() not found on libelf, SDT support disabled
Makefile.config:498: DWARF support is off, BPF prologue is disabled
Makefile.config:506: No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev
Makefile.config:554: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
Makefile.config:581: Disabling post unwind, no support found.
Makefile.config:662: slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev
Makefile.config:679: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
Makefile.config:706: Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev
Makefile.config:733: No python interpreter was found: disables Python support - please install python-devel/python-dev
Makefile.config:791: No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling
Makefile.config:859: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
Makefile.config:914: No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev
Makefile.config:940: No alternatives command found, you need to set JDIR= to point to the root of your Java directory
  DESCEND  plugins
make[3]: Nothing to be done for 'plugins/libtraceevent-dynamic-list'.
  GEN      perf-archive
  GEN      perf-with-kcore
  CC       builtin-script.o
  CC       tests/builtin-test.o
  CC       util/annotate.o
  LD       bench/perf-in.o
ld: bench/futex-lock-pi.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-lock-pi.c:40: multiple definition of `runtime'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/futex-lock-pi.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-lock-pi.c:40: multiple definition of `end'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/futex-lock-pi.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-lock-pi.c:40: multiple definition of `start'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/epoll-wait.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/epoll-wait.c:93: multiple definition of `runtime'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/epoll-wait.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/epoll-wait.c:93: multiple definition of `end'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/epoll-wait.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/epoll-wait.c:93: multiple definition of `start'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/epoll-ctl.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/epoll-ctl.c:38: multiple definition of `runtime'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/epoll-ctl.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/epoll-ctl.c:38: multiple definition of `end'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/epoll-ctl.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/epoll-ctl.c:38: multiple definition of `start'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
make[4]: *** [/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/build/Makefile.build:145: bench/perf-in.o] Error 1
make[3]: *** [/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/build/Makefile.build:139: bench] Error 2
make[3]: *** Waiting for unfinished jobs....
  CC       tests/parse-events.o
  CC       util/block-range.o
  CC       tests/dso-data.o
  CC       util/build-id.o
In file included from /usr/include/stdio.h:867,
                 from util/dso.h:11,
                 from builtin-script.c:6:
In function 'fprintf',
    inlined from 'perf_sample__fprintf_regs.isra' at builtin-script.c:602:14:
/usr/include/bits/stdio2.h:100:10: error: '%5s' directive argument is null [-Werror=format-overflow=]
  100 |   return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  101 |    __va_arg_pack ());
      |    ~~~~~~~~~~~~~~~~~
  CC       tests/attr.o
  CC       util/cacheline.o
  CC       tests/vmlinux-kallsyms.o
  CC       util/config.o
  CC       tests/openat-syscall.o
  CC       tests/openat-syscall-all-cpus.o
  CC       tests/openat-syscall-tp-fields.o
  CC       tests/mmap-basic.o
  CC       tests/perf-record.o
  CC       tests/evsel-roundtrip-name.o
  CC       tests/evsel-tp-sched.o
  CC       tests/fdarray.o
  CC       util/copyfile.o
  CC       tests/pmu.o
  CC       util/ctype.o
cc1: all warnings being treated as errors
  CC       tests/hists_common.o
  CC       util/db-export.o
mv: cannot stat './.builtin-script.o.tmp': No such file or directory
make[3]: *** [/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/build/Makefile.build:96: builtin-script.o] Error 1
  CC       util/env.o
  CC       tests/hists_link.o
util/env.c: In function 'perf_env__arch':
cc1: error: function may return address of local variable [-Werror=return-local-addr]
util/env.c:329:17: note: declared here
  329 |  struct utsname uts;
      |                 ^~~
  CC       tests/hists_filter.o
cc1: all warnings being treated as errors
mv: cannot stat 'util/.env.o.tmp': No such file or directory
make[4]: *** [/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/build/Makefile.build:97: util/env.o] Error 1
make[4]: *** Waiting for unfinished jobs....
  CC       tests/hists_output.o
  CC       tests/hists_cumulate.o
make[3]: *** [/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/build/Makefile.build:139: util] Error 2
  CC       tests/python-use.o
  CC       tests/bp_signal.o
  CC       tests/bp_signal_overflow.o
  CC       tests/bp_account.o
  CC       tests/wp.o
  CC       tests/task-exit.o
  CC       tests/sw-clock.o
  CC       tests/mmap-thread-lookup.o
  CC       tests/thread-mg-share.o
  CC       tests/switch-tracking.o
  CC       tests/keep-tracking.o
  CC       tests/code-reading.o
  CC       tests/sample-parsing.o
  CC       tests/parse-no-sample-id-all.o
  CC       tests/kmod-path.o
  CC       tests/thread-map.o
  CC       tests/llvm.o
  CC       tests/llvm-src-base.o
  CC       tests/llvm-src-kbuild.o
  CC       tests/llvm-src-prologue.o
  CC       tests/llvm-src-relocation.o
  CC       tests/bpf.o
  CC       tests/topology.o
  CC       tests/mem.o
  CC       tests/cpumap.o
  CC       tests/stat.o
  CC       tests/event_update.o
  CC       tests/event-times.o
  CC       tests/expr.o
  CC       tests/backward-ring-buffer.o
  CC       tests/sdt.o
  CC       tests/is_printable_array.o
  CC       tests/bitmap.o
  CC       tests/perf-hooks.o
  CC       tests/clang.o
  CC       tests/unit_number__scnprintf.o
  CC       tests/mem2node.o
  CC       tests/map_groups.o
  CC       tests/time-utils-test.o
  LD       tests/perf-in.o
ld: tests/bp_account.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/tests/bp_account.c:26: multiple definition of `the_var'; tests/bp_signal.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/tests/bp_signal.c:38: first defined here
make[4]: *** [/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/build/Makefile.build:145: tests/perf-in.o] Error 1
make[3]: *** [/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/build/Makefile.build:139: tests] Error 2
make[2]: *** [Makefile.perf:597: perf-in.o] Error 2
make[1]: *** [Makefile.perf:221: sub-make] Error 2
make: *** [Makefile:70: all] Error 2
make: Leaving directory '/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf'

My tce-status:
Code: [Select]
tc@box:~$ tce-status -i
Xlibs
Xorg
Xorg-fonts
Xprogs
adwaita-icon-theme
alsa
alsa-modules-5.4.51-piCore-v8
alsa-utils
at-spi2-atk
at-spi2-core
aterm
atk
bash
bash-locale
binutils
binutils-locale
bison
bison-locale
bzip2
bzip2-dev
bzip2-lib
ca-certificates
cairo
compiletc
coreutils
coreutils-locale
dbus
dbus-glib
diffutils
diffutils-locale
e2fsprogs_base-dev
expat2
file
findutils
findutils-locale
firefox
flex
flex-locale
fltk-1.3
fontconfig
freetype
fribidi
gamin
gamin-dev
gawk
gawk-locale
gcc
gcc-locale
gcc_base-dev
gcc_libs
gcc_libs-dev
gdbm
gdbm-locale
gdk-pixbuf
gettext
gettext-locale
glib2
glib2-dev
glib2-python
glibc_add_lib
glibc_apps
glibc_base-dev
glibc_gconv
gmp
gmp-dev
graphite2
grep
grep-locale
gtk3
harfbuzz
hicolor-icon-theme
icu
imlib2
imlib2-bin
isl
libEGL
libGLES
libICE
libSM
libX11
libXau
libXcomposite
libXcursor
libXdamage
libXdmcp
libXext
libXfixes
libXfont2
libXft
libXi
libXinerama
libXmu
libXrandr
libXrender
libXt
libXtst
libXxf86vm
libacl
libasound
libattr
libcap
libcap-dev
libdrm
libelf
libelf-dev
libepoxy
libevdev
libevent
libffi_base-dev
libfontenc
libinput
libjpeg-turbo
liblz4
liblzma
liblzma-dev
libpciaccess
libpng
librsvg
libtiff
libudev
libudev-dev
libvncserver
libwebp
libxcb
libxkbcommon
libxkbfile
libxml2
libxshmfence
linux-5.4.y_api_headers
m4
make
make-locale
mesa
mpc
mpc-dev
mpfr
mpfr-dev
mtdev
mylocale
ncurses
ncurses-dev
nspr
nss
openbox
openbox-config
openbox-locale
openssh
openssl
openssl-dev
pango
patch
pcre
pcre-dev
perl5
pixman
pkg-config
python3.8
readline
rsync
sed
sed-locale
shared-mime-info
sqlite3
tce-tools
texinfo
unifont
util-linux_base-dev
wayland
wayland-protocols
wbar
x11vnc
xf86-input-libinput
xf86-video-fbdev
xkbcomp
xkeyboard-config
xorg-server
zlib_base-dev
zstd
zstd-dev

Perhaps I should force disable the parallel build ?
« Last Edit: October 07, 2020, 10:49:38 AM by polikuo »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14851
Re: Kernel tool: perf ?
« Reply #5 on: October 07, 2020, 11:09:51 AM »
It seems the contents of libelf-dev in piCore64 are not the same as elfutils-dev in CorePure64...

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11704
Re: Kernel tool: perf ?
« Reply #6 on: October 07, 2020, 11:21:42 AM »
Hi polikuo
Something seems wrong here:
Code: [Select]
----- Snip -----

Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
Warning: Kernel ABI header at 'tools/include/uapi/linux/sched.h' differs from latest version at 'include/uapi/linux/sched.h'
diff -u tools/include/uapi/linux/sched.h include/uapi/linux/sched.h
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/unistd.h' differs from latest version at 'arch/x86/include/uapi/asm/unistd.h'
diff -u tools/arch/x86/include/uapi/asm/unistd.h arch/x86/include/uapi/asm/unistd.h
sh: command: line 1: illegal option -c

 ----- Snip -----
You said this was for  aarch64.  Why is it looking in  arch/x86 ?

Offline polikuo

  • Hero Member
  • *****
  • Posts: 758
Re: Kernel tool: perf ?
« Reply #7 on: October 07, 2020, 11:27:38 AM »
You said this was for  aarch64.  Why is it looking in  arch/x86 ?

I honestly don't know.

Perhaps make just traverse every directories, doing ckecks ?

I assure you I'm using aarch64

Code: [Select]
tc@box:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51$ uname -r
5.4.51-piCore-v8
tc@box:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51$ uname -m
aarch64

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14851
Re: Kernel tool: perf ?
« Reply #8 on: October 07, 2020, 11:44:50 AM »
I suspect you will need libelf from elfutils rather than libelf from http://www.mr511.de/software/

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: Kernel tool: perf ?
« Reply #9 on: October 07, 2020, 01:05:17 PM »
https://bugzilla.redhat.com/show_bug.cgi?id=1793473

So it's your gcc being too new for that perf version. You can likely find patches to make it build with that gcc.
The only barriers that can stop you are the ones you create yourself.

Offline polikuo

  • Hero Member
  • *****
  • Posts: 758
Re: Kernel tool: perf ?
« Reply #10 on: October 07, 2020, 01:17:55 PM »
I suspect you will need libelf from elfutils rather than libelf from http://www.mr511.de/software/

 :(

The elfutils compiles successfully.
(./configure --prefix=/usr/local --enable-libdebuginfod=dummy --disable-debuginfod)

Since I'm lazy, I just do a sudo make install.

But perf still stuck at the same place after installing elfutils.

I have tried different versions of the kernel source code, they all stuck at the same place.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1268
Re: Kernel tool: perf ?
« Reply #11 on: October 07, 2020, 04:07:51 PM »
You likely need to have a valid .config in the kernel source tree.   You can get the current config

Code: [Select]
sudo modprobe configs
zcat /proc/config.gz > <path to kernel source>/.config

All of the errors with regard to multiple function definitions is likely due to gcc10.  Gcc is now very picky about properly using extern for external functions.  There maybe a -Wnoxxxxxxx flag to permit these errors.

Offline polikuo

  • Hero Member
  • *****
  • Posts: 758
Re: Kernel tool: perf ?
« Reply #12 on: October 07, 2020, 10:25:45 PM »
You likely need to have a valid .config in the kernel source tree.   You can get the current config

I've created the .config file

The message looks really similar:
Code: [Select]
tc@box:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51$ make -C tools/perf clean
make: Entering directory '/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf'
  CLEAN    arm64
  CLEAN    libtraceevent
  CLEAN    libapi
  CLEAN    libbpf
  CLEAN    libsubcmd
  CLEAN    libsubcmd
  CLEAN    libperf
  CLEAN    config
  CLEAN    fixdep
  CLEAN    python
  CLEAN    core-objs
  CLEAN    core-progs
  CLEAN    core-gen
  SUBDIR   Documentation
Makefile:215: Please install asciidoc xmlto to have the man pages installed
  CLEAN    Documentation
make: Leaving directory '/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf'
tc@box:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51$ make -C tools/perf
make: Entering directory '/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf'
  BUILD:   Doing 'make -j4' parallel build
  HOSTCC   fixdep.o
  HOSTLD   fixdep-in.o
  LINK     fixdep
Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h'
diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h
Warning: Kernel ABI header at 'tools/include/uapi/linux/sched.h' differs from latest version at 'include/uapi/linux/sched.h'
diff -u tools/include/uapi/linux/sched.h include/uapi/linux/sched.h
Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
Warning: Kernel ABI header at 'tools/arch/x86/include/uapi/asm/unistd.h' differs from latest version at 'arch/x86/include/uapi/asm/unistd.h'
diff -u tools/arch/x86/include/uapi/asm/unistd.h arch/x86/include/uapi/asm/unistd.h
sh: command: line 1: illegal option -c

Auto-detecting system features:
...                         dwarf: [ on  ]
...            dwarf_getlocations: [ on  ]
...                         glibc: [ on  ]
...                          gtk2: [ OFF ]
...                      libaudit: [ OFF ]
...                        libbfd: [ on  ]
...                        libcap: [ on  ]
...                        libelf: [ on  ]
...                       libnuma: [ OFF ]
...        numa_num_possible_cpus: [ OFF ]
...                       libperl: [ OFF ]
...                     libpython: [ OFF ]
...                     libcrypto: [ on  ]
...                     libunwind: [ OFF ]
...            libdw-dwarf-unwind: [ on  ]
...                          zlib: [ on  ]
...                          lzma: [ on  ]
...                     get_cpuid: [ OFF ]
...                           bpf: [ on  ]
...                        libaio: [ on  ]
...                       libzstd: [ on  ]
...        disassembler-four-args: [ on  ]

Makefile.config:506: No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev
Makefile.config:554: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
Makefile.config:662: slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev
Makefile.config:679: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
Makefile.config:706: Missing perl devel files. Disabling perl scripting support, please install perl-ExtUtils-Embed/libperl-dev
Makefile.config:733: No python interpreter was found: disables Python support - please install python-devel/python-dev
Makefile.config:791: No bfd.h/libbfd found, please install binutils-dev[el]/zlib-static/libiberty-dev to gain symbol demangling
Makefile.config:859: No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev
Makefile.config:914: No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev
Makefile.config:940: No alternatives command found, you need to set JDIR= to point to the root of your Java directory
  CC       fd/array.o
  CC       exec-cmd.o
  CC       event-parse.o
  CC       core.o
  CC       cpumap.o
  LD       fd/libapi-in.o
  CC       fs/fs.o
  CC       help.o
  CC       threadmap.o
  CC       fs/tracing_path.o
  CC       evsel.o
  LD       fs/libapi-in.o
  CC       cpu.o
  CC       pager.o
  CC       debug.o
  CC       evlist.o
  CC       str_error_r.o
  LD       libapi-in.o
  CC       parse-options.o
  AR       libapi.a
  CC       zalloc.o
  MKDIR    staticobjs/
  CC       staticobjs/libbpf.o
  CC       xyarray.o
  CC       lib.o
  LD       libperf-in.o
  AR       libperf.a
  MKDIR    staticobjs/
  CC       staticobjs/bpf.o
  CC       run-command.o
  CC       sigchain.o
  CC       subcmd-config.o
  LD       libsubcmd-in.o
  AR       libsubcmd.a
  CC       staticobjs/nlattr.o
  PERF_VERSION = 5.4.51
  CC       staticobjs/btf.o
  CC       event-plugin.o
  GEN      common-cmds.h
  CC       trace-seq.o
  CC       parse-filter.o
  CC       parse-utils.o
  CC       kbuffer-parse.o
  CC       tep_strerror.o
  CC       event-parse-api.o
  CC       staticobjs/libbpf_errno.o
  CC       staticobjs/str_error.o
  CC       staticobjs/netlink.o
  CC       staticobjs/bpf_prog_linfo.o
  LD       libtraceevent-in.o
  LINK     libtraceevent.a
  CC       staticobjs/libbpf_probes.o
  CC       staticobjs/xsk.o
  CC       staticobjs/hashmap.o
  CC       staticobjs/btf_dump.o
find: unknown predicate `-march=armv8-a+crc/arch'
gcc: fatal error: no input files
compilation terminated.
gcc: fatal error: no input files
compilation terminated.
  HOSTCC   pmu-events/json.o
  DESCEND  plugins
  CC       plugin_jbd2.o
  HOSTCC   pmu-events/jsmn.o
  LD       plugin_jbd2-in.o
  CC       plugin_hrtimer.o
  HOSTCC   pmu-events/jevents.o
  CC       plugin_kmem.o
  LD       plugin_hrtimer-in.o
  GEN      perf-archive
  CC       plugin_kvm.o
  LD       plugin_kmem-in.o
  GEN      perf-with-kcore
  CC       plugin_mac80211.o
  LD       plugin_mac80211-in.o
  CC       builtin-bench.o
  HOSTLD   pmu-events/jevents-in.o
  CC       plugin_sched_switch.o
  LD       plugin_kvm-in.o
  LINK     pmu-events/jevents
  LD       staticobjs/libbpf-in.o
  LINK     libbpf.a
  CC       builtin-annotate.o
  CC       builtin-config.o
  LD       plugin_sched_switch-in.o
  CC       plugin_function.o
  GEN      pmu-events/pmu-events.c
  CC       pmu-events/pmu-events.o
  LD       pmu-events/pmu-events-in.o
  CC       plugin_xen.o
  LD       plugin_function-in.o
  CC       plugin_scsi.o
  LD       plugin_xen-in.o
  CC       builtin-diff.o
  CC       plugin_cfg80211.o
  LD       plugin_cfg80211-in.o
  LINK     plugin_jbd2.so
  LINK     plugin_hrtimer.so
  LINK     plugin_kmem.so
  LD       plugin_scsi-in.o
  LINK     plugin_kvm.so
  LINK     plugin_mac80211.so
  LINK     plugin_sched_switch.so
  LINK     plugin_function.so
  LINK     plugin_xen.so
  LINK     plugin_scsi.so
  LINK     plugin_cfg80211.so
  CC       builtin-evlist.o
  GEN      libtraceevent-dynamic-list
  CC       builtin-ftrace.o
make[3]: Nothing to be done for 'plugins/libtraceevent-dynamic-list'.
  CC       builtin-help.o
  CC       builtin-sched.o
  CC       builtin-buildid-list.o
  CC       builtin-buildid-cache.o
  CC       builtin-kallsyms.o
  CC       builtin-list.o
  CC       builtin-record.o
  CC       builtin-report.o
  CC       builtin-stat.o
  CC       builtin-timechart.o
  CC       builtin-top.o
  CC       builtin-script.o
  CC       builtin-kmem.o
  CC       builtin-lock.o
  CC       builtin-kvm.o
  CC       builtin-inject.o
In file included from /usr/include/stdio.h:867,
                 from util/dso.h:11,
                 from builtin-script.c:6:
In function 'fprintf',
    inlined from 'perf_sample__fprintf_regs.isra' at builtin-script.c:602:14:
/usr/include/bits/stdio2.h:100:10: error: '%5s' directive argument is null [-Werror=format-overflow=]
  100 |   return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  101 |    __va_arg_pack ());
      |    ~~~~~~~~~~~~~~~~~
  CC       builtin-mem.o
  CC       builtin-data.o
  CC       builtin-version.o
  CC       builtin-c2c.o
  CC       builtin-trace.o
  CC       builtin-probe.o
  CC       bench/sched-messaging.o
  CC       bench/sched-pipe.o
  CC       bench/mem-functions.o
cc1: all warnings being treated as errors
mv: cannot stat './.builtin-script.o.tmp': No such file or directory
make[3]: *** [/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/build/Makefile.build:96: builtin-script.o] Error 1
make[3]: *** Waiting for unfinished jobs....
  CC       bench/futex-hash.o
  CC       bench/futex-wake.o
  CC       bench/futex-wake-parallel.o
  CC       bench/futex-requeue.o
  CC       bench/futex-lock-pi.o
  CC       bench/epoll-wait.o
  CC       bench/epoll-ctl.o
  LD       bench/perf-in.o
ld: bench/futex-lock-pi.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-lock-pi.c:40: multiple definition of `runtime'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/futex-lock-pi.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-lock-pi.c:40: multiple definition of `end'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/futex-lock-pi.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-lock-pi.c:40: multiple definition of `start'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/epoll-wait.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/epoll-wait.c:93: multiple definition of `runtime'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/epoll-wait.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/epoll-wait.c:93: multiple definition of `end'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/epoll-wait.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/epoll-wait.c:93: multiple definition of `start'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/epoll-ctl.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/epoll-ctl.c:38: multiple definition of `runtime'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/epoll-ctl.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/epoll-ctl.c:38: multiple definition of `end'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
ld: bench/epoll-ctl.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/epoll-ctl.c:38: multiple definition of `start'; bench/futex-hash.o:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf/bench/futex-hash.c:40: first defined here
make[4]: *** [/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/build/Makefile.build:145: bench/perf-in.o] Error 1
make[3]: *** [/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/build/Makefile.build:139: bench] Error 2
make[2]: *** [Makefile.perf:597: perf-in.o] Error 2
make[1]: *** [Makefile.perf:221: sub-make] Error 2
make: *** [Makefile:70: all] Error 2
make: Leaving directory '/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51/tools/perf'

What's happening here ?
Is it related ?
Quote
find: unknown predicate `-march=armv8-a+crc/arch'
gcc: fatal error: no input files
compilation terminated.
gcc: fatal error: no input files
compilation terminated.
Code: [Select]
tc@box:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51$ echo $CC
gcc -march=armv8-a+crc -mtune=cortex-a72 -Os -pipe
tc@box:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51$ echo $CXX
g++ -march=armv8-a+crc -mtune=cortex-a72 -Os -pipe -fno-exceptions -fno-rtti

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11704
Re: Kernel tool: perf ?
« Reply #13 on: October 07, 2020, 11:04:13 PM »
Hi polikuo
...
Code: [Select]
tc@box:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51$ echo $CC
gcc -march=armv8-a+crc -mtune=cortex-a72 -Os -pipe
tc@box:/mnt/mmcblk0p2/compile/source_code/Kernel/linux-5.4.51$ echo $CXX
g++ -march=armv8-a+crc -mtune=cortex-a72 -Os -pipe -fno-exceptions -fno-rtti
I think  CC  and  CXX  are only supposed to specify the compilers name but not compiler flags.

Clear CC, CXX, CFLAGS, CXXFLAGS, etc. Then, run the make command and see if the build system can figure out the
settings itself.

Offline polikuo

  • Hero Member
  • *****
  • Posts: 758
Re: Kernel tool: perf ?
« Reply #14 on: October 08, 2020, 12:16:14 AM »
Clear CC, CXX, CFLAGS, CXXFLAGS, etc.

Code: [Select]
unset CC CXX
make -C tools/perf clean
make -C tools/perf

The `-march=armv8-a+crc/arch' message is gone, but anything else stays the same

Quote
In function 'fprintf',
    inlined from 'perf_sample__fprintf_regs.isra' at builtin-script.c:602:14:
/usr/include/bits/stdio2.h:100:10: error: '%5s' directive argument is null [-Werror=format-overflow=]
  100 |   return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  101 |    __va_arg_pack ());
      |    ~~~~~~~~~~~~~~~~~

Perhaps it requires certain library for __fprintf_chk ?