• fatal error: linux/compiler-gcc9.h: No such file or directory


    linux

    找到README文件

    cd /mnt/e/CLionProjects/linux-3.10.99
    sudo useradd linux3x
    sudo passwd linux3x
    sudo mkdir /home/linux3x
    sudo chown linux3x:linu3x /home/linux3x
    sudo chmod 755 /home/linux3x
    su - linux3x
    mkdir ~/build
    mkdir ~/build/kernel
    exit
    make O=/home/linux3x/build/kernel menuconfig
    make O=/home/linux3x/build/kernel
    # sudo make O=/home/linux3x/build/kernel modules_install install

    mzh@DESKTOP-GITL67P:~$ gcc --version
    gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
    Copyright (C) 2019 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     

    因为当前gcc版本是9.x, 找不到 compiler-gcc9.h, 复制compiler-gcc5.h成compiler-gcc9.h

    Kernel doesn't support PIC mode for compiling?

    1. # force no-pie for distro compilers that enable pie by default
    2. KBUILD_CFLAGS += $(call cc-option, -fno-pie)
    3. KBUILD_CFLAGS += $(call cc-option, -no-pie)
    4. KBUILD_AFLAGS += $(call cc-option, -fno-pie)
    5. KBUILD_CPPFLAGS += $(call cc-option, -fno-pie)

    cp E:\CLionProjects\linux-3.10.99\linux-3.10.99\include\linux\compiler-gcc5.h E:\CLionProjects\linux-3.10.99\linux-3.10.99\include\linux\compiler-gcc9.h

    CLion头文件报错

    标红,不能跳转

    sudo cp -r ./include/linux/ /usr/local/include/

    不要copy到/usr/include, 否则当前运行的操作系统坏了。

    mzh@DESKTOP-GITL67P:/mnt/e/CLionProjects/linux-3.10.99/linux-3.10.99$ sudo rsync -avz ./include/ /usr/local/include/

    但是这样会重复定义,所以还是用vim算了。

    mzh@DESKTOP-GITL67P:/usr/local/include$ rm -rf acpi/ asm-generic/ clocksource/ config/ crypto/ drm/ dt-bindings/ generated/ keys/ linux3x/ math-emu/ media/ memory/ misc/ net/ pcmcia/ ras/ rdma/ rxrpc/ scsi/ sound/ target/ trace/ uapi/ video/ xen/

    sudo apt-get install ctags

    $ cat tags.sh

    1. #/bin/bash
    2. WORKDIR="/mnt/e/CLionProjects/linux-3.10.99"
    3. find "${WORKDIR}" -name "*.[c|h]" | xargs ctags -f "${WORKDIR}/tags"
    4. # find /usr/include -name "*.h" | xargs ctags -a "${WORKDIR}/tags"

    ctags -a 表示追加索引内容到tags文件。Linux不依赖libc.so,所以不需要添加/usr/include。 

    ./tags.sh

    在~/.vimrc中添加

    set tags="/mnt/e/CLionProjects/linux-3.10.99/linux-3.10.99/tags"

    对于报错Time skewed

    sudo ntpdate -uv time.windows.com

    linux TCP 代码在线查看

    process解析

    Misc on Linux fork, switch_to, and scheduling

    Radix tree 

  • 相关阅读:
    【pytorch】关于OpenCV和PIL.Image读取图片的区别
    使用 Java 操作 Redis
    动态规划-构建乘积数组
    cadence SPB(16.6 or 17.4) backup and restore
    html实现飞机小游戏(源码)
    ElementPlus el-date-picker日期时间选择器组件禁用此刻之前的时间(精确时分秒)
    linux使用stress命令进行压力测试cpu
    goland设置保存文件时不将4个空格转为TAB
    JSP的九大内置对象
    CSS 的继承性和优先级
  • 原文地址:https://blog.csdn.net/fareast_mzh/article/details/132861822