Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp32134764rwd; Fri, 7 Jul 2023 09:08:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlF4JspSAlsgY5drCNZiSFXaZLB4dUgipmMoRwURqTqDf07ThNo3d0QJcjrEQqskz1u4B/ad X-Received: by 2002:a05:6830:1d5b:b0:6b8:9a14:91f5 with SMTP id p27-20020a0568301d5b00b006b89a1491f5mr5735923oth.21.1688746089702; Fri, 07 Jul 2023 09:08:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688746089; cv=none; d=google.com; s=arc-20160816; b=ueNwfD8FEkFu3NHeoWmMIaI3UF/BQYWsP+5ettTOmFtAAoWF1WJzdwjRLqbnkmF4yO c2bmxY+Y+SV/yk+kewdq8sgBzXvzlRkMMx6ngL9nFw4E4CLUsWxdVbbWarOTSlnu6zKT 3DfeeT7knEb9Leg6zuFK32495E5u99ZzISJ58ANYThboq2kv89Kr7nuDIEIhCKCkUnUh UHQtSQGzGC7Bu+hkB0pZsDdsEdUzwbYzZsY2cXco22TG9ZGDU3HBedGy3gfZrm7neYOV +PYIAXBEDIDi6f5rgPTazMTJGUlgNu6lv0aBdJJl4PvRQ9qM29178zVgsr1EAlykLw79 6dzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=/KltPBvory36KEH0szxNmOj1XQREuvF/LAoqPXiFNp8=; fh=OCLoRSYOdSSO5PQ6QXiH4qGgRzVFOFRuQ0MVo5Fl5v8=; b=prIrfcw9STpqBtnv7gncH6JVUU6LfHOmfQTXQfXTGiWzVgmblHuaEsQ6IADwru8Dzn M6/8xi7TazSjoc//qgsZvimuBUAhjJXPGxIgKTu8Zp+do/dETf1qmU8R/qmxv/c9TZfk exKcGM7mfp23KX/cNRxi+BkHGvck3I+R1JYtsgekly96GYVh/FhhH/3GuZVJMebF//w3 EK4xhlL/JnxhTkCK6z5Vn0wSoPEbfV5c9n7SLlG8Dgx3eyAp06ilm/HolgUfWjr5ueRY ECZ9U8lUTHvrO+UqgO9zNLXak0g1ejnOBC2rqteiNvjV4PSBjYGByWuahDKZbIi1weZv T51w== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z32-20020a631920000000b0053f212830aesi4061690pgl.311.2023.07.07.09.07.57; Fri, 07 Jul 2023 09:08:09 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232781AbjGGPqK (ORCPT + 99 others); Fri, 7 Jul 2023 11:46:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232438AbjGGPqF (ORCPT ); Fri, 7 Jul 2023 11:46:05 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 226C62121; Fri, 7 Jul 2023 08:46:04 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E5AFDD75; Fri, 7 Jul 2023 08:46:45 -0700 (PDT) Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C87373F762; Fri, 7 Jul 2023 08:46:01 -0700 (PDT) From: James Clark To: linux-perf-users@vger.kernel.org, radhey.shyam.pandey@amd.com 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 , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , linux-kernel@vger.kernel.org Subject: [PATCH] perf build: Fix library not found error when using CSLIBS Date: Fri, 7 Jul 2023 16:45:46 +0100 Message-Id: <20230707154546.456720-1-james.clark@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,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 -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