AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1157084
Accepted
asdf60367134
asdf60367134
Asked: 2019-07-10 11:08:08 +0800 CST2019-07-10 11:08:08 +0800 CST 2019-07-10 11:08:08 +0800 CST

致命错误:linux/compiler-gcc7.h:没有这样的文件或目录

  • 772

我正在尝试安装Atheros CSI 工具(在此处提供安装说明),在带有 QCA9377 无线适配器的戴尔 Inspiron 5570 笔记本电脑上运行 Ubuntu 18.04.2 LTS。

我能够成功完成安装说明中“编译内核”的“准备”部分中列出的所有操作。(在说明中没有指定一些我能够弄清楚的事情,比如安装make和gcc。)但是,我对这make menuconfig一步及以后的事情感到困惑。当我输入make menuconfigAtheros-CSI-Tool 文件夹时,我立即按“保存”,保存一个名为 的文件.config,然后“退出”菜单。

当我输入make -j16(我有 8 个 CPU 内核)时,输出如下:

  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CC      scripts/mod/empty.o
  CC      scripts/mod/devicetable-offsets.s
cc1: error: code model kernel does not support PIC mode
cc1: error: code model kernel does not support PIC mode
scripts/Makefile.build:258: recipe for target 'scripts/mod/empty.o' failed
make[2]: *** [scripts/mod/empty.o] Error 1
make[2]: *** Waiting for unfinished jobs....
scripts/Makefile.build:153: recipe for target 'scripts/mod/devicetable-offsets.s' failed
make[2]: *** [scripts/mod/devicetable-offsets.s] Error 1
scripts/Makefile.build:403: recipe for target 'scripts/mod' failed
make[1]: *** [scripts/mod] Error 2
make[1]: *** Waiting for unfinished jobs....
Makefile:555: recipe for target 'scripts' failed
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....
make: *** wait: No child processes.  Stop.

当我然后键入make modules时,这是输出:

  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      arch/x86/purgatory/purgatory.o
In file included from include/linux/compiler.h:54:0,
                 from include/uapi/linux/stddef.h:1,
                 from include/linux/stddef.h:4,
                 from ./include/uapi/linux/posix_types.h:4,
                 from include/uapi/linux/types.h:13,
                 from include/linux/types.h:5,
                 from arch/x86/purgatory/sha256.h:14,
                 from arch/x86/purgatory/purgatory.c:13:
include/linux/compiler-gcc.h:121:1: fatal error: linux/compiler-gcc7.h: No such file or directory
 #include gcc_header(__GNUC__)
 ^~~~
compilation terminated.
scripts/Makefile.build:258: recipe for target 'arch/x86/purgatory/purgatory.o' failed
make[1]: *** [arch/x86/purgatory/purgatory.o] Error 1
arch/x86/Makefile:185: recipe for target 'archprepare' failed
make: *** [archprepare] Error 2

我尝试通过从档案中安装旧版本的 Ubuntu (14.04) 来修复遇到的这些错误,但是 Wi-Fi 在该操作系统下的笔记本电脑上不起作用(这很重要,因为我正在收集有关 Wi-Fi 连接的数据使用我尝试安装的工具)。我还从在线存档中安装了旧的 Linux 内核(4.1.10),但遇到了与上图相同的错误。

software-installation wireless compiling gcc atheros
  • 1 1 个回答
  • 16491 Views

1 个回答

  • Voted
  1. Best Answer
    Quar
    2019-07-10T13:39:26+08:002019-07-10T13:39:26+08:00

    这里有两个问题:

    1. Kernel 不支持 PIC 模式编译,详情请看这篇文章。正如@Joy 所指出的,当前安装的 gcc5+ 默认启用了 PIE,我们需要添加-fno-pie到 gcc 选项。

      在这里,我正在遵循此Makefile修复程序,从您克隆的 git 存储库下的L774 开始添加以下行。

      # force no-pie for distro compilers that enable pie by default
      KBUILD_CFLAGS += $(call cc-option, -fno-pie)
      KBUILD_CFLAGS += $(call cc-option, -no-pie)
      KBUILD_AFLAGS += $(call cc-option, -fno-pie)
      KBUILD_AFLAGS += $(call cc-option, -no-pie)
      
      # optional, mute warnings on pointers signedness to speed up compilation
      KBUILD_CFLAGS += $(call cc-option, -Wno-pointer-sign)
      
    2. include/linux/compiler-gcc.h:121:1: fatal error: linux/compiler-gcc7.h,这基本上说明在include/linux您克隆的 git repo 的文件夹下,没有名为compiler-gcc7.h. 目前该文件夹下仅存在compiler-gcc5.h. 因此,直接的方法是安装并临时选择gcc-5默认编译器。下列的:

      # install gcc-5
      sudo apt-get install gcc-5
      
      # use update-alternatives to switch default gcc version
      # register gcc-7
      sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 50
      sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60
      
      # choose gcc-5 at prompt
      update-alternatives --config gcc
      
      # now check gcc version, verify is using gcc-5
      gcc -v
      
      ## gcc version 5.5.0 20171010 (Ubuntu 5.5.0-12ubuntu1)
      

    安装说明说明通过libnl-dev安装

    sudo apt-get install libnl-dev
    

    但libnl-dev18.04 似乎不再存在。考虑使用

    sudo apt-get install libnl-3-dev
    

    相反,如果你有麻烦。

    最后,您可以通过以下方式切换回gcc-7安装后

    # choose gcc-7 at prompt
    update-alternatives --config gcc
    
    • 3

相关问题

  • 如何在没有 root 访问权限的情况下安装软件包?

  • 设置 LAMP 堆栈的最简单方法是什么?

  • 我应该在哪里安装 sagemath?

  • How do I install Adobe Flash player?对于 11.10 及更高版本明确修复 11.10 上的 64 位 Flash

  • 如何设置软件中心为非 root 用户安装软件?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve