I've been trying to compile the latest Linux Kernel, v4.8.9 but I keep encountering this error after I run 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

I have Ubuntu 16.10 running in VirtualBox on a MacBook Pro. I'm using GCC version 6.2.0. I've made sure to run "make mrproper" right after I untarred the file and I've gone through both "make defconfig" and "make menuconfig" before running the actual "make" command by itself.

From the research that I've done on the error, I've gotten a myriad of unrelated fixes for it. One involved directly cloning from source through git but that didn't work for me either. I understand that PIC means Position Independent Code but if I'm correct, I believe GCC 6 is supposed to support that function.

Compiling with "-no-pie" seems to help but I always get these "missing target" errors.

I'm curious if this a problem other people had and what a possible solution for it might be.

closed as off-topic by Mokubai Oct 9 '18 at 12:22

  • This question does not appear to be about computer software or computer hardware within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I think the problem isn't that GCC won't do PIC - it's the other way around. GCC is trying to generate PIC, but the kernel wants fixed-position code. Perhaps there's a CFLAGS in your environment that's surprising the build? – Toby Speight Nov 22 '16 at 16:59
  • I'm voting to close this question as off-topic because it has been cross posted and answered at askubuntu.com/questions/851433/… – Mokubai Oct 9 '18 at 12:22

Browse other questions tagged or ask your own question.