Message ID | 20240912125030.19809-1-minhuadotchen@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Shuah Khan |
Headers | show |
Series | [RFC,for-next] pm: cpupower: rename raw_pylibcpupower.i | expand |
On 9/12/24 06:50, Min-Hua Chen wrote: > This RFC patch is actually bug report. All *.i file will be > removed by 'make mrproper', including raw_pylibcpupower.i, added > by commit: 338f490e07bc ("pm:cpupower: Add SWIG bindings files for libcpupower") > > We can reproduce the error by performing the following command: > cd linux-next > make mrproper > cd tools/power/cpupower/bindings/python > make > > We will get an error message: > make: *** No rule to make target 'raw_pylibcpupower.i', needed by 'raw_pylibcpupower_wrap.c'. Stop. > > Renaming the raw_pylibcpupower.i is just a workaround to fix the > issue above. I need a non-rfc patch for this. Please send a proper patch I can pull in once John has a chance to review this. > > Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com> > --- > tools/power/cpupower/bindings/python/Makefile | 4 ++-- > .../python/{raw_pylibcpupower.i => raw_pylibcpupower.if} | 0 > 2 files changed, 2 insertions(+), 2 deletions(-) > rename tools/power/cpupower/bindings/python/{raw_pylibcpupower.i => raw_pylibcpupower.if} (100%) > > diff --git a/tools/power/cpupower/bindings/python/Makefile b/tools/power/cpupower/bindings/python/Makefile > index dc09c5b66ead..de872a1b80d3 100644 > --- a/tools/power/cpupower/bindings/python/Makefile > +++ b/tools/power/cpupower/bindings/python/Makefile > @@ -20,13 +20,13 @@ _raw_pylibcpupower.so: raw_pylibcpupower_wrap.o > raw_pylibcpupower_wrap.o: raw_pylibcpupower_wrap.c > $(CC) -fPIC -c raw_pylibcpupower_wrap.c $(PY_INCLUDE) > > -raw_pylibcpupower_wrap.c: raw_pylibcpupower.i > +raw_pylibcpupower_wrap.c: raw_pylibcpupower.if > ifeq ($(HAVE_SWIG),0) > $(error "swig was not found. Make sure you have it installed and in the PATH to generate the bindings.") > else ifeq ($(HAVE_PYCONFIG),0) > $(error "python-config was not found. Make sure you have it installed and in the PATH to generate the bindings.") > endif > - swig -python raw_pylibcpupower.i > + swig -python raw_pylibcpupower.if > > # Will only clean the bindings folder; will not clean the actual cpupower folder > clean: > diff --git a/tools/power/cpupower/bindings/python/raw_pylibcpupower.i b/tools/power/cpupower/bindings/python/raw_pylibcpupower.if > similarity index 100% > rename from tools/power/cpupower/bindings/python/raw_pylibcpupower.i > rename to tools/power/cpupower/bindings/python/raw_pylibcpupower.if thanks, -- Shuah
On Thu, Sep 12, 2024 at 10:31:19AM -0600, Shuah Khan wrote: > On 9/12/24 06:50, Min-Hua Chen wrote: > > This RFC patch is actually bug report. All *.i file will be > > removed by 'make mrproper', including raw_pylibcpupower.i, added > > by commit: 338f490e07bc ("pm:cpupower: Add SWIG bindings files for libcpupower") > > > > We can reproduce the error by performing the following command: > > cd linux-next > > make mrproper > > cd tools/power/cpupower/bindings/python > > make > > > > We will get an error message: > > make: *** No rule to make target 'raw_pylibcpupower.i', needed by 'raw_pylibcpupower_wrap.c'. Stop. > > > > Renaming the raw_pylibcpupower.i is just a workaround to fix the > > issue above. > > I need a non-rfc patch for this. Please send a proper patch > I can pull in once John has a chance to review this. I have reviewed and tested and this. I am good with it being a stopgap. Please send the non-rfc patch. Thank you for reporting and sending a patch for this Min-Hua. Reviewed-by: John B. Wyatt IV <jwyatt@redhat.com> Reviewed-by: John B. Wyatt IV <sageofredondo@gmail.com> Tested-by: John B. Wyatt IV <jwyatt@redhat.com> Tested-by: John B. Wyatt IV <sageofredondo@gmail.com>
On 9/12/24 11:36, John B. Wyatt IV wrote: > On Thu, Sep 12, 2024 at 10:31:19AM -0600, Shuah Khan wrote: >> On 9/12/24 06:50, Min-Hua Chen wrote: >>> This RFC patch is actually bug report. All *.i file will be >>> removed by 'make mrproper', including raw_pylibcpupower.i, added >>> by commit: 338f490e07bc ("pm:cpupower: Add SWIG bindings files for libcpupower") >>> >>> We can reproduce the error by performing the following command: >>> cd linux-next >>> make mrproper >>> cd tools/power/cpupower/bindings/python >>> make >>> >>> We will get an error message: >>> make: *** No rule to make target 'raw_pylibcpupower.i', needed by 'raw_pylibcpupower_wrap.c'. Stop. >>> >>> Renaming the raw_pylibcpupower.i is just a workaround to fix the >>> issue above. >> >> I need a non-rfc patch for this. Please send a proper patch >> I can pull in once John has a chance to review this. > How and when is raw_pylibcpupower.i generated? This looks like a pre-processor output. > I have reviewed and tested and this. I am good with it being a stopgap. I am okay with the stopgap, but I do want i explore other solutions. > > Please send the non-rfc patch. > > Thank you for reporting and sending a patch for this Min-Hua. > > Reviewed-by: John B. Wyatt IV <jwyatt@redhat.com> > Reviewed-by: John B. Wyatt IV <sageofredondo@gmail.com> > Tested-by: John B. Wyatt IV <jwyatt@redhat.com> > Tested-by: John B. Wyatt IV <sageofredondo@gmail.com> > thanks, -- Shuah
Hi, >On Thu, Sep 12, 2024 at 10:31:19AM -0600, Shuah Khan wrote: >> On 9/12/24 06:50, Min-Hua Chen wrote: >> > This RFC patch is actually bug report. All *.i file will be >> > removed by 'make mrproper', including raw_pylibcpupower.i, added >> > by commit: 338f490e07bc ("pm:cpupower: Add SWIG bindings files for libcpupower") >> > >> > We can reproduce the error by performing the following command: >> > cd linux-next >> > make mrproper >> > cd tools/power/cpupower/bindings/python >> > make >> > >> > We will get an error message: >> > make: *** No rule to make target 'raw_pylibcpupower.i', needed by 'raw_pylibcpupower_wrap.c'. Stop. >> > >> > Renaming the raw_pylibcpupower.i is just a workaround to fix the >> > issue above. >> >> I need a non-rfc patch for this. Please send a proper patch >> I can pull in once John has a chance to review this. > >I have reviewed and tested and this. I am good with it being a stopgap. > >Please send the non-rfc patch. > >Thank you for reporting and sending a patch for this Min-Hua. > >Reviewed-by: John B. Wyatt IV <jwyatt@redhat.com> >Reviewed-by: John B. Wyatt IV <sageofredondo@gmail.com> >Tested-by: John B. Wyatt IV <jwyatt@redhat.com> >Tested-by: John B. Wyatt IV <sageofredondo@gmail.com> Thank you for reviewing this patch, I will submit a non-rfc patch later. cheers, Min-Hua
AFAIK, raw_pylibcpupower.i is not a generated file, it is a interface file for swig. The *.i file extension is also used for pre-processor output (single target build) and all *.i files are removed by 'make mrproper', including raw_pylibcpupower.i (should not be removed). thanks, Min-Hua > > >> I have reviewed and tested and this. I am good with it being a stopgap. > >I am okay with the stopgap, but I do want i explore other solutions. >> >> Please send the non-rfc patch. >> >> Thank you for reporting and sending a patch for this Min-Hua. >> >> Reviewed-by: John B. Wyatt IV <jwyatt@redhat.com> >> Reviewed-by: John B. Wyatt IV <sageofredondo@gmail.com> >> Tested-by: John B. Wyatt IV <jwyatt@redhat.com> >> Tested-by: John B. Wyatt IV <sageofredondo@gmail.com> >>
On Fri, Sep 13, 2024 at 06:55:19AM +0800, Min-Hua Chen wrote: > AFAIK, > raw_pylibcpupower.i is not a generated file, it is a interface file > for swig. That is correct. You can do more advanced things to help SWIG handle different languages, but so far with the script I wrote for libcpupower simply copying the definition files as worked for me for the .i file. See: https://www.swig.org/Doc4.2/Preprocessor.html#Preprocessor > The *.i file extension is also used for pre-processor output > (single target build) and all *.i files are removed by 'make mrproper', > including raw_pylibcpupower.i (should not be removed). That would explain it. Not just 'make mrproper', but 'make clean' in the root removes the file as well. 'make clean' in the tools directory does not affect it. From 'man gcc': file.i C source code that should not be preprocessed. > > > >> I have reviewed and tested and this. I am good with it being a stopgap. > > > >I am okay with the stopgap, but I do want i explore other solutions. Reviewing the documentation a better solution would be to rename it to .swg ''' 5.1.1 Input format As input, SWIG expects a file containing ISO C/C++ declarations and special SWIG directives. More often than not, this is a special SWIG interface file which is usually denoted with a special .i or .swg suffix. ''' https://www.swig.org/Doc4.2/SWIG.html
On 9/13/24 10:35, John B. Wyatt IV wrote: > On Fri, Sep 13, 2024 at 06:55:19AM +0800, Min-Hua Chen wrote: >> AFAIK, >> raw_pylibcpupower.i is not a generated file, it is a interface file >> for swig. > > That is correct. You can do more advanced things to help SWIG handle > different languages, but so far with the script I wrote for libcpupower > simply copying the definition files as worked for me for the .i file. > > See: > https://www.swig.org/Doc4.2/Preprocessor.html#Preprocessor > >> The *.i file extension is also used for pre-processor output >> (single target build) and all *.i files are removed by 'make mrproper', >> including raw_pylibcpupower.i (should not be removed). > > That would explain it. Not just 'make mrproper', but 'make clean' > in the root removes the file as well. 'make clean' in the tools > directory does not affect it. > > From 'man gcc': > > file.i > C source code that should not be preprocessed. > .i extension is used for a C pre-processor out, hence the need to mrprpoer and clean remove it. Because of that reason, using .i will not work for swig interface files. We build files to debug problems and to check the pre-processor output. So changing mrproper and cleans to not remove .i would leave the tree dirty. >>> >>>> I have reviewed and tested and this. I am good with it being a stopgap. >>> >>> I am okay with the stopgap, but I do want i explore other solutions. > > Reviewing the documentation a better solution would be to rename it to .swg > > ''' > 5.1.1 Input format > > As input, SWIG expects a file containing ISO C/C++ declarations and special > SWIG directives. More often than not, this is a special SWIG interface file > which is usually denoted with a special .i or .swg suffix. > ''' > This is the reason why I wanted to understand the problem to come up with a solutions than renaming the file with .if extension. I am glad to hear .swg can be used. Let's fix this properly then by renaming the file as raw_pylibcpupower > https://www.swig.org/Doc4.2/SWIG.html > Please send me patch with the change to rename using .swg extension and this can be used going forward for other swg interface files. thanks, -- Shuah
diff --git a/tools/power/cpupower/bindings/python/Makefile b/tools/power/cpupower/bindings/python/Makefile index dc09c5b66ead..de872a1b80d3 100644 --- a/tools/power/cpupower/bindings/python/Makefile +++ b/tools/power/cpupower/bindings/python/Makefile @@ -20,13 +20,13 @@ _raw_pylibcpupower.so: raw_pylibcpupower_wrap.o raw_pylibcpupower_wrap.o: raw_pylibcpupower_wrap.c $(CC) -fPIC -c raw_pylibcpupower_wrap.c $(PY_INCLUDE) -raw_pylibcpupower_wrap.c: raw_pylibcpupower.i +raw_pylibcpupower_wrap.c: raw_pylibcpupower.if ifeq ($(HAVE_SWIG),0) $(error "swig was not found. Make sure you have it installed and in the PATH to generate the bindings.") else ifeq ($(HAVE_PYCONFIG),0) $(error "python-config was not found. Make sure you have it installed and in the PATH to generate the bindings.") endif - swig -python raw_pylibcpupower.i + swig -python raw_pylibcpupower.if # Will only clean the bindings folder; will not clean the actual cpupower folder clean: diff --git a/tools/power/cpupower/bindings/python/raw_pylibcpupower.i b/tools/power/cpupower/bindings/python/raw_pylibcpupower.if similarity index 100% rename from tools/power/cpupower/bindings/python/raw_pylibcpupower.i rename to tools/power/cpupower/bindings/python/raw_pylibcpupower.if
This RFC patch is actually bug report. All *.i file will be removed by 'make mrproper', including raw_pylibcpupower.i, added by commit: 338f490e07bc ("pm:cpupower: Add SWIG bindings files for libcpupower") We can reproduce the error by performing the following command: cd linux-next make mrproper cd tools/power/cpupower/bindings/python make We will get an error message: make: *** No rule to make target 'raw_pylibcpupower.i', needed by 'raw_pylibcpupower_wrap.c'. Stop. Renaming the raw_pylibcpupower.i is just a workaround to fix the issue above. Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com> --- tools/power/cpupower/bindings/python/Makefile | 4 ++-- .../python/{raw_pylibcpupower.i => raw_pylibcpupower.if} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename tools/power/cpupower/bindings/python/{raw_pylibcpupower.i => raw_pylibcpupower.if} (100%)