From patchwork Thu Nov 2 00:48:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prarit Bhargava X-Patchwork-Id: 10037761 X-Patchwork-Delegate: shuah@kernel.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A19FE60291 for ; Thu, 2 Nov 2017 00:48:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9568028541 for ; Thu, 2 Nov 2017 00:48:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8973628C4A; Thu, 2 Nov 2017 00:48:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1E9E28541 for ; Thu, 2 Nov 2017 00:48:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933888AbdKBAsU (ORCPT ); Wed, 1 Nov 2017 20:48:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49146 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932169AbdKBAsT (ORCPT ); Wed, 1 Nov 2017 20:48:19 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 978D78765D; Thu, 2 Nov 2017 00:48:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 978D78765D Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=prarit@redhat.com Received: from praritdesktop.bos.redhat.com (prarit-guest.khw.lab.eng.bos.redhat.com [10.16.186.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 03F6F5D6B4; Thu, 2 Nov 2017 00:48:18 +0000 (UTC) From: Prarit Bhargava To: linux-pm@vger.kernel.org Cc: Prarit Bhargava , Shuah Khan Subject: [PATCH] tools/power/cpupower: Add 64 bit library detection Date: Wed, 1 Nov 2017 20:48:17 -0400 Message-Id: <20171102004817.20124-1-prarit@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 02 Nov 2017 00:48:19 +0000 (UTC) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The kernel-tools-lib rpm is installing the library to /usr/lib64, and not /usr/lib as the cpupower Makefile is doing in the kernel tree. This resulted in a conflict between the two libraries. After looking at how other tools installed libraries, and looking at the perf code in tools/perf it looks like installing to /usr/lib64 for 64-bit arches is the correct thing to do. Checks with 'ldd cpupower' on SLES, RHEL, Fedora, and Ubuntu result in the correct binary AFAICT: [root@testsystem cpupower]# ldd cpupower | grep cpupower libcpupower.so.0 => /lib64/libcpupower.so.0 (0x00007f1dab447000) P. ----8<---- Commit ac5a181d065d ("cpupower: Add cpuidle parts into library") added a new cpupower library version. On Fedora, executing the cpupower binary then resulted in this error [root@testsystem cpupower]# ./cpupower monitor ./cpupower: symbol lookup error: ./cpupower: undefined symbol: get_cpu_topology 64-bit libraries should be installed to /usr/lib64, and other libraries should be installed to /usr/lib. This code was taken from the perf Makefile.config which supports /usr/lib and /usr/lib64. Signed-off-by: Prarit Bhargava Cc: Shuah Khan --- tools/power/cpupower/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile index d6e1c02ddcfe..da205d1fa03c 100644 --- a/tools/power/cpupower/Makefile +++ b/tools/power/cpupower/Makefile @@ -30,6 +30,8 @@ OUTDIR := $(shell cd $(OUTPUT) && /bin/pwd) $(if $(OUTDIR),, $(error output directory "$(OUTPUT)" does not exist)) endif +include ../../scripts/Makefile.arch + # --- CONFIGURATION BEGIN --- # Set the following to `true' to make a unstripped, unoptimized @@ -79,7 +81,11 @@ bindir ?= /usr/bin sbindir ?= /usr/sbin mandir ?= /usr/man includedir ?= /usr/include +ifeq ($(IS_64_BIT), 1) +libdir ?= /usr/lib64 +else libdir ?= /usr/lib +endif localedir ?= /usr/share/locale docdir ?= /usr/share/doc/packages/cpupower confdir ?= /etc/