依赖Linux内核源码编译模块报错arch_hweight.h:54:42: error: expected ‘:’ or ‘)’ before ‘POPCNT64

本文主要是介绍依赖Linux内核源码编译模块报错arch_hweight.h:54:42: error: expected ‘:’ or ‘)’ before ‘POPCNT64,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

问题描述

想要编译一个模块,单独加载到开发板上,一次需要依赖开发板的Linux内核源码进行编译这个模块
编译模块的Makefile如下:
在这里插入图片描述

/home/beal.wu/norflash/kernel是开发板使用的内核源码路径
执行make之后报错:

make -C /home/beal.wu/norflash/kernel M=`pwd` modules 
make[1]: Entering directory '/home/beal.wu/norflash/kernel'
make[2]: Entering directory '/home/beal.wu/norflash/kernel'CC [M]  /home/beal.wu/user/touch/skel.o
In file included from ./arch/x86/include/asm/bitops.h:16:0,from ./include/linux/bitops.h:36,from ./include/linux/kernel.h:10,from /home/beal.wu/user/touch/skel.c:15:
./arch/x86/include/asm/arch_hweight.h: In function ‘__arch_hweight64’:
./arch/x86/include/asm/arch_hweight.h:54:42: error: expected ‘:’ or ‘)’ before ‘POPCNT64’asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)^
./arch/x86/include/asm/alternative.h:132:28: note: in definition of macro ALTINSTR_REPLACEMENT’b_replacement(num)":\n\t" newinstr "\n" e_replacement(num) ":\n\t"^
./arch/x86/include/asm/arch_hweight.h:54:7: note: in expansion of macro ‘ALTERNATIVE’asm (ALTERNATIVE("call __sw_hweight64", POPCNT64, X86_FEATURE_POPCNT)^
In file included from ./arch/x86/include/asm/pgtable_types.h:315:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./include/asm-generic/pgtable-nopud.h: At top level:
./include/asm-generic/pgtable-nopud.h:15:0: error: "PUD_SHIFT" redefined [-Werror]#define PUD_SHIFT PGDIR_SHIFT^
In file included from ./arch/x86/include/asm/pgtable_types.h:267:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./arch/x86/include/asm/pgtable_64_types.h:34:0: note: this is the location of the previous definition#define PUD_SHIFT 30^
In file included from ./arch/x86/include/asm/pgtable_types.h:315:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./include/asm-generic/pgtable-nopud.h:16:0: error: "PTRS_PER_PUD" redefined [-Werror]#define PTRS_PER_PUD 1^
In file included from ./arch/x86/include/asm/pgtable_types.h:267:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./arch/x86/include/asm/pgtable_64_types.h:35:0: note: this is the location of the previous definition#define PTRS_PER_PUD 512^
In file included from ./arch/x86/include/asm/pgtable_types.h:315:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./include/asm-generic/pgtable-nopud.h:17:0: error: "PUD_SIZE" redefined [-Werror]#define PUD_SIZE   (1UL << PUD_SHIFT)^
In file included from ./arch/x86/include/asm/pgtable_types.h:267:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./arch/x86/include/asm/pgtable_64_types.h:51:0: note: this is the location of the previous definition#define PUD_SIZE (_AC(1, UL) << PUD_SHIFT)^
In file included from ./arch/x86/include/asm/pgtable_types.h:315:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./include/asm-generic/pgtable-nopud.h:18:0: error: "PUD_MASK" redefined [-Werror]#define PUD_MASK   (~(PUD_SIZE-1))^
In file included from ./arch/x86/include/asm/pgtable_types.h:267:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./arch/x86/include/asm/pgtable_64_types.h:52:0: note: this is the location of the previous definition#define PUD_MASK (~(PUD_SIZE - 1))^
In file included from ./arch/x86/include/asm/pgtable_types.h:336:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./include/asm-generic/pgtable-nopmd.h:19:0: error: "PMD_SHIFT" redefined [-Werror]#define PMD_SHIFT PUD_SHIFT^
In file included from ./arch/x86/include/asm/pgtable_types.h:267:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./arch/x86/include/asm/pgtable_64_types.h:41:0: note: this is the location of the previous definition#define PMD_SHIFT 21^
In file included from ./arch/x86/include/asm/pgtable_types.h:336:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./include/asm-generic/pgtable-nopmd.h:20:0: error: "PTRS_PER_PMD" redefined [-Werror]#define PTRS_PER_PMD 1^
In file included from ./arch/x86/include/asm/pgtable_types.h:267:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./arch/x86/include/asm/pgtable_64_types.h:42:0: note: this is the location of the previous definition#define PTRS_PER_PMD 512^
In file included from ./arch/x86/include/asm/pgtable_types.h:336:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./include/asm-generic/pgtable-nopmd.h:21:0: error: "PMD_SIZE" redefined [-Werror]#define PMD_SIZE   (1UL << PMD_SHIFT)^
In file included from ./arch/x86/include/asm/pgtable_types.h:267:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./arch/x86/include/asm/pgtable_64_types.h:49:0: note: this is the location of the previous definition#define PMD_SIZE (_AC(1, UL) << PMD_SHIFT)^
In file included from ./arch/x86/include/asm/pgtable_types.h:336:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./include/asm-generic/pgtable-nopmd.h:22:0: error: "PMD_MASK" redefined [-Werror]#define PMD_MASK   (~(PMD_SIZE-1))^
In file included from ./arch/x86/include/asm/pgtable_types.h:267:0,from ./arch/x86/include/asm/processor.h:18,from ./arch/x86/include/asm/cpufeature.h:4,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./arch/x86/include/asm/pgtable_64_types.h:50:0: note: this is the location of the previous definition#define PMD_MASK (~(PMD_SIZE - 1))^
In file included from ./arch/x86/include/asm/cpufeature.h:4:0,from ./arch/x86/include/asm/thread_info.h:52,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./arch/x86/include/asm/processor.h:172:0: error: "cache_line_size" redefined [-Werror]#define cache_line_size() (boot_cpu_data.x86_cache_alignment)^
In file included from ./include/linux/printk.h:8:0,from ./include/linux/kernel.h:13,from /home/beal.wu/user/touch/skel.c:15:
./include/linux/cache.h:78:0: note: this is the location of the previous definition#define cache_line_size() L1_CACHE_BYTES^
In file included from ./include/linux/cache.h:5:0,from ./include/linux/printk.h:8,from ./include/linux/kernel.h:13,from /home/beal.wu/user/touch/skel.c:15:
./arch/x86/include/asm/cache.h:7:25: error: ‘CONFIG_X86_L1_CACHE_SHIFT’ undeclared here (not in a function)#define L1_CACHE_SHIFT (CONFIG_X86_L1_CACHE_SHIFT)^
./arch/x86/include/asm/cache.h:8:30: note: in expansion of macro ‘L1_CACHE_SHIFT’#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)^
./include/linux/cache.h:12:25: note: in expansion of macro ‘L1_CACHE_BYTES’#define SMP_CACHE_BYTES L1_CACHE_BYTES^
./include/linux/cache.h:34:58: note: in expansion of macro ‘SMP_CACHE_BYTE’#define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES))^
./arch/x86/include/asm/processor.h:275:27: note: in expansion of macro ‘____cacheline_aligned’} __attribute__((packed)) ____cacheline_aligned;^
In file included from ./arch/x86/include/asm/preempt.h:5:0,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./arch/x86/include/asm/processor.h: In function ‘current_top_of_stack’:
./arch/x86/include/asm/processor.h:493:30: error: ‘cpu_current_top_of_stac’ undeclared (first use in this function)return this_cpu_read_stable(cpu_current_top_of_stack);^
./arch/x86/include/asm/percpu.h:213:9: note: in definition of macro ‘percpu_stable_op’typeof(var) pfo_ret__;    \^
./arch/x86/include/asm/processor.h:493:9: note: in expansion of macro ‘this_cpu_read_stable’return this_cpu_read_stable(cpu_current_top_of_stack);^
./arch/x86/include/asm/processor.h:493:30: note: each undeclared identifier is reported only once for each function it appears inreturn this_cpu_read_stable(cpu_current_top_of_stack);^
./arch/x86/include/asm/percpu.h:213:9: note: in definition of macro ‘percpu_stable_op’typeof(var) pfo_ret__;    \^
./arch/x86/include/asm/processor.h:493:9: note: in expansion of macro ‘this_cpu_read_stable’return this_cpu_read_stable(cpu_current_top_of_stack);^
In file included from ./arch/x86/include/asm/atomic.h:268:0,from ./include/linux/atomic.h:4,from ./arch/x86/include/asm/thread_info.h:53,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./arch/x86/include/asm/atomic64_64.h: At top level:
./arch/x86/include/asm/atomic64_64.h:19:40: error: unknown type name ‘atomic64_t’static inline long atomic64_read(const atomic64_t *v)^
In file included from ./include/linux/linkage.h:4:0,from ./include/linux/kernel.h:6,from /home/beal.wu/user/touch/skel.c:15:
./arch/x86/include/asm/atomic64_64.h: In function ‘atomic64_read’:
./arch/x86/include/asm/atomic64_64.h:21:22: error: request for member ‘counter’ in something not a structure or unionreturn READ_ONCE((v)->counter);^
./include/linux/compiler.h:305:17: note: in definition of macro ‘__READ_ONCE’union { typeof(x) __val; char __c[1]; } __u;   \^
./arch/x86/include/asm/atomic64_64.h:21:9: note: in expansion of macro ‘READ_ONCE’return READ_ONCE((v)->counter);^
./arch/x86/include/asm/atomic64_64.h:21:22: error: request for member ‘counter’ in something not a structure or unionreturn READ_ONCE((v)->counter);^
./include/linux/compiler.h:307:22: note: in definition of macro ‘__READ_ONCE’__read_once_size(&(x), __u.__c, sizeof(x));  \^
./arch/x86/include/asm/atomic64_64.h:21:9: note: in expansion of macro ‘READ_ONCE’return READ_ONCE((v)->counter);^
./arch/x86/include/asm/atomic64_64.h:21:22: error: request for member ‘counter’ in something not a structure or unionreturn READ_ONCE((v)->counter);^
./include/linux/compiler.h:307:42: note: in definition of macro ‘__READ_ONCE’__read_once_size(&(x), __u.__c, sizeof(x));  \^
./arch/x86/include/asm/atomic64_64.h:21:9: note: in expansion of macro ‘READ_ONCE’return READ_ONCE((v)->counter);^
./arch/x86/include/asm/atomic64_64.h:21:22: error: request for member ‘counter’ in something not a structure or unionreturn READ_ONCE((v)->counter);^
./include/linux/compiler.h:309:30: note: in definition of macro ‘__READ_ONCE’__read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \^
./arch/x86/include/asm/atomic64_64.h:21:9: note: in expansion of macro ‘READ_ONCE’return READ_ONCE((v)->counter);^
./arch/x86/include/asm/atomic64_64.h:21:22: error: request for member ‘counter’ in something not a structure or unionreturn READ_ONCE((v)->counter);^
./include/linux/compiler.h:309:50: note: in definition of macro ‘__READ_ONCE’__read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \^
./arch/x86/include/asm/atomic64_64.h:21:9: note: in expansion of macro ‘READ_ONCE’return READ_ONCE((v)->counter);^
In file included from ./arch/x86/include/asm/atomic.h:268:0,from ./include/linux/atomic.h:4,from ./arch/x86/include/asm/thread_info.h:53,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./arch/x86/include/asm/atomic64_64.h: At top level:
./arch/x86/include/asm/atomic64_64.h:31:33: error: unknown type name ‘atomic64_t’static inline void atomic64_set(atomic64_t *v, long i)^
./arch/x86/include/asm/atomic64_64.h:43:50: error: unknown type name ‘atomic64_t’static __always_inline void atomic64_add(long i, atomic64_t *v)^
./arch/x86/include/asm/atomic64_64.h:57:41: error: unknown type name ‘atomic64_t’static inline void atomic64_sub(long i, atomic64_t *v)^
./arch/x86/include/asm/atomic64_64.h:73:50: error: unknown type name ‘atomic64_t’static inline bool atomic64_sub_and_test(long i, atomic64_t *v)^
./arch/x86/include/asm/atomic64_64.h:84:42: error: unknown type name ‘atomic64_t’static __always_inline void atomic64_inc(atomic64_t *v)^
./arch/x86/include/asm/atomic64_64.h:97:42: error: unknown type name ‘atomic64_t’static __always_inline void atomic64_dec(atomic64_t *v)^
./arch/x86/include/asm/atomic64_64.h:112:42: error: unknown type name ‘atomic64_t’static inline bool atomic64_dec_and_test(atomic64_t *v)^
./arch/x86/include/asm/atomic64_64.h:125:42: error: unknown type name ‘atomic64_t’static inline bool atomic64_inc_and_test(atomic64_t *v)^
./arch/x86/include/asm/atomic64_64.h:139:50: error: unknown type name ‘atomic64_t’static inline bool atomic64_add_negative(long i, atomic64_t *v)^
./arch/x86/include/asm/atomic64_64.h:151:57: error: unknown type name ‘atomic64_t’static __always_inline long atomic64_add_return(long i, atomic64_t *v)^
./arch/x86/include/asm/atomic64_64.h:156:48: error: unknown type name ‘atomic64_t’static inline long atomic64_sub_return(long i, atomic64_t *v)^
./arch/x86/include/asm/atomic64_64.h:161:47: error: unknown type name ‘atomic64_t’static inline long atomic64_fetch_add(long i, atomic64_t *v)^
./arch/x86/include/asm/atomic64_64.h:166:47: error: unknown type name ‘atomic64_t’static inline long atomic64_fetch_sub(long i, atomic64_t *v)^
./arch/x86/include/asm/atomic64_64.h:174:37: error: unknown type name ‘atomic64_t’static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new)^
./arch/x86/include/asm/atomic64_64.h:179:34: error: unknown type name ‘atomic64_t’static inline long atomic64_xchg(atomic64_t *v, long new)^
./arch/x86/include/asm/atomic64_64.h:193:40: error: unknown type name ‘atomic64_t’static inline bool atomic64_add_unless(atomic64_t *v, long a, long u)^
./arch/x86/include/asm/atomic64_64.h:217:45: error: unknown type name ‘atomic64_t’static inline long atomic64_dec_if_positive(atomic64_t *v)^
./arch/x86/include/asm/atomic64_64.h:234:42: error: unknown type name ‘atomic64_t’static inline void atomic64_##op(long i, atomic64_t *v)   \^
./arch/x86/include/asm/atomic64_64.h:256:2: note: in expansion of macro ‘ATOMIC64_OP’ATOMIC64_OP(op)       \^
./arch/x86/include/asm/atomic64_64.h:259:1: note: in expansion of macro ‘ATOMIC64_OPS’ATOMIC64_OPS(and, &)^
./arch/x86/include/asm/atomic64_64.h:243:48: error: unknown type name ‘atomic64_t’static inline long atomic64_fetch_##op(long i, atomic64_t *v)  \^
./arch/x86/include/asm/atomic64_64.h:257:2: note: in expansion of macro ‘ATOMIC64_FETCH_OP’ATOMIC64_FETCH_OP(op, c_op)^
./arch/x86/include/asm/atomic64_64.h:259:1: note: in expansion of macro ‘ATOMIC64_OPS’ATOMIC64_OPS(and, &)^
./arch/x86/include/asm/atomic64_64.h:234:42: error: unknown type name ‘atomic64_t’static inline void atomic64_##op(long i, atomic64_t *v)   \^
./arch/x86/include/asm/atomic64_64.h:256:2: note: in expansion of macro ‘ATOMIC64_OP’ATOMIC64_OP(op)       \^
./arch/x86/include/asm/atomic64_64.h:260:1: note: in expansion of macro ‘ATOMIC64_OPS’ATOMIC64_OPS(or, |)^
./arch/x86/include/asm/atomic64_64.h:243:48: error: unknown type name ‘atomic64_t’static inline long atomic64_fetch_##op(long i, atomic64_t *v)  \^
./arch/x86/include/asm/atomic64_64.h:257:2: note: in expansion of macro ‘ATOMIC64_FETCH_OP’ATOMIC64_FETCH_OP(op, c_op)^
./arch/x86/include/asm/atomic64_64.h:260:1: note: in expansion of macro ‘ATOMIC64_OPS’ATOMIC64_OPS(or, |)^
./arch/x86/include/asm/atomic64_64.h:234:42: error: unknown type name ‘atomic64_t’static inline void atomic64_##op(long i, atomic64_t *v)   \^
./arch/x86/include/asm/atomic64_64.h:256:2: note: in expansion of macro ‘ATOMIC64_OP’ATOMIC64_OP(op)       \^
./arch/x86/include/asm/atomic64_64.h:261:1: note: in expansion of macro ‘ATOMIC64_OPS’ATOMIC64_OPS(xor, ^)^
./arch/x86/include/asm/atomic64_64.h:243:48: error: unknown type name ‘atomic64_t’static inline long atomic64_fetch_##op(long i, atomic64_t *v)  \^
./arch/x86/include/asm/atomic64_64.h:257:2: note: in expansion of macro ‘ATOMIC64_FETCH_OP’ATOMIC64_FETCH_OP(op, c_op)^
./arch/x86/include/asm/atomic64_64.h:261:1: note: in expansion of macro ‘ATOMIC64_OPS’ATOMIC64_OPS(xor, ^)^
In file included from ./arch/x86/include/asm/thread_info.h:53:0,from ./include/linux/thread_info.h:58,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./include/linux/atomic.h:1000:49: error: unknown type name ‘atomic64_t’static inline void atomic64_andnot(long long i, atomic64_t *v)^
./include/linux/atomic.h:1005:60: error: unknown type name ‘atomic64_t’static inline long long atomic64_fetch_andnot(long long i, atomic64_t *v)^
./include/linux/atomic.h:1010:68: error: unknown type name ‘atomic64_t’ic inline long long atomic64_fetch_andnot_relaxed(long long i, atomic64_t ^
./include/linux/atomic.h:1015:68: error: unknown type name ‘atomic64_t’ic inline long long atomic64_fetch_andnot_acquire(long long i, atomic64_t ^
./include/linux/atomic.h:1020:68: error: unknown type name ‘atomic64_t’ic inline long long atomic64_fetch_andnot_release(long long i, atomic64_t ^
In file included from ./arch/x86/include/asm/preempt.h:6:0,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./include/linux/thread_info.h:113:19: error: redefinition of ‘arch_within_stack_frames’static inline int arch_within_stack_frames(const void * const stack,^
In file included from ./include/linux/thread_info.h:58:0,from ./arch/x86/include/asm/preempt.h:6,from ./include/linux/preempt.h:59,from ./include/linux/spinlock.h:50,from ./include/linux/mmzone.h:7,from ./include/linux/gfp.h:5,from ./include/linux/slab.h:14,from /home/beal.wu/user/touch/skel.c:17:
./arch/x86/include/asm/thread_info.h:165:19: note: previous definition of arch_within_stack_frames’ was herestatic inline int arch_within_stack_frames(const void * const stack,^
In file included from ./include/linux/cache.h:5:0,from ./include/linux/printk.h:8,from ./include/linux/kernel.h:13,from /home/beal.wu/user/touch/skel.c:15:
./arch/x86/include/asm/cache.h:12:31: error: ‘CONFIG_X86_INTERNODE_CACHE_SHIFT’ undeclared here (not in a function)#define INTERNODE_CACHE_SHIFT CONFIG_X86_INTERNODE_CACHE_SHIFT^
./include/linux/cache.h:71:35: note: in expansion of macro ‘INTERNODE_CACHE_SHIFT’__attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT))))^
./include/linux/mmzone.h:106:3: note: in expansion of macro ‘____cacheline_internodealigned_in_smp’} ____cacheline_internodealigned_in_smp;^
In file included from ./include/linux/sched.h:32:0,from ./include/linux/kasan.h:4,from ./include/linux/slab.h:118,from /home/beal.wu/user/touch/skel.c:17:
./include/linux/cputime.h:4:25: fatal error: asm/cputime.h: No such file or directory
cc1: all warnings being treated as errors
compilation terminated.
scripts/Makefile.build:299: recipe for target '/home/beal.wu/user/touch/skel.o' failed
make[3]: *** [/home/beal.wu/user/touch/skel.o] Error 1
Makefile:1585: recipe for target '_module_/home/beal.wu/user/touch' failed
make[2]: *** [_module_/home/beal.wu/user/touch] Error 2
make[2]: Leaving directory '/home/beal.wu/norflash/kernel'
makefile:8: recipe for target 'modules' failed
make[1]: *** [modules] Error 2
make[1]: Leaving directory '/home/beal.wu/norflash/kernel'
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 2

解决方法

这个问题是因为在内核源码中的Makefile中没有指定ARCH和CROSS_COMPILE
因此在内核源码的主Makefile中指定ARCH和CROSS_COMPILE 即可
在这里插入图片描述
保存之后,再次编译就能成功!

这篇关于依赖Linux内核源码编译模块报错arch_hweight.h:54:42: error: expected ‘:’ or ‘)’ before ‘POPCNT64的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!


原文地址:https://blog.csdn.net/qq_42230338/article/details/117920537
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.chinasem.cn/article/795868

相关文章

Java -jar命令如何运行外部依赖JAR包

《Java-jar命令如何运行外部依赖JAR包》在Java应用部署中,java-jar命令是启动可执行JAR包的标准方式,但当应用需要依赖外部JAR文件时,直接使用java-jar会面临类加载困... 目录引言:外部依赖JAR的必要性一、问题本质:类加载机制的限制1. Java -jar的默认行为2. 类加

java -jar命令运行 jar包时运行外部依赖jar包的场景分析

《java-jar命令运行jar包时运行外部依赖jar包的场景分析》:本文主要介绍java-jar命令运行jar包时运行外部依赖jar包的场景分析,本文给大家介绍的非常详细,对大家的学习或工作... 目录Java -jar命令运行 jar包时如何运行外部依赖jar包场景:解决:方法一、启动参数添加: -Xb

Linux基础命令@grep、wc、管道符的使用详解

《Linux基础命令@grep、wc、管道符的使用详解》:本文主要介绍Linux基础命令@grep、wc、管道符的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐... 目录grep概念语法作用演示一演示二演示三,带选项 -nwc概念语法作用wc,不带选项-c,统计字节数-

MySQL启动报错:InnoDB表空间丢失问题及解决方法

《MySQL启动报错:InnoDB表空间丢失问题及解决方法》在启动MySQL时,遇到了InnoDB:Tablespace5975wasnotfound,该错误表明MySQL在启动过程中无法找到指定的s... 目录mysql 启动报错:InnoDB 表空间丢失问题及解决方法错误分析解决方案1. 启用 inno

Linux CPU飙升排查五步法解读

《LinuxCPU飙升排查五步法解读》:本文主要介绍LinuxCPU飙升排查五步法,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录排查思路-五步法1. top命令定位应用进程pid2.php top-Hp[pid]定位应用进程对应的线程tid3. printf"%

Linux下安装Anaconda3全过程

《Linux下安装Anaconda3全过程》:本文主要介绍Linux下安装Anaconda3全过程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录简介环境下载安装一、找到下载好的文件名为Anaconda3-2018.12-linux-x86_64的安装包二、或者通

Linux系统之stress-ng测压工具的使用

《Linux系统之stress-ng测压工具的使用》:本文主要介绍Linux系统之stress-ng测压工具的使用,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录一、理论1.stress工具简介与安装2.语法及参数3.具体安装二、实验1.运行8 cpu, 4 fo

Linux lvm实例之如何创建一个专用于MySQL数据存储的LVM卷组

《Linuxlvm实例之如何创建一个专用于MySQL数据存储的LVM卷组》:本文主要介绍使用Linux创建一个专用于MySQL数据存储的LVM卷组的实例,具有很好的参考价值,希望对大家有所帮助,... 目录在Centos 7上创建卷China编程组并配置mysql数据目录1. 检查现有磁盘2. 创建物理卷3. 创

Linux查看系统盘和SSD盘的容量、型号及挂载信息的方法

《Linux查看系统盘和SSD盘的容量、型号及挂载信息的方法》在Linux系统中,管理磁盘设备和分区是日常运维工作的重要部分,而lsblk命令是一个强大的工具,它用于列出系统中的块设备(blockde... 目录1. 查看所有磁盘的物理信息方法 1:使用 lsblk(推荐)方法 2:使用 fdisk -l(

Linux中的more 和 less区别对比分析

《Linux中的more和less区别对比分析》在Linux/Unix系统中,more和less都是用于分页查看文本文件的命令,但less是more的增强版,功能更强大,:本文主要介绍Linu... 目录1. 基础功能对比2. 常用操作对比less 的操作3. 实际使用示例4. 为什么推荐 less?5.