Kernel compilation fails!

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
stychokiller

Kernel compilation fails!

Post by stychokiller »

Trying to compile a new kernel results in the following:
CC arch/x86/kernel/asm-offsets.s
In file included from include/linux/suspend.h:8:0,
from arch/x86/kernel/asm-offsets.c:12:
include/linux/mm.h:667:2: error: #error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
^
make[3]: *** [arch/x86/kernel/asm-offsets.s] Error 1


I'm running Linux Mint V17.3, 32-bit; uname -r is 4.4.0-116-generic
As far as I know, :roll: BITS_PER_LONG is 32-bits, so SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH has to be
< 32-bits (- NR_PAGEFLAGS). In summary, how do I fix this? Is it a kernel configuration problem? :?:
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
catweazel
Level 19
Level 19
Posts: 9763
Joined: Fri Oct 12, 2012 9:44 pm
Location: Australian Antarctic Territory

Re: Kernel compilation fails!

Post by catweazel »

stychokiller wrote: Thu Apr 05, 2018 3:37 am

Code: Select all

 #error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
What files did you download, from where, and what instructions, if any, are you following?
"There is, ultimately, only one truth -- cogito, ergo sum -- everything else is an assumption." - Me, my swansong.
stychokiller

Re: Kernel compilation fails!

Post by stychokiller »

First, let me state that I've compiled kernels in the past, just not with Linux Mint. :P Here's a pertinent
list of what I think is needed to compile a kernel: :?
installed: linux-source-3.13.0
installed: linux-headers-4.4.0-116
installed: linux-headers-4.4.0-116-generic

Other installed packages... (not an exhaustive list!)
installed: linux-firmware
installed: linux-generic-lts-xenial (???)
installed: linux-headers-generic-lts-xenial
installed: linux-image-4.4.0-116-generic (???)
installed: linux-image-extra-4.4.0-116-generic (???)
installed: linux-image-generic-lts-xenial (???)
installed: linux-kernel-generic (???)

As far as I know, only linux-headers and linux-source are needed to create a kernel. Gcc, binutils, make, etc
are also installed and working, since I can compile my own C-source code files & projects.
WharfRat

Re: Kernel compilation fails!

Post by WharfRat »

If you're compiling 3.13.0 you need the matching headers for that series.

I don't see 3.13 in the repos :?
Cosmo.
Level 24
Level 24
Posts: 22968
Joined: Sat Dec 06, 2014 7:34 am

Re: Kernel compilation fails!

Post by Cosmo. »

@WhardRat:

It seems, that you overlooked, that the OP uses LM 17.3, so kernel 3.13 is of course available and is LTS there.
WharfRat

Re: Kernel compilation fails!

Post by WharfRat »

Cosmo. wrote: Thu Apr 05, 2018 9:28 am @WhardRat:

It seems, that you overlooked, that the OP uses LM 17.3, so kernel 3.13 is of course available and is LTS there.
oops :oops:
stychokiller

Re: Kernel compilation fails!

Post by stychokiller »

Furthermore, synaptic and the software update manager install linux-headers-GoofVersionString in their own /usr/src directory,
which is separate from /usr/src/linux-source-AnotherGoofyVersionString. It appears to me that whatever is wrong is to be
found in the /usr/src/linux-source-AnotherGoofyVersionString/include headers or configuration selections that I've made.

Also:
make[2]: Leaving directory `/usr/src/linux-source-3.13.0'
make EXTRAVERSION=-ckt39-jts1 ARCH=i386 prepare
make[2]: Entering directory `/usr/src/linux-source-3.13.0'
scripts/kconfig/conf --silentoldconfig Kconfig
make[2]: Leaving directory `/usr/src/linux-source-3.13.0'
make[2]: Entering directory `/usr/src/linux-source-3.13.0'
make[3]: Nothing to be done for `all'.
make[3]: Nothing to be done for `relocs'.
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CC arch/x86/kernel/asm-offsets.s
In file included from include/linux/suspend.h:8:0,
from arch/x86/kernel/asm-offsets.c:12:
include/linux/mm.h:667:2: error: #error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
#error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS
^
make[3]: *** [arch/x86/kernel/asm-offsets.s] Error 1
make[2]: *** [prepare0] Error 2
make[2]: Leaving directory `/usr/src/linux-source-3.13.0'
The key here is:
include/linux/mm.h:667:2: error: #error SECTIONS_WIDTH+NODES_WIDTH+ZONES_WIDTH > BITS_PER_LONG - NR_PAGEFLAGS

Which tells me this is a memory manager setting that's failing.
It's quite a Wampus hunt to find exactly WHERE SECTIONS_WIDTH, NODES_WIDTH, ZONES_WIDTH & NR_PAGEFLAGS
are #defined, because they're NOT all located in one header file.
WharfRat

Re: Kernel compilation fails!

Post by WharfRat »

What does this return apt search linux-headers|grep ^i
stychokiller

Re: Kernel compilation fails!

Post by stychokiller »

apt search linux-headers|grep ^i returns:

i linux-headers-3.13.0-133 - Header files related to Linux kernel versi
i linux-headers-3.19.0-32 - Header files related to Linux kernel versi
i linux-headers-3.19.0-32-generic - Linux kernel headers for version 3.19.0 on
i A linux-headers-4.4.0-109 - Header files related to Linux kernel versi
i A linux-headers-4.4.0-109-generic - Linux kernel headers for version 4.4.0 on
i A linux-headers-4.4.0-111 - Header files related to Linux kernel versi
i A linux-headers-4.4.0-111-generic - Linux kernel headers for version 4.4.0 on
i A linux-headers-4.4.0-112 - Header files related to Linux kernel versi
i A linux-headers-4.4.0-112-generic - Linux kernel headers for version 4.4.0 on
i A linux-headers-4.4.0-116 - Header files related to Linux kernel versi
i A linux-headers-4.4.0-116-generic - Linux kernel headers for version 4.4.0 on
i A linux-headers-4.4.0-119 - Header files related to Linux kernel versi
i A linux-headers-4.4.0-119-generic - Linux kernel headers for version 4.4.0 on
i A linux-headers-generic-lts-xenia - Generic Linux kernel headers
WharfRat

Re: Kernel compilation fails!

Post by WharfRat »

You have the generic - Linux kernel headers for every series except the one you're trying to compile :?

Try installing it.
stychokiller

Re: Kernel compilation fails!

Post by stychokiller »

I fixed the Problem!
Re-running make menuconfig and changing Processor Type & Features/Memory Model/ from Sparse to Flat
seems to have fixed this failure! 8)
Locked

Return to “Software & Applications”