Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm trying to build linux kernel 4.15 but failed, with tons of error messages. Seems not only one thing went wrong. Specific information are found below.
build platform specifications:
gcc: 9.3.0
make: 4.3
libelf: 0.178
build commands:
Code:
$ mkdir build
$ make O=`pwd`/build/ mrproper
$ make ARCH=x86_64 O=`pwd`/build/ x86_64_defconfig
$ make ARCH=x86_64 O=`pwd`/build/ -j`nproc`
error messages:
Code:
In file included from /usr/include/gelf.h:32,
from arch/x86/../../elf.h:22,
from arch/x86/decode.c:26:
/usr/include/libelf.h:46:4: error: unknown type name ‘Elf32_Word’
46 | Elf32_Word ch_type; /* Compression format. */
| ^~~~~~~~~~
/usr/include/libelf.h:47:4: error: unknown type name ‘Elf32_Word’
47 | Elf32_Word ch_size; /* Uncompressed data size. */
| ^~~~~~~~~~
/usr/include/libelf.h:48:4: error: unknown type name ‘Elf32_Word’
48 | Elf32_Word ch_addralign; /* Uncompressed data alignment. */
| ^~~~~~~~~~
/usr/include/libelf.h:53:4: error: unknown type name ‘Elf64_Word’
53 | Elf64_Word ch_type; /* Compression format. */
| ^~~~~~~~~~
/usr/include/libelf.h:54:4: error: unknown type name ‘Elf64_Word’
54 | Elf64_Word ch_reserved;
| ^~~~~~~~~~
/usr/include/libelf.h:55:4: error: unknown type name ‘Elf64_Xword’
55 | Elf64_Xword ch_size; /* Uncompressed data size. */
| ^~~~~~~~~~~
/usr/include/libelf.h:56:4: error: unknown type name ‘Elf64_Xword’
56 | Elf64_Xword ch_addralign; /* Uncompressed data alignment. */
| ^~~~~~~~~~~
/usr/include/libelf.h:255:8: error: unknown type name ‘Elf32_Ehdr’
255 | extern Elf32_Ehdr *elf32_getehdr (Elf *__elf);
| ^~~~~~~~~~
/usr/include/libelf.h:257:8: error: unknown type name ‘Elf64_Ehdr’
257 | extern Elf64_Ehdr *elf64_getehdr (Elf *__elf);
| ^~~~~~~~~~
/usr/include/libelf.h:260:8: error: unknown type name ‘Elf32_Ehdr’
260 | extern Elf32_Ehdr *elf32_newehdr (Elf *__elf);
| ^~~~~~~~~~
/usr/include/libelf.h:262:8: error: unknown type name ‘Elf64_Ehdr’
262 | extern Elf64_Ehdr *elf64_newehdr (Elf *__elf);
| ^~~~~~~~~~
/usr/include/libelf.h:271:8: error: unknown type name ‘Elf32_Phdr’
271 | extern Elf32_Phdr *elf32_getphdr (Elf *__elf);
| ^~~~~~~~~~
/usr/include/libelf.h:273:8: error: unknown type name ‘Elf64_Phdr’
273 | extern Elf64_Phdr *elf64_getphdr (Elf *__elf);
| ^~~~~~~~~~
/usr/include/libelf.h:276:8: error: unknown type name ‘Elf32_Phdr’
276 | extern Elf32_Phdr *elf32_newphdr (Elf *__elf, size_t __cnt);
| ^~~~~~~~~~
/usr/include/libelf.h:278:8: error: unknown type name ‘Elf64_Phdr’
278 | extern Elf64_Phdr *elf64_newphdr (Elf *__elf, size_t __cnt);
| ^~~~~~~~~~
/usr/include/libelf.h:285:43: error: unknown type name ‘Elf32_Off’
285 | extern Elf_Scn *elf32_offscn (Elf *__elf, Elf32_Off __offset);
| ^~~~~~~~~
/usr/include/libelf.h:287:43: error: unknown type name ‘Elf64_Off’
287 | extern Elf_Scn *elf64_offscn (Elf *__elf, Elf64_Off __offset);
| ^~~~~~~~~
/usr/include/libelf.h:327:8: error: unknown type name ‘Elf32_Shdr’
327 | extern Elf32_Shdr *elf32_getshdr (Elf_Scn *__scn);
| ^~~~~~~~~~
/usr/include/libelf.h:329:8: error: unknown type name ‘Elf64_Shdr’
329 | extern Elf64_Shdr *elf64_getshdr (Elf_Scn *__scn);
| ^~~~~~~~~~
In file included from arch/x86/../../elf.h:22,
from arch/x86/decode.c:26:
/usr/include/gelf.h:44:9: error: unknown type name ‘Elf64_Half’
44 | typedef Elf64_Half GElf_Half;
| ^~~~~~~~~~
/usr/include/gelf.h:47:9: error: unknown type name ‘Elf64_Word’
47 | typedef Elf64_Word GElf_Word;
| ^~~~~~~~~~
/usr/include/gelf.h:48:9: error: unknown type name ‘Elf64_Sword’
48 | typedef Elf64_Sword GElf_Sword;
| ^~~~~~~~~~~
/usr/include/gelf.h:51:9: error: unknown type name ‘Elf64_Xword’
51 | typedef Elf64_Xword GElf_Xword;
| ^~~~~~~~~~~
/usr/include/gelf.h:52:9: error: unknown type name ‘Elf64_Sxword’
52 | typedef Elf64_Sxword GElf_Sxword;
| ^~~~~~~~~~~~
/usr/include/gelf.h:55:9: error: unknown type name ‘Elf64_Addr’
55 | typedef Elf64_Addr GElf_Addr;
| ^~~~~~~~~~
/usr/include/gelf.h:58:9: error: unknown type name ‘Elf64_Off’
58 | typedef Elf64_Off GElf_Off;
| ^~~~~~~~~
/usr/include/gelf.h:62:9: error: unknown type name ‘Elf64_Ehdr’
62 | typedef Elf64_Ehdr GElf_Ehdr;
| ^~~~~~~~~~
/usr/include/gelf.h:65:9: error: unknown type name ‘Elf64_Shdr’
65 | typedef Elf64_Shdr GElf_Shdr;
| ^~~~~~~~~~
/usr/include/gelf.h:70:9: error: unknown type name ‘Elf64_Section’
70 | typedef Elf64_Section GElf_Section;
| ^~~~~~~~~~~~~
/usr/include/gelf.h:73:9: error: unknown type name ‘Elf64_Sym’
73 | typedef Elf64_Sym GElf_Sym;
| ^~~~~~~~~
/usr/include/gelf.h:77:9: error: unknown type name ‘Elf64_Syminfo’
77 | typedef Elf64_Syminfo GElf_Syminfo;
| ^~~~~~~~~~~~~
/usr/include/gelf.h:80:9: error: unknown type name ‘Elf64_Rel’
80 | typedef Elf64_Rel GElf_Rel;
| ^~~~~~~~~
/usr/include/gelf.h:83:9: error: unknown type name ‘Elf64_Rela’
83 | typedef Elf64_Rela GElf_Rela;
| ^~~~~~~~~~
/usr/include/gelf.h:86:9: error: unknown type name ‘Elf64_Phdr’
86 | typedef Elf64_Phdr GElf_Phdr;
| ^~~~~~~~~~
/usr/include/gelf.h:92:9: error: unknown type name ‘Elf64_Dyn’
92 | typedef Elf64_Dyn GElf_Dyn;
| ^~~~~~~~~
/usr/include/gelf.h:96:9: error: unknown type name ‘Elf64_Verdef’
96 | typedef Elf64_Verdef GElf_Verdef;
| ^~~~~~~~~~~~
/usr/include/gelf.h:99:9: error: unknown type name ‘Elf64_Verdaux’
99 | typedef Elf64_Verdaux GElf_Verdaux;
| ^~~~~~~~~~~~~
/usr/include/gelf.h:102:9: error: unknown type name ‘Elf64_Verneed’
102 | typedef Elf64_Verneed GElf_Verneed;
| ^~~~~~~~~~~~~
/usr/include/gelf.h:105:9: error: unknown type name ‘Elf64_Vernaux’
105 | typedef Elf64_Vernaux GElf_Vernaux;
| ^~~~~~~~~~~~~
/usr/include/gelf.h:109:9: error: unknown type name ‘Elf64_Versym’
109 | typedef Elf64_Versym GElf_Versym;
| ^~~~~~~~~~~~
/usr/include/gelf.h:113:9: error: unknown type name ‘Elf64_auxv_t’
113 | typedef Elf64_auxv_t GElf_auxv_t;
| ^~~~~~~~~~~~
/usr/include/gelf.h:117:9: error: unknown type name ‘Elf64_Nhdr’
117 | typedef Elf64_Nhdr GElf_Nhdr;
| ^~~~~~~~~~
/usr/include/gelf.h:121:9: error: unknown type name ‘Elf64_Move’
121 | typedef Elf64_Move GElf_Move;
| ^~~~~~~~~~
/usr/include/gelf.h:125:9: error: unknown type name ‘Elf64_Lib’
125 | typedef Elf64_Lib GElf_Lib;
| ^~~~~~~~~
/usr/include/gelf.h:232:8: error: unknown type name ‘Elf32_Word’; did you mean ‘GElf_Word’?
232 | Elf32_Word *__xshndx);
| ^~~~~~~~~~
| GElf_Word
/usr/include/gelf.h:238:6: error: unknown type name ‘Elf32_Word’; did you mean ‘GElf_Word’?
238 | Elf32_Word __xshndx);
| ^~~~~~~~~~
| GElf_Word
Code:
arch/x86/decode.c: In function ‘is_x86_64’:
arch/x86/decode.c:43:19: error: request for member ‘e_machine’ in something not a structure or union
43 | switch (elf->ehdr.e_machine) {
| ^
arch/x86/decode.c:44:7: error: ‘EM_X86_64’ undeclared (first use in this function); did you mean ‘is_x86_64’?
44 | case EM_X86_64:
| ^~~~~~~~~
| is_x86_64
arch/x86/decode.c:44:7: note: each undeclared identifier is reported only once for each function it appears in
arch/x86/decode.c:46:7: error: ‘EM_386’ undeclared (first use in this function)
46 | case EM_386:
| ^~~~~~
In file included from arch/x86/decode.c:28:
arch/x86/decode.c:49:51: error: request for member ‘e_machine’ in something not a structure or union
49 | WARN("unexpected ELF machine type %d", elf->ehdr.e_machine);
| ^
arch/x86/../../warn.h:58:14: note: in definition of macro ‘WARN’
58 | objname, ##__VA_ARGS__)
| ^~~~~~~~~~~
Code:
arch/x86/decode.c:52:1: error: control reaches end of non-void function [-Werror=return-type]
52 | }
| ^
Code:
pager.c: In function ‘pager_preexec’:
pager.c:36:12: error: passing argument 2 to restrict-qualified parameter aliases with argument 4 [-Werror=restrict]
36 | select(1, &in, NULL, &in, NULL);
| ^~~ ~~~
Turns out it is my CPATH environment variable causing issues with the libelf header inclusion. Clearing the environment variable fixed the above compilation issue.
That's your starting point, just go through each error message like this always starting with the first one, clear the error and run the build again till no errors and you'll have a successful build!
Turns out it is my CPATH environment variable causing issues with the libelf header inclusion. Clearing the environment variable fixed the above compilation issue.
That's your starting point, just go through each error message like this always starting with the first one, clear the error and run the build again till no errors and you'll have a successful build!
Your advice is really helpful. I'm now working on it. Thanks.
I'm trying to build linux kernel 4.15 but failed, with tons of error messages.
I do wonder why you would be working on such an older (and EOL) kernel?
Kernel 4.15 had been released on 28 Jan 2018 and had its last update (4.15.18) about 3 months later on 19 Apr 2018
It was a short-term release, unlike 4.14 and 4.19, which both are still supported by the kernel team.
I do wonder why you would be working on such an older (and EOL) kernel?
Kernel 4.15 had been released on 28 Jan 2018 and had its last update (4.15.18) about 3 months later on 19 Apr 2018
It was a short-term release, unlike 4.14 and 4.19, which both are still supported by the kernel team.
Actually I didn't mean to either.
An assignment of mine requires a linux kernel module works on Deepin 15.11, which uses a fork of Kernel 4.15 by default. I'm attempting to cross-compile the module (and test on a VM later) in order to avoid installing Deepin on my laptop or coding on a VM. It turns out that I should have kernel 4.15 compiled to manage to it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.