编译perf

参考:perf编译和使用_aalace的博客-CSDN博客_perf编译

1. perf工具的源码已经嵌入到linux的tools目录下

2.进入到tools目录下 执行

make ARCH=arm CROSS_COMPILE=/usr/local/gcc-linaro_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- perf LDFLAGS+=--static NO_LIBELF=1 V=1 WERROR=0 NO_SLANG=1 NO_GTK2=1 NO_LIBAUDIT=1 NO_LIBNUMA=1 NO_LIBPERL=1 NO_STRLCPY=1

编译arm64,linux 5.4

改了这个:

-#include
+//#include

换个旧的编译器才编译成功

再改这个:

@@ -129,11 +129,8 @@ DYNAMIC_LIST_FILE := $(OUTPUT)libtraceevent-dynamic-list
 PLUGINS  = plugin_jbd2.so
 PLUGINS += plugin_hrtimer.so
 PLUGINS += plugin_kmem.so
-PLUGINS += plugin_kvm.so
 PLUGINS += plugin_mac80211.so
 PLUGINS += plugin_sched_switch.so
-PLUGINS += plugin_function.so
-PLUGINS += plugin_xen.so
 PLUGINS += plugin_scsi.so
 PLUGINS += plugin_cfg80211.so

才能 LDFLAGS+=--static

cat perf/Makefile.perf | grep Define
# Define V to have a more verbose compile.
# Define VF to have a more verbose feature check output.
# Define O to save output files in a separate directory.
# Define ARCH as name of target architecture if you want cross-builds.
# Define CROSS_COMPILE as prefix name of compiler if you want cross-builds.
# Define NO_LIBPERL to disable perl script extension.
# Define NO_LIBPYTHON to disable python script extension.
# Define PYTHON to point to the python binary if the default
# Define PYTHON_CONFIG to point to the python-config binary if
# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
# Define LDFLAGS=-static to build a static binary.
# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
# Define EXCLUDE_EXTLIBS=-lmylib to exclude libmylib from the auto-generated
# Define EXTRA_PERFLIBS to pass extra libraries to PERFLIBS.
# Define NO_DWARF if you do not want debug-info analysis feature at all.
# Define WERROR=0 to disable treating any warnings as errors.
# Define NO_NEWT if you do not want TUI support. (deprecated)
# Define NO_SLANG if you do not want TUI support.
# Define NO_GTK2 if you do not want GTK+ GUI support.
# Define NO_DEMANGLE if you do not want C++ symbol demangling.
# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
# Define NO_BACKTRACE if you do not want stack backtrace debug feature
# Define NO_LIBNUMA if you do not want numa perf benchmark
# Define NO_LIBAUDIT if you do not want libaudit support
# Define NO_LIBBIONIC if you do not want bionic support
# Define NO_LIBCRYPTO if you do not want libcrypto (openssl) support
# Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support
# Define NO_PERF_READ_VDSO32 if you do not want to build perf-read-vdso32
# Define NO_PERF_READ_VDSOX32 if you do not want to build perf-read-vdsox32
# Define NO_ZLIB if you do not want to support compressed kernel modules
# Define NO_LIBBABELTRACE if you do not want libbabeltrace support
# Define NO_LZMA if you do not want to support compressed (xz) kernel modules
# Define NO_AUXTRACE if you do not want AUX area tracing support
# Define NO_LIBBPF if you do not want BPF support
# Define NO_SDT if you do not want to define SDT event in perf tools,
# Define FEATURES_DUMP to provide features detection dump file
# Define NO_JVMTI if you do not want jvmti agent built
# Define LIBCLANGLLVM if you DO want builtin clang and llvm support.
# Define NO_CORESIGHT if you do not want support for CoreSight trace decoding.

你可能感兴趣的:(linux,app,linux)