Joh*_*ong 15 compiling kernel gcc
我一直在尝试在 Ubuntu 16.10 上编译最新的 Linux v4.8.9 内核,在我设置默认 .config、使用 menuconfig 修改它并自行运行 make 后,此错误不断弹出。解压缩文件后,我还运行了 make mrproper。这是我运行 make 后的输出:
scripts/kconfig/conf --silentoldconfig Kconfig
SYSTBL arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h
SYSHDR arch/x86/entry/syscalls/../../include/generated/asm/unistd_32_ia32.h
SYSHDR arch/x86/entry/syscalls/../../include/generated/asm/unistd_64_x32.h
SYSTBL arch/x86/entry/syscalls/../../include/generated/asm/syscalls_64.h
SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_32.h
SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_64.h
SYSHDR arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_x32.h
HOSTCC arch/x86/tools/relocs_32.o
HOSTCC arch/x86/tools/relocs_64.o
HOSTCC arch/x86/tools/relocs_common.o
HOSTLD arch/x86/tools/relocs
CHK include/config/kernel.release
UPD include/config/kernel.release
WRAP arch/x86/include/generated/asm/clkdev.h
WRAP arch/x86/include/generated/asm/cputime.h
WRAP arch/x86/include/generated/asm/dma-contiguous.h
WRAP arch/x86/include/generated/asm/early_ioremap.h
WRAP arch/x86/include/generated/asm/mcs_spinlock.h
WRAP arch/x86/include/generated/asm/mm-arch-hooks.h
CHK include/generated/uapi/linux/version.h
UPD include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
CC kernel/bounds.s
kernel/bounds.c:1:0: error: code model kernel does not support PIC mode
/*
Kbuild:45: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:1015: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
Run Code Online (Sandbox Code Playgroud)
我还尝试在 make 命令之后使用 -no-pie 选项进行编译,但它会呈现一组新错误,不断说“缺少目标”。我有 gcc 版本 6.2.0。我还安装了 gcc-5,因为我一开始认为这可能是因为 gcc 太新了,但 gcc-5 中仍然存在同样的问题。邮件列表或其他论坛中的某个人提到通过直接从 git 克隆解决了问题,但这对我的场景也没有帮助。
我很好奇是否还有其他人遇到过这个问题,如果有,可能的解决方法是什么?
注意:如果这可能是问题的根源,我正在 Mac 上的 Virtualbox 中运行 Ubuntu。
Nat*_*tim 11
打开 Makefile,查找 CFLAGS_EXTRA 并添加以下选项 -fno-pie
我有这条线:
EXTRA_CFLAGS += $(CFLAGS_EXTRA)
Run Code Online (Sandbox Code Playgroud)
我将其更改为:
EXTRA_CFLAGS += $(CFLAGS_EXTRA) -fno-pie
Run Code Online (Sandbox Code Playgroud)
对于构建内核 4,上面的标志是:KBUILD_CFLAGS.
它再次开始编译。
| 归档时间: |
|
| 查看次数: |
51148 次 |
| 最近记录: |