Tutorial Meaty Skeleton & -lk option
Posted: Tue Mar 17, 2020 12:48 pm
Hi all,
OS dev newbie here.
I've followed the Meaty Skeleton tutorial and launched the ./iso.sh script.
During the compilation I received the following error:
If I got it right it seems ld doesn't find the k library.
I also searched inside the forum but I couldn't find anything.
Where is my mistake?
Thanks
EDIT:
I'm going to answer to myself, should someone else be silly like me (it's hard I know).
1) I downloaded the source of the Meaty Skeleton from the git repository instead of using what is written under the web page of the Meaty Skeleton tutorial. First, because it was suggested to so in order to avoid "error-prone copy mistakes" and second the one on git seemed to me slightly more updated. The downloaded source contains an additional library never mentioned in the tutorial. In particular under libc/Makefile, line 52 the variable BINARIES is also assigned the library libg.a. Remove it. At lines 62 there is a relative rule of libg.a. Remove its entire rule.
2) Inside the shell script build.sh I left mistakenly the variable $SYSROOT. That came from the source from the online (here) tutorial of Meaty Skeleton that I has started to use before switching to the git ones. The git repository instead has used simply sysroot.
Additional Bonus:
In my case I couldn't install grub on wsl2 (I'm using it instead of an official distribution). I installed instead apt-get install grub-pc and it worked creating the iso image.
OS dev newbie here.
I've followed the Meaty Skeleton tutorial and launched the ./iso.sh script.
During the compilation I received the following error:
Code: Select all
i686-elf-gcc --sysroot=/home/username/test/os/test4/sysroot -isystem=/usr/include -T arch/i386/linker.ld -o myos.kernel -O2 -g -ffreestanding -fbuiltin -Wall -Wextra arch/i386/crti.o /home/username/opt/cross/lib/gcc/i686-elf/9.2.0/crtbegin.o arch/i386/boot.o arch/i386/gdt.o arch/i386/idt.o arch/i386/interrupt-entry.o arch/i386/interrupt.o arch/i386/pic.o arch/i386/tty.o kernel/kernel.o /home/username/opt/cross/lib/gcc/i686-elf/9.2.0/crtend.o arch/i386/crtn.o -nostdlib -lk -lgcc
/home/username/opt/cross/lib/gcc/i686-elf/9.2.0/../../../../i686-elf/bin/ld: cannot find -lk
collect2: error: ld returned 1 exit status
Makefile:55: recipe for target 'myos.kernel' failed
make: *** [myos.kernel] Error 1
I also searched inside the forum but I couldn't find anything.
Where is my mistake?
Thanks
EDIT:
I'm going to answer to myself, should someone else be silly like me (it's hard I know).
1) I downloaded the source of the Meaty Skeleton from the git repository instead of using what is written under the web page of the Meaty Skeleton tutorial. First, because it was suggested to so in order to avoid "error-prone copy mistakes" and second the one on git seemed to me slightly more updated. The downloaded source contains an additional library never mentioned in the tutorial. In particular under libc/Makefile, line 52 the variable BINARIES is also assigned the library libg.a. Remove it. At lines 62 there is a relative rule of libg.a. Remove its entire rule.
2) Inside the shell script build.sh I left mistakenly the variable $SYSROOT. That came from the source from the online (here) tutorial of Meaty Skeleton that I has started to use before switching to the git ones. The git repository instead has used simply sysroot.
Additional Bonus:
In my case I couldn't install grub on wsl2 (I'm using it instead of an official distribution). I installed instead apt-get install grub-pc and it worked creating the iso image.