bytedance / Elkeid

Elkeid is an open source solution that can meet the security requirements of various workloads such as hosts, containers and K8s, and serverless. It is derived from ByteDance's internal best practices.
https://elkeid.bytedance.com
2.23k stars 432 forks source link

driver compile failed on 5.4.250-1.el7.elrepo.x86_64 #639

Closed Percivalll closed 3 months ago

Percivalll commented 3 months ago

Describe the bug driver compile failed on 5.4.250-1.el7.elrepo.x86_64

To Reproduce

  1. use centos:7.9.2009 docker image
  2. download kernel-devel-5.4.250-1.el7.elrepo.x86_64.rpm
  3. install make gcc git kernel-devel
  4. make

Expected behavior compile successfully

Additional context from ./include/linux/spinlock.h:51, from ./include/linux/seqlock.h:36, from ./include/linux/time.h:6, from ./include/linux/stat.h:19, from ./include/linux/module.h:10, from /tmp/build/src/../include/kprobe.h:11, from /tmp/build/src/init.c:8: ./arch/x86/include/asm/bug.h:35:22: error: expected identifier or '(' before string constant asm_inline volatile("1:\t" ins "\n" \ ^ ./arch/x86/include/asm/bug.h:79:2: note: in expansion of macro '_BUG_FLAGS' _BUG_FLAGS(ASM_UD2, BUGFLAG_WARNING|(flags)); \ ^ ./include/asm-generic/bug.h:98:3: note: in expansion of macro '__WARN_FLAGS' __WARN_FLAGS(BUGFLAG_ONCE | \ ^ ./include/linux/iocontext.h:142:2: note: in expansion of macro 'WARN_ON_ONCE' WARN_ON_ONCE(atomic_read(&ioc->nr_tasks) <= 0); ^ In file included from :0:0: ././include/linux/compiler_types.h:214:24: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

define asm_inline asm __inline

                    ^

./arch/x86/include/asm/bug.h:35:2: note: in expansion of macro 'asm_inline' asm_inline volatile("1:\t" ins "\n" \ ^ ./arch/x86/include/asm/bug.h:79:2: note: in expansion of macro '_BUG_FLAGS' _BUG_FLAGS(ASM_UD2, BUGFLAG_WARNING|(flags)); \ ^ ./include/asm-generic/bug.h:98:3: note: in expansion of macro '__WARN_FLAGS' WARN_FLAGS(BUGFLAG_ONCE | \ ^ ./include/linux/iocontext.h:142:2: note: in expansion of macro 'WARN_ON_ONCE' WARN_ON_ONCE(atomic_read(&ioc->nr_tasks) <= 0); ^ ./include/linux/quota.h: In function 'make_kqid': ././include/linux/compiler_types.h:214:24: error: expected '(' before 'inline'

define asm_inline asm __inline

                    ^

./arch/x86/include/asm/bug.h:35:2: note: in expansion of macro 'asm_inline' asm_inline volatile("1:\t" ins "\n" \ ^ ./arch/x86/include/asm/bug.h:73:2: note: in expansion of macro '_BUG_FLAGS' _BUG_FLAGS(ASM_UD2, 0); \ ^ ./include/linux/quota.h:114:3: note: in expansion of macro 'BUG' BUG(); ^ In file included from ./include/linux/bug.h:5:0, from ./include/linux/thread_info.h:12, from ./arch/x86/include/asm/preempt.h:7, from ./include/linux/preempt.h:78, from ./include/linux/spinlock.h:51, from ./include/linux/seqlock.h:36, from ./include/linux/time.h:6, from ./include/linux/stat.h:19, from ./include/linux/module.h:10, from /tmp/build/src/../include/kprobe.h:11, from /tmp/build/src/init.c:8: ./arch/x86/include/asm/bug.h:35:22: error: expected identifier or '(' before string constant asm_inline volatile("1:\t" ins "\n" \ ^ ./arch/x86/include/asm/bug.h:73:2: note: in expansion of macro '_BUG_FLAGS' _BUG_FLAGS(ASM_UD2, 0); \ ^ ./include/linux/quota.h:114:3: note: in expansion of macro 'BUG' BUG(); ^ In file included from :0:0: ././include/linux/compiler_types.h:214:24: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]

define asm_inline asm __inline

                    ^
shenping-bd commented 3 months ago

Your gcc seems too old. Please upgrade the gcc toolchain to the same version of target kernels (cat /proc/version).

Percivalll commented 3 months ago

Ok. Thanks!