Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

[ERROR -> kernel build] ld.lld unable to find zlib while building #25

Closed
azwyver opened this issue Jul 14, 2021 · 59 comments
Closed

[ERROR -> kernel build] ld.lld unable to find zlib while building #25

azwyver opened this issue Jul 14, 2021 · 59 comments

Comments

@azwyver
Copy link

azwyver commented Jul 14, 2021

When compiling the kernel using gmake LLVM=1 YACC=byacc -j "$(nproc):
ld.lld: error: arch/x86/realmode/rm/wakemain.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/wakemain.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/wakemain.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/wakemain.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/wakemain.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/video-mode.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/video-mode.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/video-mode.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/video-mode.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/video-mode.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/video-mode.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/regs.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/regs.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/regs.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/regs.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/regs.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/video-vga.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/video-vga.o: contains a compressed section, but zlib is not available ld.lld: error: arch/x86/realmode/rm/video-vga.o: contains a compressed section, but zlib is not available ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

The kernel version is 5.13.1. Other details will be provided if demanded.

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

Here's more neater version of the error:
ld.lld: error: arch/x86/realmode/rm/wakemain.o: contains a compressed section, but zlib is not available

@konimex
Copy link
Member

konimex commented Jul 14, 2021

Can you try rebuilding zlib and try to compile the kernel again?

@dilyn-corner can you reproduce this? I don't think I ever encountered this problem.

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

Nope, It doesn't seem to be working. I've updated my system, rebuilt zlib but the problem still exists.

1 similar comment
@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

Nope, It doesn't seem to be working. I've updated my system, rebuilt zlib but the problem still exists.

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

I'm sorry about the above comment being repeated. I'm running Github on Palemoon so its broken.

@konimex
Copy link
Member

konimex commented Jul 14, 2021

How about rebuilding LLVM itself? Though I doubt it will work.

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

Because I've already re-built all the packages before continuing to the kernel installation and because I don't have any updates and also because LLVM takes a damn long to compile, I also doubt it will work.

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

I had this command previously running (before shutting down my computer and again re-mounting everything), and I also have the vmlinuz and System.map, but when I re-built it not even changing any options It gives me this error.

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

I was able to find this android/ndk#888. Maybe something relatable?

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

It seems like its something to do with libelf. I'll try rebuilding it and I'll update you with the results :)

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

Nope, it seems to be stuck on arch/x86/realmode/rm/realmode.elf inside the kernel source. Here are the make flags I'm using that may or may not help:
export CFLAGS="-march=skylake -mtune=skylake -pipe -Os" export CXXFLAGS="-march=skylake -mtune=skylake -pipe -Os" export MAKEFLAGS="-j4"

@dilyn-corner
Copy link
Contributor

I'll see if I can reproduce this in a bit.

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

I have the kernel compression mode set to Bzip2 instead of Gzip, might that be a compromise?

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

@dilyn-corner Till then, I'll try tinkering with the kernel config. I guess that would be something to check.

@konimex
Copy link
Member

konimex commented Jul 14, 2021

Alright, so I'm currently doing a kernel build in a fresh rootfs, with defconfig, no additional CFLAGS apart of the default kiss-chroot one, installed gmake and libelf. No errors so far.

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

@konimex Good luck

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

Hmm, this is weird I have CONFIG_IKHEADERS set to n but it fallbacks to y and so for gcc plugins.

@konimex
Copy link
Member

konimex commented Jul 14, 2021

Alright. I built kernel 5.10.47 with no problems here. Just an error because I forgot to install perl.

Can you give your kernel configs here? Since it's well over midnight I'll try to build the kernel with your config tomorrow.

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

Alright, here's the link for the kernel config (know issues: fallbacks to y for CONFIG_IKHEADERS and CONFIG_HAVE_GCC_PLUGINS):
https://hatebin.com/ygqruporti
P.S. I use Linux kernel 5.13.1

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

@konimex Hey konimex! I used the previously built vmlinuz and system.map and it seems to work great! however is says /bin/bash not found. Might this be easier to solve?

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

@dilyn-corner Just in case, can you help me with the above one?

@dilyn-corner
Copy link
Contributor

dilyn-corner commented Jul 14, 2021

What is saying /bin/bash not found? Building the kernel? The init?

FWIW I can't reproduce this, because I can't get past make prepare:

In file included from kernel/bounds.c:10:
In file included from ./include/linux/page-flags.h:10:
In file included from ./include/linux/bug.h:5:
In file included from ./arch/x86/include/asm/bug.h:84:
In file included from ./include/asm-generic/bug.h:20:
In file included from ./include/linux/kernel.h:17:
./include/linux/printk.h:92:2: error: unknown type name 'va_list'
        va_list *va;
        ^
./include/linux/printk.h:170:21: error: unknown type name 'va_list'
                 const char *fmt, va_list args);
                                  ^
./include/linux/printk.h:173:30: error: unknown type name 'va_list'
int vprintk(const char *fmt, va_list args);
                             ^
In file included from kernel/bounds.c:10:
In file included from ./include/linux/page-flags.h:10:
In file included from ./include/linux/bug.h:5:
In file included from ./arch/x86/include/asm/bug.h:84:
In file included from ./include/asm-generic/bug.h:20:
./include/linux/kernel.h:339:61: warning: declaration specifier missing, defaulting to 'int'
extern __printf(2, 0) int vsprintf(char *buf, const char *, va_list);
                                                            ^
                                                            int
./include/linux/kernel.h:339:27: warning: incompatible redeclaration of library function 'vsprintf' [-Wincompatible-library-redeclaration]
extern __printf(2, 0) int vsprintf(char *buf, const char *, va_list);
                          ^
./include/linux/kernel.h:339:27: note: 'vsprintf' is a builtin with type 'int (char *, const char *, struct __va_list_tag *)'
./include/linux/kernel.h:343:56: error: unknown type name 'va_list'
int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
                                                       ^
./include/linux/kernel.h:347:57: error: unknown type name 'va_list'
int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
                                                        ^
./include/linux/kernel.h:351:46: error: unknown type name 'va_list'
char *kvasprintf(gfp_t gfp, const char *fmt, va_list args);
                                             ^
./include/linux/kernel.h:353:58: error: unknown type name 'va_list'
const char *kvasprintf_const(gfp_t gfp, const char *fmt, va_list args);
                                                         ^
./include/linux/kernel.h:358:41: warning: declaration specifier missing, defaulting to 'int'
int vsscanf(const char *, const char *, va_list);
                                        ^
                                        int
./include/linux/kernel.h:358:5: warning: incompatible redeclaration of library function 'vsscanf' [-Wincompatible-library-redeclaration]
int vsscanf(const char *, const char *, va_list);
    ^
./include/linux/kernel.h:358:5: note: 'vsscanf' is a builtin with type 'int (const char *__restrict, const char *__restrict, struct __va_list_tag *)'
./include/linux/kernel.h:681:33: error: unknown type name 'va_list'
ftrace_vprintk(const char *fmt, va_list ap)
                                ^
4 warnings and 8 errors generated.
gmake[1]: *** [scripts/Makefile.build:117: kernel/bounds.s] Error 1
gmake: *** [Makefile:1235: prepare0] Error 2

Odd, because stdarg.h is most certainly included in this files.

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

I fixed that by changing /etc/passwd but my wifi is not working. I have drivers and also the firmware in the kernel but the interface shows up in ip a as sit0@NONE.

@azwyver
Copy link
Author

azwyver commented Jul 14, 2021

NVM some firmware didnt loaded. AND after putting it amd rebuilding the kernel, I get the same error as mentioned in above in the issue.

@konimex
Copy link
Member

konimex commented Jul 15, 2021

Your kernel config is cut off (see last line), try to upload to another pastebin service (like termbin.com).

@azwyver
Copy link
Author

azwyver commented Jul 15, 2021

Alright, heres the termbin link:
https://termbin.com/7xs5

@azwyver
Copy link
Author

azwyver commented Jul 15, 2021

And I also confirmed Its complete.

@azwyver
Copy link
Author

azwyver commented Jul 15, 2021

Hey there! Its morning time here and I have school so I might not be available for long. I hope this wont be a big problem.

@azwyver
Copy link
Author

azwyver commented Jul 15, 2021

Hmm, will the latest LTS release work? (5.10.50)?

@konimex
Copy link
Member

konimex commented Jul 15, 2021

I don't know, kernels vary from person to person. But 5.10.47 works for me.

@dilyn-corner
Copy link
Contributor

Strangely my problems building 5.13.2 have resolved themselves; the only substantial change I've made that I could think would be effecting this is a horribly broken libclang-rt.builtin.

I can't reproduce this problem with the latest kernel and your .config with some minor tweaks (removed the firmware inclusion, switched xz compression to zstd compression). I'd first try to clean up the kernel source tree with a gmake LLVM=1 LLVM_IAS=1 YACC=yacc clean (or even mrproper if you want to be super safe), and try rebuilding again.

@azwyver
Copy link
Author

azwyver commented Jul 20, 2021

Extremely sorry for being lost for a week or so. But, seems like my kernel installation is very crude. If I want to install the kernel youve mentioned, then would i have to do that in chroot? and how can i do a clean reinstall of kernel without using old .config file?

@azwyver
Copy link
Author

azwyver commented Jul 20, 2021

I also seem to be missing the wheel group too.

@otternpals
Copy link

well yet another alt but @dilyn-corner can you help me in this please?

@otternpals
Copy link

Hello @azwyver alt here, the errors still exist and I am stuck on this process. Isn't there any workaround?

@konimex
Copy link
Member

konimex commented Jul 20, 2021

The main problem is both Dilyn and I cannot reproduce the problem in any way, so we don't know of any workarounds or even anything.

  1. Are you using a fresh tarball?
  2. Provide step by step to reproduce, from downloading the tarball to the step where you got any error.

@otternpals
Copy link

I'm not using a fresh tarball, instead am using the linux headers one so I guess that's something that is causing problems. Other than that, I didn't used curl properly (i guess I just wrote the output to a .tar file). Other than that, the steps for reproducing are:

  1. Logout from chroot
  2. Re-enter chroot with the necessary mount commands
  3. cd into the source directory (which is my case was /usr/src/linux-5.13.1)
  4. run gmake LLVM=1 YACC=byacc -j4
  5. Take a look at the error

@otternpals
Copy link

If I wanted to install the fresh kernel from scratch (basically removing the previous modules and replacing them with the new ones and so for the install) how would I? (of course using the old .config file)

@konimex
Copy link
Member

konimex commented Jul 20, 2021

I meant your Wyverkiss rootfs tarball.

@otternpals
Copy link

Oh. I don't remember that. As far as I know, I downloaded it using my browser. Used the .asc file and .sha256sum file to verify whether its the right file, extracted it to /mnt and chrooted using command chroot /mnt /bin/sh (before this I mounted necessary psuedo-psdue-psdueo? filesystems)

@konimex
Copy link
Member

konimex commented Jul 20, 2021

You know, the installation guide has been outdated for some time. I'll need to update it in line with KISS' new guidelines, but it's already nighttime here so will look into it tomorrow.

@otternpals
Copy link

So, I have to re-do everything from scratch or something? :|

@otternpals
Copy link

Man, as far as I know it was working when I compiled it the first time, but later on the second time I did it, it really f***** up.

@otternpals
Copy link

ld.lld: error: arch/x86/realmode/rm/wakemain.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/wakemain.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/wakemain.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/wakemain.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/wakemain.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/wakemain.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/video-mode.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/video-mode.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/video-mode.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/video-mode.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/video-mode.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/video-mode.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/regs.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/regs.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/regs.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/regs.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/regs.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/video-vga.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/video-vga.o: contains a compressed section, but zlib is not available
ld.lld: error: arch/x86/realmode/rm/video-vga.o: contains a compressed section, but zlib is not available
ld.lld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)

I hope this is much neater.
Complete log file can be found here: https://termbin.com/7e7i

@otternpals
Copy link

Well, I'm thinking to re-download a fresh iso (SystemRescueCD in my case), verify it, flash it into a usb, and re-do all this from scratch. Will be waiting till you update the documentation tommorow. (Please tell if you have done the necessary changes 😃

@azwyver
Copy link
Author

azwyver commented Jul 21, 2021

Finally I got access to my account! Anyways, I've also re-compiled LLVM along with its dependencies but the problem still exists. Hopefully we'll get the doc update in a hour or so.

@azwyver
Copy link
Author

azwyver commented Jul 21, 2021

Finally I got access to my account! Anyways, I've also re-compiled LLVM along with its dependencies but the problem still exists. Hopefully we'll get the doc update in a hour or so.

P.S. I'm now having a 3.0 USB with SystemRescueCd so idk whether that does something or not but I thought it might make a difference.

@konimex
Copy link
Member

konimex commented Jul 21, 2021

It's uploaded here: https://github.com/wyvertux/wyverkiss/blob/install/INSTALL.md

But it's still on early stage and I still have nits to tackle, but the step should be similar.

@azwyver
Copy link
Author

azwyver commented Jul 21, 2021

It's uploaded here: https://github.com/wyvertux/wyverkiss/blob/install/INSTALL.md

But it's still on early stage and I still have nits to tackle, but the step should be similar.

Yay! Seems good to me so far.

@azwyver
Copy link
Author

azwyver commented Jul 21, 2021

Bruh, the error just magically fixed with the new build command bruv.

@azwyver
Copy link
Author

azwyver commented Jul 21, 2021

I guess its either with the problem with the variables (i guess the LLVM_IAS=1) or with the compile flags (which I used of the kiss chroot).

@azwyver
Copy link
Author

azwyver commented Jul 21, 2021

export CFLAGS="-march=skylake -mtune=skylake -pipe -Os 
export CXXFLAGS="-march=skylake -mtune=skylake -pipe -Os
export MAKEFLAGS="-j4"

This was the one I originally had while the KISS chroot's one are like more generic flags.

@azwyver
Copy link
Author

azwyver commented Jul 21, 2021

Wait, how do I do a clean kernel install now? with the commands mentioned in the documentation or the same command without the INSTALL_MOD_STRIP variable?

@azwyver
Copy link
Author

azwyver commented Jul 21, 2021

$ gmake install
There's also a gcc not found error in this one.

@azwyver
Copy link
Author

azwyver commented Jul 21, 2021

mv /boot/vmlinuz/boot/vmlinuz-VERSION Space is required.
mv /boot/vmlinuz /boot/vmlinuz-VERSION

@konimex
Copy link
Member

konimex commented Jul 21, 2021

Wait, how do I do a clean kernel install now? with the commands mentioned in the documentation or the same command without the INSTALL_MOD_STRIP variable?

just gmake clean and do it all over. Oh, and ignore the GCC error for gmake clean if it exists.

There's also a gcc not found error in this one.

Just ignore the error.

mv /boot/vmlinuz/boot/vmlinuz-VERSION Space is required.

Changed.

Since your issue is fixed, I'm closing it now. Please don't spam reply since the emails are piling up.

@konimex konimex closed this as completed Jul 21, 2021
@azwyver
Copy link
Author

azwyver commented Jul 21, 2021

Wait, how do I do a clean kernel install now? with the commands mentioned in the documentation or the same command without the INSTALL_MOD_STRIP variable?

just gmake clean and do it all over. Oh, and ignore the GCC error for gmake clean if it exists.

There's also a gcc not found error in this one.

Just ignore the error.

mv /boot/vmlinuz/boot/vmlinuz-VERSION Space is required.

Changed.

Since your issue is fixed, I'm closing it now. Please don't spam reply since the emails are piling up.

Thank you and sorry for the reply.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants