Skip to contentSkip to conversation

tools/power/cpupower: Add 64 bit library detection

PATCH Superseded Prarit Bhargava 1 participant 2 messages Sep 27, 2016 CPU power monitoring

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/power/cpupower: Add 64 bit library detection

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.

Cc Thomas Renninger <[email protected]>
---
 tools/power/cpupower/Makefile             |    6 ++++++
 tools/power/cpupower/libcpupower.so.0.0.1 |  Bin 0 -> 70760 bytes
 2 files changed, 6 insertions(+)
 create mode 100755 tools/power/cpupower/libcpupower.so.0.0.1
tools/power/cpupower/Makefile +6 -0
index 8358863259c5..a210f044fc85 100644
@@ -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/
tools/power/cpupower/libcpupower.so.0.0.1 new file binary +0 -0
new file mode 100755
index 0000000000000000000000000000000000000000..86cf76fa6d77802433ef3bb4e7b3de99c6865250
GIT binary patch
Signature · 1 line
1.7.9.3
#1 lore raw

tools/power/cpupower/libcpupower.so.0.0.1

Quoted 8 lines
tools/power/cpupower/libcpupower.so.0.0.1 new file binary +0 -0
new file mode 100755
index 0000000000000000000000000000000000000000..86cf76fa6d77802433ef3bb4e7b3de99c6865250
GIT binary patch

Ouch. Sorry about this ... I'll send a v2 with this removed.

P.