Skip to content

Commit 62ec3f2

Browse files
author
John B. Wyatt IV
committed
cpupower: change binding's makefile to use -lcpupower
JIRA: https://issues.redhat.com/browse/RHEL-91191 Upstream Status: git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git commit 99d2fce Author: John B. Wyatt IV <jwyatt@redhat.com> Date: Tue Apr 29 16:47:10 2025 -0400 cpupower: change binding's makefile to use -lcpupower 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. Link: https://lore.kernel.org/r/20250429204711.127274-1-jwyatt@redhat.com Signed-off-by: "John B. Wyatt IV" <jwyatt@redhat.com> Signed-off-by: "John B. Wyatt IV" <sageofredondo@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: John B. Wyatt IV <jwyatt@redhat.com>
1 parent 73e44a5 commit 62ec3f2

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

tools/power/cpupower/bindings/python/Makefile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
# Makefile for libcpupower's Python bindings
33
#
4-
# This Makefile expects you have already run the makefile for cpupower to build
5-
# the .o files in the lib directory for the bindings to be created.
4+
# This Makefile expects you have already run `make install-lib` in the lib
5+
# directory for the bindings to be created.
66

77
CC := gcc
88
HAVE_SWIG := $(shell if which swig >/dev/null 2>&1; then echo 1; else echo 0; fi)
99
HAVE_PYCONFIG := $(shell if which python-config >/dev/null 2>&1; then echo 1; else echo 0; fi)
1010

11-
LIB_DIR := ../../lib
1211
PY_INCLUDE = $(firstword $(shell python-config --includes))
13-
OBJECTS_LIB = $(wildcard $(LIB_DIR)/*.o)
1412
INSTALL_DIR = $(shell python3 -c "import site; print(site.getsitepackages()[0])")
1513

1614
all: _raw_pylibcpupower.so
1715

1816
_raw_pylibcpupower.so: raw_pylibcpupower_wrap.o
19-
$(CC) -shared $(OBJECTS_LIB) raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so
17+
$(CC) -shared -lcpupower raw_pylibcpupower_wrap.o -o _raw_pylibcpupower.so
2018

2119
raw_pylibcpupower_wrap.o: raw_pylibcpupower_wrap.c
2220
$(CC) -fPIC -c raw_pylibcpupower_wrap.c $(PY_INCLUDE)

tools/power/cpupower/bindings/python/README

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@ libcpupower (aside from the libcpupower object files).
55
requirements
66
------------
77

8-
* You need the object files in the libcpupower directory compiled by
9-
cpupower's makefile.
8+
* If you are building completely from upstream; please install libcpupower by
9+
running `make install-lib` within the cpupower directory. This installs the
10+
libcpupower.so file and symlinks needed. Otherwise, please make sure a symlink
11+
to libcpupower.so exists in your library path from your distribution's
12+
packages.
1013
* The SWIG program must be installed.
11-
* The Python's development libraries installed.
14+
* The Python's development libraries must be installed.
1215

1316
Please check that your version of SWIG is compatible with the version of Python
1417
installed on your machine by checking the SWIG changelog on their website.
1518
https://swig.org/
1619

1720
Note that while SWIG itself is GPL v3+ licensed; the resulting output,
18-
the bindings code: is permissively licensed + the license of libcpupower's .o
19-
files. For these bindings that means GPL v2.
21+
the bindings code: is permissively licensed + the license of libcpupower's
22+
library files. For these bindings that means GPL v2.
2023

2124
Please see https://swig.org/legal.html and the discussion [1] for more details.
2225

0 commit comments

Comments
 (0)