Tutorial Meaty Skeleton & -lk option

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
CodeVisio
Posts: 13
Joined: Sat Aug 25, 2012 1:59 am

Tutorial Meaty Skeleton & -lk option

Post by CodeVisio »

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:

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
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.
User avatar
bloodline
Member
Member
Posts: 264
Joined: Tue Sep 15, 2020 8:07 am
Location: London, UK

Re: Tutorial Meaty Skeleton & -lk option

Post by bloodline »

Ok, you have managed to get further than I did with the Meaty Skeleton.

when I run build.sh I just get the error:

Makefile:23: arch//make.config: No such file or directory
make: *** No rule to make target 'arch//make.config'. Stop.

I have always struggled with make... now after 20 years it's time to learn it, any clues as to where I'm going wrong would be most welcome.
CuriOS: A single address space GUI based operating system built upon a fairly pure Microkernel/Nanokernel. Download latest bootable x86 Disk Image: https://github.com/h5n1xp/CuriOS/blob/main/disk.img.zip
Discord:https://discord.gg/zn2vV2Su
Post Reply