From nobody Wed Apr 15 23:42:14 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 115FBC43219 for ; Wed, 16 Nov 2022 22:46:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238846AbiKPWqU (ORCPT ); Wed, 16 Nov 2022 17:46:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238781AbiKPWpd (ORCPT ); Wed, 16 Nov 2022 17:45:33 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B2306C739 for ; Wed, 16 Nov 2022 14:45:31 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-37f0f3e59b2so2468517b3.0 for ; Wed, 16 Nov 2022 14:45:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=9fahfTN7gQdYGghMf/BqQFGqnV5aYRbsgDQfX2spz1M=; b=J7ejO2+4pPwjvYasRYxGqprxcZToIIQir/+zCv8XJOXAMoIEz5oHnj13Y8NijHrFhl omJb9OhW/gqGpL1NLmRkpbxYcnrraM5LGPZJwFksGnOgQ/DzMb5BTrVy7kM1SmnB7TOZ ochF4Ipzbw6mYxgQRV+7WVG35O5xbVpFHMM+lIfNW2uizI14ZHcnEN6muh/uPbnLch2U wUcrjLJXXvi1Rf2bjwAzb608dtEh7Nn3O+4LPDUG0pKk52Bx7ZPJeXV6kxRD5SRH/AiW 37sWLNgegGpwsAPiqmGDEPYburNB4KofqnCAOFjBpivk2rXIBmw7axJX5G0D+ZbvwZ0p z1Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=9fahfTN7gQdYGghMf/BqQFGqnV5aYRbsgDQfX2spz1M=; b=3+j49SxJMOMcAyos38CfMQET/8k/tfXOLbq9HP7XKj2q6c3+VOu8028WFMK/rIplAj h/gLYCNBy8tnZjK5TTh3D5Gs4sxWp6xzuTbZ2TupY0vnwtIUgpeiT77y5SbIzO/0SB/j 8dKqPaLxaaW34UKev4ZhSOdY+3q+5iee3kpohqpYVLgtRdnmWISa/J+UBqL375bFtcGP pi9XuHTS4G/+QDD543VKrFdnNrKZ16hFLlXbQc5DVawYieh7j9FjymUsRSW3TnD5eR3J 00Nfd/XVP+tjr4SXm1wz0u5TAF3rK00krXLnBFFhrRUE/1gZYbOauPlzX/i7p5bw/Kv/ K3aA== X-Gm-Message-State: ANoB5pklu7UCjAOkGmOHxQb5RYzfrbqBHlMocvoTafKslMdyAB5ITOIM 5pKavgv/w+nzHtn7wrLRqa4xW+XUVonm X-Google-Smtp-Source: AA0mqf4Nb9ngGN3qX4fMKqqiImwtvR4v0w2iedkDOCXier2Uk2gOkfn2P+l1BjX+RTvpu1mgdn+Sr0cKx7BR X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:c14c:6035:5882:8faa]) (user=irogers job=sendgmr) by 2002:a25:55d4:0:b0:6ca:363a:9a1b with SMTP id j203-20020a2555d4000000b006ca363a9a1bmr23754825ybb.1.1668638730427; Wed, 16 Nov 2022 14:45:30 -0800 (PST) Date: Wed, 16 Nov 2022 14:45:11 -0800 Message-Id: <20221116224511.207235-1-irogers@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.38.1.431.g37b22c650d-goog Subject: [PATCH] perf build: Fix LIBTRACEEVENT_DYNAMIC From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Masahiro Yamada , Nicolas Schier , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, bpf@vger.kernel.org, Nick Desaulniers , Andrii Nakryiko Cc: Stephane Eranian , Ian Rogers Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The tools/lib includes fixes break LIBTRACEVENT_DYNAMIC as the makefile erroneously had depdendencies on building libtraceevent even when not linking with it. This change fixes the issues with LIBTRACEEVENT_DYNAMIC by making the built files optional. --- tools/perf/Makefile.perf | 25 ++++++++++++++++++++++--- tools/perf/util/setup.py | 3 ++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index dd096aba4430..59c4e8f9b014 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf @@ -242,8 +242,10 @@ sub-make: fixdep else # force_fixdep =20 LIBAPI_DIR =3D $(srctree)/tools/lib/api/ +ifndef LIBTRACEEVENT_DYNAMIC LIBTRACEEVENT_DIR =3D $(srctree)/tools/lib/traceevent/ LIBTRACEEVENT_PLUGINS_DIR =3D $(LIBTRACEEVENT_DIR)/plugins +endif LIBBPF_DIR =3D $(srctree)/tools/lib/bpf/ LIBSUBCMD_DIR =3D $(srctree)/tools/lib/subcmd/ LIBSYMBOL_DIR =3D $(srctree)/tools/lib/symbol/ @@ -293,6 +295,7 @@ SCRIPT_SH +=3D perf-iostat.sh grep-libs =3D $(filter -l%,$(1)) strip-libs =3D $(filter-out -l%,$(1)) =20 +ifndef LIBTRACEEVENT_DYNAMIC ifneq ($(OUTPUT),) LIBTRACEEVENT_OUTPUT =3D $(abspath $(OUTPUT))/libtraceevent else @@ -306,13 +309,16 @@ LIBTRACEEVENT =3D $(LIBTRACEEVENT_OUTPUT)/libtraceeve= nt.a export LIBTRACEEVENT LIBTRACEEVENT_DYNAMIC_LIST =3D $(LIBTRACEEVENT_PLUGINS_OUTPUT)/libtraceeve= nt-dynamic-list CFLAGS +=3D -I$(LIBTRACEEVENT_OUTPUT)/include - # # The static build has no dynsym table, so this does not work for # static build. Looks like linker starts to scream about that now # (in Fedora 26) so we need to switch it off for static build. DYNAMIC_LIST_LDFLAGS =3D -Xlinker --dynamic-list=3D$(LIBTRAC= EEVENT_DYNAMIC_LIST) LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS =3D $(if $(findstring -static,$(LDFLAGS= )),,$(DYNAMIC_LIST_LDFLAGS)) +else +LIBTRACEEVENT_DYNAMIC_LIST =3D +LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS =3D +endif =20 ifneq ($(OUTPUT),) LIBAPI_OUTPUT =3D $(abspath $(OUTPUT))/libapi @@ -375,7 +381,11 @@ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP python-clean :=3D $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) = $(OUTPUT)python/perf*.so =20 PYTHON_EXT_SRCS :=3D $(shell grep -v ^\# util/python-ext-sources) +ifndef LIBTRACEEVENT_DYNAMIC PYTHON_EXT_DEPS :=3D util/python-ext-sources util/setup.py $(LIBTRACEEVENT= ) $(LIBAPI) +else +PYTHON_EXT_DEPS :=3D util/python-ext-sources util/setup.py $(LIBAPI) +endif =20 SCRIPTS =3D $(patsubst %.sh,%,$(SCRIPT_SH)) =20 @@ -785,9 +795,12 @@ prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cm= ds.h archheaders $(drm_ioc $(LIBPERF) \ $(LIBSUBCMD) \ $(LIBSYMBOL) \ - $(LIBTRACEEVENT) \ bpf-skel =20 +ifndef LIBTRACEEVENT_DYNAMIC +prepare: $(LIBTRACEEVENT) +endif + $(OUTPUT)%.o: %.c prepare FORCE $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=3D$(build-dir) $@ =20 @@ -843,6 +856,7 @@ endif =20 $(patsubst perf-%,%.o,$(PROGRAMS)): $(wildcard */*.h) =20 +ifndef LIBTRACEEVENT_DYNAMIC LIBTRACEEVENT_FLAGS +=3D plugin_dir=3D$(plugindir_SQ) 'EXTRA_CFLAGS=3D$(EX= TRA_CFLAGS)' 'LDFLAGS=3D$(filter-out -static,$(LDFLAGS))' =20 $(LIBTRACEEVENT): FORCE | $(LIBTRACEEVENT_OUTPUT) @@ -872,6 +886,7 @@ install-traceevent-plugins: libtraceevent_plugins $(Q)$(MAKE) -C $(LIBTRACEEVENT_PLUGINS_DIR) O=3D$(LIBTRACEEVENT_PLUGINS_O= UTPUT) \ DESTDIR=3D$(LIBTRACEEVENT_PLUGINS_DESTDIR) prefix=3D \ $(LIBTRACEEVENT_FLAGS) install +endif =20 $(LIBAPI): FORCE | $(LIBAPI_OUTPUT) $(Q)$(MAKE) -C $(LIBAPI_DIR) O=3D$(LIBAPI_OUTPUT) \ @@ -1152,7 +1167,7 @@ endif # BUILD_BPF_SKEL bpf-skel-clean: $(call QUIET_CLEAN, bpf-skel) $(RM) -r $(SKEL_TMP_OUT) $(SKELETONS) =20 -clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD= )-clean $(LIBSYMBOL)-clean $(LIBPERF)-clean fixdep-clean python-clean bpf-s= kel-clean tests-coresight-targets-clean libtraceevent_plugins-clean +clean:: $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean $(LIBSYMBOL)-cl= ean $(LIBPERF)-clean fixdep-clean python-clean bpf-skel-clean tests-coresig= ht-targets-clean $(call QUIET_CLEAN, core-objs) $(RM) $(LIBPERF_A) $(OUTPUT)perf-archive = $(OUTPUT)perf-iostat $(LANG_BINDINGS) $(Q)find $(or $(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete= -o -name '\.*.d' -delete $(Q)$(RM) $(OUTPUT).config-detected @@ -1192,6 +1207,10 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIB= BPF)-clean $(LIBSUBCMD)-clea $(call QUIET_CLEAN, Documentation) \ $(MAKE) -C $(DOC_DIR) O=3D$(OUTPUT) clean >/dev/null =20 +ifndef LIBTRACEEVENT_DYNAMIC +clean:: $(LIBTRACEEVENT)-clean libtraceevent_plugins-clean +endif + # # To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY) # file if defined, with no further action. diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index 5b1e6468d5e8..43e7ca40b2ec 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py @@ -77,7 +77,8 @@ perf =3D Extension('perf', include_dirs =3D ['util/include'], libraries =3D extra_libraries, extra_compile_args =3D cflags, - extra_objects =3D [libtraceevent, libapikfs, libperf], + extra_objects =3D [ x for x in [libtraceevent, libapikfs, libperf] + if x is not None], ) =20 setup(name=3D'perf', --=20 2.38.1.431.g37b22c650d-goog