Skip to content

Commit

Permalink
tools/power/cpupower: Add 64 bit library detection
Browse files Browse the repository at this point in the history
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)

Commit ac5a181 ("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 <[email protected]>
Cc: Shuah Khan <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
  • Loading branch information
prarit authored and Shuah Khan committed Nov 9, 2017
1 parent 9da779c commit d4dbfa4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tools/power/cpupower/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/
Expand Down

0 comments on commit d4dbfa4

Please sign in to comment.