* [PATCH] cpupower: change binding's makefile to use -lcpupower
@ 2025-04-29 20:47 John B. Wyatt IV
2025-05-02 19:56 ` Shuah Khan
0 siblings, 1 reply; 2+ messages in thread
From: John B. Wyatt IV @ 2025-04-29 20:47 UTC (permalink / raw)
To: Shuah Khan, Thomas Renninger
Cc: John B. Wyatt IV, linux-pm, Shuah Khan, Rafael J. Wysocki,
linux-kernel, John Kacur, John B. Wyatt IV, Wander Lairson Costa
Originally I believed I needed the .o files to make the bindings. The
linking failed due to a missing .so link in Fedora or by using make
install-lib from the cpupower directory. Amend the makefile and the
README.
Big thanks to Wander Lairson Costa <wander@redhat.com> for the help.
Signed-off-by: "John B. Wyatt IV" <jwyatt@redhat.com>
Signed-off-by: "John B. Wyatt IV" <sageofredondo@gmail.com>
---
tools/power/cpupower/bindings/python/Makefile | 8 +++-----
tools/power/cpupower/bindings/python/README | 13 ++++++++-----
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/tools/power/cpupower/bindings/python/Makefile b/tools/power/cpupower/bindings/python/Makefile
index 741f21477432..81db39a03efb 100644
--- a/tools/power/cpupower/bindings/python/Makefile
+++ b/tools/power/cpupower/bindings/python/Makefile
@@ -1,22 +1,20 @@
# SPDX-License-Identifier: GPL-2.0-only
# Makefile for libcpupower's Python bindings
#
-# This Makefile expects you have already run the makefile for cpupower to build
-# the .o files in the lib directory for the bindings to be created.
+# This Makefile expects you have already run `make install-lib` in the lib
+# directory for the bindings to be created.
CC := gcc
HAVE_SWIG := $(shell if which swig >/dev/null 2>&1; then echo 1; else echo 0; fi)
HAVE_PYCONFIG := $(shell if which python-config >/dev/null 2>&1; then echo 1; else echo 0; fi)
-LIB_DIR := ../../lib
PY_INCLUDE = $(firstword $(shell python-config --includes))
-OBJECTS_LIB = $(wildcard $(LIB_DIR)/*.o)
INSTALL_DIR = $(shell python3 -c "import site; print(site.getsitepackages()[0])")
all: _raw_pylibcpupower.so
_raw_pylibcpupower.so: raw_pylibcpupower_wrap.o
- $(CC) -shared $(OBJECTS_LIB) raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so
+ $(CC) -shared -lcpupower raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so
raw_pylibcpupower_wrap.o: raw_pylibcpupower_wrap.c
$(CC) -fPIC -c raw_pylibcpupower_wrap.c $(PY_INCLUDE)
diff --git a/tools/power/cpupower/bindings/python/README b/tools/power/cpupower/bindings/python/README
index 952e2e02fd32..2a4896b648b7 100644
--- a/tools/power/cpupower/bindings/python/README
+++ b/tools/power/cpupower/bindings/python/README
@@ -5,18 +5,21 @@ libcpupower (aside from the libcpupower object files).
requirements
------------
-* You need the object files in the libcpupower directory compiled by
-cpupower's makefile.
+* If you are building completely from upstream; please install libcpupower by
+running `make install-lib` within the cpupower directory. This installs the
+libcpupower.so file and symlinks needed. Otherwise, please make sure a symlink
+to libcpupower.so exists in your library path from your distribution's
+packages.
* The SWIG program must be installed.
-* The Python's development libraries installed.
+* The Python's development libraries must be installed.
Please check that your version of SWIG is compatible with the version of Python
installed on your machine by checking the SWIG changelog on their website.
https://swig.org/
Note that while SWIG itself is GPL v3+ licensed; the resulting output,
-the bindings code: is permissively licensed + the license of libcpupower's .o
-files. For these bindings that means GPL v2.
+the bindings code: is permissively licensed + the license of libcpupower's
+library files. For these bindings that means GPL v2.
Please see https://swig.org/legal.html and the discussion [1] for more details.
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] cpupower: change binding's makefile to use -lcpupower
2025-04-29 20:47 [PATCH] cpupower: change binding's makefile to use -lcpupower John B. Wyatt IV
@ 2025-05-02 19:56 ` Shuah Khan
0 siblings, 0 replies; 2+ messages in thread
From: Shuah Khan @ 2025-05-02 19:56 UTC (permalink / raw)
To: John B. Wyatt IV, Thomas Renninger
Cc: linux-pm, Shuah Khan, Rafael J. Wysocki, linux-kernel, John Kacur,
John B. Wyatt IV, Wander Lairson Costa, Shuah Khan
On 4/29/25 14:47, John B. Wyatt IV wrote:
> Originally I believed I needed the .o files to make the bindings. The
> linking failed due to a missing .so link in Fedora or by using make
> install-lib from the cpupower directory. Amend the makefile and the
> README.
>
> Big thanks to Wander Lairson Costa <wander@redhat.com> for the help.
>
> Signed-off-by: "John B. Wyatt IV" <jwyatt@redhat.com>
> Signed-off-by: "John B. Wyatt IV" <sageofredondo@gmail.com>
> ---
> tools/power/cpupower/bindings/python/Makefile | 8 +++-----
> tools/power/cpupower/bindings/python/README | 13 ++++++++-----
> 2 files changed, 11 insertions(+), 10 deletions(-)
Applied now for Linux 6.16-rc1 - will be included in pull request to
PM maintainer.
https://web.git.kernel.org/pub/scm/linux/kernel/git/shuah/linux.git/log/?h=cpupower
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-05-02 19:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-29 20:47 [PATCH] cpupower: change binding's makefile to use -lcpupower John B. Wyatt IV
2025-05-02 19:56 ` Shuah Khan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox