Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp36973675rwd; Tue, 11 Jul 2023 07:59:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlHUAJBPIN63bQgUlrUdKg1GIUA09Gd+toXBSBJSqhQG/8Z8u6/q/U6clMeU+vqWjIfWEHdE X-Received: by 2002:a05:6a20:442a:b0:11b:3e33:d2ce with SMTP id ce42-20020a056a20442a00b0011b3e33d2cemr21677837pzb.1.1689087562096; Tue, 11 Jul 2023 07:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689087562; cv=none; d=google.com; s=arc-20160816; b=CeQLbk0+VEWpLwl3sKfe0tS+0o+posdiIl275zOx9FHJKY2/7zfPTxUJ4c+P2qNLUj LrJHfb2uP2UNzPEA4DkcWUIb7dkvZlI2lberxSim6v0Kg+m/Qq6Gwnk+JR6+F6USbrVv Xgiva1qgZ5KYpw9ysUy5RABpXDvrjDlrx3Ea6gmpJW3Uf+uS82IgTEovBZzmPZQpQ0/4 AbC8C9KPMzAYXjoB7JRZOViaTrhe6aqFIwFNNpxP4IUNa5hc91vATvh6rFeeXnz5bfkW uvPOFW2ng9fGFQAUHQpCX9XoVLZ6W1r4Rguqyp7MF6oy0h45x++n1gIlcJjo33OlqYHY foKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=wt+D1ha7sY2XHY3/8uWUfCdLqNWo4JVuwdm0zvDyJyM=; fh=+x6dF1EKKLW/jrAnD12Qdm6AlRpM4RRZQ51OdsSOZd4=; b=Tbd3c6Ou8PBM9hCQe2ZJv8nNkK4/BfRFlnxzXJ/x51NZievcvDxxT2KjJngtAHqa1p CtYV33c2dYFOkGoj3jPikzCA8KJrxJuetQb9Chhkn+lY3+qJs9idLSoUrk2ARZQqkJS4 4ViBq8C2g19sz6bwO7cjUICS/iNN5Gf95O+fuIT14vTp6onyM9AOv8rT4O8KPpH2P32s PtUALva6zAxGUnvmpixzP6X1ucuVXQeHVT4MP15OVz6KPc7hci9z36qYjVVBpNb60LBT RVkQLB26Wte9TS+HKm6eOGoXObn7lXN70JLu37MxeyShiUEQCJJ6tRzb4XafqK5Chncg GdGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oINXfCrv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s14-20020a65644e000000b0055b1327cd9asi1588020pgv.175.2023.07.11.07.59.09; Tue, 11 Jul 2023 07:59:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oINXfCrv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232065AbjGKOqe (ORCPT + 99 others); Tue, 11 Jul 2023 10:46:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229837AbjGKOqd (ORCPT ); Tue, 11 Jul 2023 10:46:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ED99BC; Tue, 11 Jul 2023 07:46:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B095D61516; Tue, 11 Jul 2023 14:46:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA5FFC433C8; Tue, 11 Jul 2023 14:46:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689086791; bh=3WlG9NIJ9IJ14F4KJ6TLUGvBBU5GtmsGOlO1DrBuxq8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oINXfCrvcaBirhpikeSfDD/oMCD4/pqb52pznbD3fbcLQLZcorp2Gk2NR/eVufmVE pNBJLt/autK22HGtSeCTrcjEiJGGNDWHvaDZ/zu2gxiSqytxjKtbc+l6gL7nTDe9cQ UDs1OY4LN52kWXlLs4G/66Bo1Y9Q+5n1RlLas8yx6L+JeNRI/GLGDutSvMONICt0v/ lZ6sYY9zVT7LUh81lfRPzKTPFWBHVy/T+RhGSPa31S2OHUNXYzwnviEBz/RSwRzRX9 UlbGH+RDL5HmZTspYp49R4CjDOLN3vXlg5nQMrbXfhcbdr7rEiIRoIakmH/q3Xwtlr N2guxncJsgGNA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 508A740516; Tue, 11 Jul 2023 11:46:28 -0300 (-03) Date: Tue, 11 Jul 2023 11:46:28 -0300 From: Arnaldo Carvalho de Melo To: "Pandey, Radhey Shyam" Cc: James Clark , "linux-perf-users@vger.kernel.org" , "coresight@lists.linaro.org" , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= , "linux-kernel@vger.kernel.org" , "Sarangi, Anirudha" Subject: Re: [PATCH] perf build: Fix library not found error when using CSLIBS Message-ID: References: <20230707154546.456720-1-james.clark@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Jul 11, 2023 at 08:28:31AM +0000, Pandey, Radhey Shyam escreveu: > > -----Original Message----- > > From: James Clark > > Sent: Friday, July 7, 2023 9:16 PM > > To: linux-perf-users@vger.kernel.org; Pandey, Radhey Shyam > > > > Cc: coresight@lists.linaro.org; James Clark ; Peter > > Zijlstra ; Ingo Molnar ; > > Arnaldo Carvalho de Melo ; Mark Rutland > > ; Alexander Shishkin > > ; Jiri Olsa ; > > Namhyung Kim ; Ian Rogers ; > > Adrian Hunter ; Uwe Kleine-König > koenig.org>; linux-kernel@vger.kernel.org > > Subject: [PATCH] perf build: Fix library not found error when using CSLIBS > > > > -L only specifies the search path for libraries directly provided in the link line > > with -l. Because -lopencsd isn't specified, it's only linked because it's a > > dependency of -lopencsd_c_api. Dependencies like this are resolved using > > the default system search paths or -rpath-link=... rather than -L. This means > > that compilation only works if OpenCSD is installed to the system rather than > > provided with the CSLIBS (-L) option. > > > > This could be fixed by adding -Wl,-rpath-link=$(CSLIBS) but that is less > > conventional than just adding -lopencsd to the link line so that it uses -L. - > > lopencsd seems to have been removed in commit ed17b1914978 ("perf > > tools: Drop requirement for libstdc++.so for libopencsd check") because it > > was thought that there was a chance compilation would work even if it didn't > > exist, but I think that only applies to libstdc++ so there is no harm to add it > > back. libopencsd.so and libopencsd_c_api.so would always exist together. > > > > Testing > > ======= > > > > The following scenarios now all work: > > > > * Cross build with OpenCSD installed > > * Cross build using CSLIBS=... > > * Native build with OpenCSD installed > > * Native build using CSLIBS=... > > * Static cross build with OpenCSD installed > > * Static cross build with CSLIBS=... > > > > Reported-by: Radhey Shyam Pandey > > Closes: https://lore.kernel.org/linux-arm-kernel/56905d7a-a91e-883a-b707- > > 9d5f686ba5f1@arm.com/ > > Link: https://lore.kernel.org/all/36cc4dc6-bf4b-1093-1c0a- > > 876e368af183@kleine-koenig.org/ > > Fixes: ed17b1914978 ("perf tools: Drop requirement for libstdc++.so for > > libopencsd check") > > Signed-off-by: James Clark > > --- > > tools/perf/Makefile.config | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index > > 0609c19caabd..c5db0de49868 100644 > > --- a/tools/perf/Makefile.config > > +++ b/tools/perf/Makefile.config > > @@ -155,9 +155,9 @@ FEATURE_CHECK_LDFLAGS-libcrypto = -lcrypto ifdef > > CSINCLUDES > > LIBOPENCSD_CFLAGS := -I$(CSINCLUDES) > > endif > > -OPENCSDLIBS := -lopencsd_c_api > > +OPENCSDLIBS := -lopencsd_c_api -lopencsd > > ifeq ($(findstring -static,${LDFLAGS}),-static) > > - OPENCSDLIBS += -lopencsd -lstdc++ > > + OPENCSDLIBS += -lstdc++ > > endif > > ifdef CSLIBS > > LIBOPENCSD_LDFLAGS := -L$(CSLIBS) > > -- > > 2.34.1 > > Tested-by: Radhey Shyam Pandey > Cross compiled for aarch64 on x86_64. > > make ARCH=arm64 NO_LIBELF=1 NO_JVMTI=1 VF=1 CORESIGHT=1 -C tools/perf > > file /linux-xlnx/tools/perf/perf > perf: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), > dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, > BuildID[sha1]=ef7c524338577b14e7c0f914d882dec4d26e93a2, > for GNU/Linux 3.14.0, with debug_info, not stripped Thanks for reporting and testing, applied to perf-tools. I see no problems in my common case which is: ⬢[acme@toolbox perf-tools]$ alias m='make -k BUILD_BPF_SKEL=1 CORESIGHT=1 O=/tmp/build/perf-tools -C tools/perf install-bin && git status && perf test python ; perf record -o /dev/null sleep 0.01 ; perf stat --null sleep 0.01' ⬢[acme@toolbox perf-tools]$ ⬢[acme@toolbox perf-tools]$ ldd ~/bin/perf | grep csd libopencsd_c_api.so.1 => /lib64/libopencsd_c_api.so.1 (0x00007f9c012ea000) libopencsd.so.1 => /lib64/libopencsd.so.1 (0x00007f9c00556000) ⬢[acme@toolbox perf-tools]$ - Arnaldo