OSDev.org
https://forum.osdev.org/

Tutorial Meaty Skeleton & -lk option
https://forum.osdev.org/viewtopic.php?f=1&t=36584
Page 1 of 1

Author:  CodeVisio [ Tue Mar 17, 2020 12:48 pm ]
Post subject:  Tutorial Meaty Skeleton & -lk option

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:
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.

Author:  bloodline [ Wed Sep 16, 2020 4:48 am ]
Post subject:  Re: Tutorial Meaty Skeleton & -lk option

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.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/