在为AMDPowerProfiler-7.02构建内核模块时,出现此错误
make -C /lib/modules/4.18.0-24-generic/build M=/usr/src/AMDPowerProfiler-7.02 EXTRA_CFLAGS="-I/usr/src/AMDPowerProfiler-7.02/inc -DKERNEL_MODULE -DLINUX -D_LINUX " modules
make[1]: Entering directory '/usr/src/linux-headers-4.18.0-24-generic'
CC [M] /usr/src/AMDPowerProfiler-7.02/src/PwrAccessPmcData.o
CC [M] /usr/src/AMDPowerProfiler-7.02/src/PwrCollectSmuCounters.o
CC [M] /usr/src/AMDPowerProfiler-7.02/src/PwrCommonConfig.o
CC [M] /usr/src/AMDPowerProfiler-7.02/src/PwrCommonHelper.o
CC [M] /usr/src/AMDPowerProfiler-7.02/src/PwrCounterAccessInterface.o
CC [M] /usr/src/AMDPowerProfiler-7.02/src/PwrDriverUtils.o
CC [M] /usr/src/AMDPowerProfiler-7.02/src/PwrHwAccessInterface.o
CC [M] /usr/src/AMDPowerProfiler-7.02/src/PwrProfCoreUtils.o
In file included from /usr/src/AMDPowerProfiler-7.02/inc/PwrProfCoreUtils.h:12:0,
from /usr/src/AMDPowerProfiler-7.02/src/PwrProfCoreUtils.c:9:
./arch/x86/include/asm/ftrace.h: In function ‘arch_syscall_match_sym_name’:
./arch/x86/include/asm/ftrace.h:58:10: error: implicit declaration of function ‘strcmp’ [-Werror=implicit-function-declaration]
return !strcmp(sym + 3, name + 3) ||
^~~~~~
./arch/x86/include/asm/ftrace.h:59:5: error: implicit declaration of function ‘strncmp’ [-Werror=implicit-function-declaration]
(!strncmp(sym, "__x64_", 6) && !strcmp(sym + 9, name + 3)) ||
^~~~~~~
cc1: some warnings being treated as errors
当我搜索ftrace.h
时,我发现这是内核源文件。因此,我打开了与内核编号匹配的/usr/src/linux-headers-4.18.0-24/arch/x86/include/asm/ftrace.h
,并添加了
#include <string.h>
在其顶部。接下来,我收到此错误:
./arch/x86/include/asm/ftrace.h:2:10: fatal error: string.h: No such file or directory
#include <string.h>
我知道这与g ++有关。我该如何解决?