cyring / CoreFreq

CoreFreq : CPU monitoring and tuning software designed for 64-bit processors.
https://www.cyring.fr
GNU General Public License v2.0
2.01k stars 127 forks source link

Cannot compile on Almalinux 9.3 #469

Closed fishbonesnl closed 11 months ago

fishbonesnl commented 11 months ago

Hi,

I am getting a compilation error on Almalinux 9.3 with the latest version of Corefreq.

[user@machine CoreFreq] make
make -j1 -C /lib/modules/5.14.0-362.8.1.el9_3.x86_64/build M=/home/user/CoreFreq modules
make[1]: Entering directory '/usr/src/kernels/5.14.0-362.8.1.el9_3.x86_64'
  CC [M]  /home/user/CoreFreq/corefreqk.o
/home/user/CoreFreq/corefreqk.c: In function ‘CoreFreqK_FreqDriver_UnInit’:
/home/user/CoreFreq/corefreqk.c:20729:12: error: void value not ignored as it ought to be
20729 |         rc =
      |            ^
compilation terminated due to -Wfatal-errors.
make[2]: *** [scripts/Makefile.build:299: /home/user/CoreFreq/corefreqk.o] Error 1
make[1]: *** [Makefile:1928: /home/user/CoreFreq] Error 2
make[1]: Leaving directory '/usr/src/kernels/5.14.0-362.8.1.el9_3.x86_64'
make: *** [Makefile:86: all] Error 2

All the relevant kernel headers are installed.

[user@machine CoreFreq] gcc --version
gcc (GCC) 11.4.1 20230605 (Red Hat 11.4.1-2)

What do I do?

cyring commented 11 months ago

To make AlmaLinux compatible with CoreFreq, change its source code with your kernel version at this line:

https://github.com/cyring/CoreFreq/blob/150a2191f37c07f2d0e8024090a16efa72d9e5f5/corefreqk.c#L20728

Like:

KERNEL_VERSION(5, 14, 0)

Or more appropriated to RHEL, something like:

 #if ((LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)) && (!defined(CONFIG_CACHY))) || (RHEL_MAJOR == 11)
fishbonesnl commented 11 months ago

Thank you.

I changed it to

#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 0)) && (!defined(CONFIG_CACHY))

and now I get the error

/home/user/CoreFreq/corefreqk.c: In function ‘CoreFreqK_Create_Device_Level_Up’:
/home/user/CoreFreq/corefreqk.c:22853:35: error: assignment to ‘char * (*)(const struct device *, umode_t *)’ {aka ‘char * (*)(const struct device *, short unsigned int *)’} from incompatible pointer type ‘char * (*)(struct device *, umode_t *)’ {aka ‘char * (*)(struct device *, short unsigned int *)’} [-Werror=incompatible-pointer-types]
22853 |         CoreFreqK.clsdev->devnode = CoreFreqK_DevNode;

The idea using

#if ((LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 0)) && (!defined(CONFIG_CACHY))) || (RHEL_MAJOR == 11)

yields the same error as in the beginning.

Sorry to be a bother. I know very little about compiling these kind of programmes.

cyring commented 11 months ago

I'm now grapping AlmaLinux to verify what's going on ...

EDIT: looking for an Alma ISO with kernel headers inside (or to install) and test the build of CoreFreq within a VM

cyring commented 11 months ago

You wiil also change version at line 22696:

2023-12-05-191917_1280x825_scrot

cyring commented 11 months ago

Fix is available on development branch

git clone -b develop https://github.com/CyrIng/CoreFreq.git
make clean all

It has been compiled against:

fishbonesnl commented 11 months ago

I made the second change that you suggested and I can confirm that it compiles and runs. Will test the development branch later, but for now thanks for all your help!

cyring commented 11 months ago

Hello,

Are we closing this issue ?

fishbonesnl commented 11 months ago

Yes, sorry for the late response. Please close it. I got it to work.