cyring / CoreFreq

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

Compilation error: "error: implicit declaration of function ‘acpi_cpc_valid’" #445

Closed vitaly-zdanevich closed 1 year ago

vitaly-zdanevich commented 1 year ago

Full log:

 * corefreq-1.96.1.tar.gz BLAKE2B SHA512 size ;-) ...                                                                                                                                                                                                                      [ ok ]
 * Determining the location of the kernel source code
 * Found kernel source directory:
 *     /usr/src/linux
 * Found sources for kernel version:
 *     6.1.12-gentoo+
 * Checking for kernel configurations...
 * Enable optional configurations only as you see fit.
 * Not all optional configurations will be suitable for your system.
 * Build will fail for required configs.
 * The other configs are all optional configs.
 * Checking for suitable kernel configuration options ...
 *   CONFIG_XEN:    is not set when it should be.
 *   CONFIG_SCHED_MUQSS:    is not set when it should be.
 *   CONFIG_SCHED_BMQ:  is not set when it should be.
 *   CONFIG_SCHED_PDS:  is not set when it should be.                                                                                                                                                                                                                     [ !! ]
 * Please check to make sure these options are set correctly.
 * Failure to do so may cause unexpected problems.
>>> Unpacking source...
>>> Unpacking corefreq-1.96.1.tar.gz to /var/tmp/portage/sys-apps/corefreq-1.96.1/work
>>> Source unpacked in /var/tmp/portage/sys-apps/corefreq-1.96.1/work
>>> Preparing source in /var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1 ...
>>> Source configured.
>>> Compiling source in /var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1 ...
ln: failed to create symbolic link 'Module.symvers': File exists
 * Preparing corefreqk module
make -j8 HOSTCC=x86_64-pc-linux-gnu-gcc 'LDFLAGS=-m elf_x86_64' clean all 
rm -f corefreqd corefreq-cli
cc  -Wall -Wfatal-errors -pthread -c corefreqd.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreqd.o
cc  -Wall -Wfatal-errors -c corefreqm.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreqm.o
cc  -Wall -Wfatal-errors -c corefreq-cli.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1  \
  -o corefreq-cli.o
make -j1 -C /lib/modules/6.1.12-gentoo+/build M=/var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1 clean
cc  -Wall -Wfatal-errors -c corefreq-ui.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreq-ui.o
cc  -Wall -Wfatal-errors -c corefreq-cli-rsc.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1  \
  -o corefreq-cli-rsc.o
cc  -Wall -Wfatal-errors -c corefreq-cli-json.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreq-cli-json.o
cc  -Wall -Wfatal-errors -c corefreq-cli-extra.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreq-cli-extra.o
make[1]: Entering directory '/usr/src/linux-6.1.12-gentoo'
make[1]: warning: -j1 forced in submake: resetting jobserver mode.
make[1]: Leaving directory '/usr/src/linux-6.1.12-gentoo'
cc  -Wall -Wfatal-errors corefreqd.c corefreqm.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1 \
  -o corefreqd -lpthread -lm -lrt
cc  -Wall -Wfatal-errors \
  corefreq-cli.c corefreq-ui.c corefreq-cli-rsc.c \
  corefreq-cli-json.c corefreq-cli-extra.c \
  -D CORE_COUNT=256 -D TASK_ORDER=5 -D MAX_FREQ_HZ=7125000000 -D UBENCH=0 -D DELAY_TSC=1  \
  -o corefreq-cli -lm -lrt
make -j1 -C /lib/modules/6.1.12-gentoo+/build M=/var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1 modules
make[1]: Entering directory '/usr/src/linux-6.1.12-gentoo'
make[1]: warning: -j1 forced in submake: resetting jobserver mode.
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (Gentoo 12.2.1_p20230121-r1 p10) 12.2.1 20230121
  You are using:           x86_64-pc-linux-gnu-gcc (Gentoo 12.2.1_p20230428-r1 p2) 12.2.1 20230428
/var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1/corefreqk.c: In function ‘For_All_ACPI_CPPC’:
/var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1/corefreqk.c:4178:25: error: implicit declaration of function ‘acpi_cpc_valid’ [-Werror=implicit-function-declaration]
 4178 |         signed int rc = acpi_cpc_valid() == false;
      |                         ^~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:250: /var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1/corefreqk.o] Error 1
make[1]: *** [Makefile:2005: /var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1] Error 2
make[1]: Leaving directory '/usr/src/linux-6.1.12-gentoo'
make: *** [Makefile:86: all] Error 2

I got this when tried this ebuild on Gentoo.

cyring commented 1 year ago
/var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1/corefreqk.c:4178:25: error: implicit declaration of function ‘acpi_cpc_valid’ [-Werror=implicit-function-declaration]
 4178 |         signed int rc = acpi_cpc_valid() == false;
      |                         ^~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:250: /var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1/corefreqk.o] Error 1
make[1]: *** [Makefile:2005: /var/tmp/portage/sys-apps/corefreq-1.96.1/work/corefreq-1.96.1] Error 2
make[1]: Leaving directory '/usr/src/linux-6.1.12-gentoo'
make: *** [Makefile:86: all] Error 2

I got this when tried this ebuild on Gentoo.

Your kernel is apparently built without CONFIG_ACPI_CPPC_LIB

cyring commented 1 year ago

@vitaly-zdanevich

Can you edit source code at this line:

https://github.com/cyring/CoreFreq/blob/fb0b28f15924b05ae7b67c3bd0bc419b7fad2872/corefreqk.c#L4180

and replace config test with the following:

    #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) && defined(CONFIG_ACPI_CPPC_LIB)

Next try to rebuild:

make clean all

If the above does not fix the build, please provide your current config from /proc/config.gz

And the url to the source code of kernel 6.1.12-gentoo

vitaly-zdanevich commented 1 year ago

Yes, it works, thanks.

Will you update this line in the repo?

cyring commented 1 year ago

Yes, it works, thanks.

Will you update this line in the repo?

You now have the release 1.96.2 to proceed with the package

cyring commented 1 year ago

Btw, looking at the Gentoo port, the minimum kernel permitted by CoreFreq is 3.10.0, even if some features will miss.

Here a CentOS VM I'm building with, for non regression tests.

2023-05-31-040403_720x464_scrot