zoukankan      html  css  js  c++  java
  • 由于ptrace.h文件导致的内核编译出错的解决方法

    arch/x86/kernel/ptrace.c:1472:17: error: conflicting types for ‘syscall_trace_enter’ 
    In file included from /home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/vm86.h:130:0, 
                      from /home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/processor.h:10, 
                      from /home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/thread_info.h:22, 
                      from include/linux/thread_info.h:56, 
                      from include/linux/preempt.h:9, 
                      from include/linux/spinlock.h:50, 
                      from include/linux/seqlock.h:29, 
                      from include/linux/time.h:8, 
                      from include/linux/timex.h:56, 
                      from include/linux/sched.h:56, 
                      from arch/x86/kernel/ptrace.c:11: 
    /home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/ptrace.h:146:13: note: previous declaration of ‘syscall_trace_enter’ was here 
    arch/x86/kernel/ptrace.c:1517:17: error: conflicting types for ‘syscall_trace_leave’ 
    In file included from /home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/vm86.h:130:0, 
                      from /home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/processor.h:10, 
                      from /home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/thread_info.h:22, 
                      from include/linux/thread_info.h:56, 
                      from include/linux/preempt.h:9, 
                      from include/linux/spinlock.h:50, 
                      from include/linux/seqlock.h:29, 
                      from include/linux/time.h:8, 
                      from include/linux/timex.h:56, 
                      from include/linux/sched.h:56, 
                      from arch/x86/kernel/ptrace.c:11: 
    /home/rex/Downloads/linux-2.6.32.60/arch/x86/include/asm/ptrace.h:147:13: note: previous declaration of ‘syscall_trace_leave’ was here 
    make[2]: *** [arch/x86/kernel/ptrace.o] Error 1 
    make[1]: *** [arch/x86/kernel] Error 2 
    make: *** [arch/x86] Error 2

    注意红色标注的两行,说明ptrace.c 文件中第1472行的函数syscall_trace_leave和ptrace.h文件中该函数的声明有冲突,只要将ptrace.h文件中的函数声明改得和ptrace.c中的相同即可。另外,有人专门针对这个错误写了个补丁,地址为https://patchwork.kernel.org/patch/1301031/  。

    PS :以前像遇到这种问题的时候,总会认为是自己哪儿出了问题。这个问题让我懂得linux也是像我一样的程序员写出来的,他们也会犯一些常人会犯的错误,所以Linux需要全世界的程序员一起改进  。


    --- linux-2.6.32.59/arch/x86/include/asm/ptrace.h
    +++ fix_ptrace.o_compile_error/arch/x86/include/asm/ptrace.h
    @@ -130,6 +130,7 @@ 
     #ifdef __KERNEL__
     
     #include <linux/init.h>
    +#include <linux/linkage.h>
     
     struct cpuinfo_x86;
     struct task_struct;
    @@ -142,8 +143,8 @@ 
     			 int error_code, int si_code);
     void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
     
    -extern long syscall_trace_enter(struct pt_regs *);
    -extern void syscall_trace_leave(struct pt_regs *);
    +extern asmregparm long syscall_trace_enter(struct pt_regs *);
    +extern asmregparm void syscall_trace_leave(struct pt_regs *);
     
     static inline unsigned long regs_return_value(struct pt_regs *regs)
     {

  • 相关阅读:
    git三种模式及常用命令
    git remote
    页面中添加qq客服
    用ubuntu里的vim搭建一个apache2+php+mysql环境一路踩的坑
    jQuery无new创建对象原理
    国崛战略
    计算机公开课推荐 2019.8
    Unable to preventDefault inside passive event listener due to target being treated as passive 怎么办?
    VUE事件修饰符.passive、.capture、.once实现原理——重新认识addEventListener方法
    看各类框架源码淘来的一些JavaScript技巧
  • 原文地址:https://www.cnblogs.com/xj626852095/p/3648252.html
Copyright © 2011-2022 走看看