Page 1 of 1

Failing to build wiki tutorial

Posted: Fri Dec 05, 2014 6:03 am
by Dawnkeeper
I am trying to follow the meaty skeleton tutorial from the wiki but get these error messages:

Code: Select all

i686-elf-gcc --sysroot=/home/dawnkeeper/projects/yggdrassil/meatyskeleton/sysroot -isystem=/usr/include -T arch/i386/linker.ld -o myos.kernel -O2 -g -m32 -ffreestanding -fbuiltin -Wall -Wextra  arch/i386/crti.o /home/dawnkeeper/opt/gcc-cross-4.9.2/bin/../lib/gcc/i686-elf/4.9.2/crtbegin.o  kernel/kernel.o  /home/dawnkeeper/opt/gcc-cross-4.9.2/bin/../lib/gcc/i686-elf/4.9.2/crtend.o arch/i386/crtn.o     -nostdlib -lk -lgcc
/home/dawnkeeper/opt/gcc-cross-4.9.2/bin/../lib/gcc/i686-elf/4.9.2/../../../../i686-elf/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000100000
kernel/kernel.o: In function `kernel_early':
/home/dawnkeeper/projects/yggdrassil/meatyskeleton/kernel/kernel/kernel.c:10: undefined reference to `terminal_initialize'
/home/dawnkeeper/projects/yggdrassil/meatyskeleton/sysroot/usr/lib/libk.a(putchar.libk.o): In function `putchar':
/home/dawnkeeper/projects/yggdrassil/meatyskeleton/libc/stdio/putchar.c:11: undefined reference to `terminal_write'
collect2: error: ld returned 1 exit status
make: *** [myos.kernel] Error 1
make: Leaving directory `/home/dawnkeeper/projects/yggdrassil/meatyskeleton/kernel'
I checked the files multiple times but can't find the problem. Can anyone point me in the right direction?

Re: Failing to build wiki tutorial

Posted: Fri Dec 05, 2014 9:04 am
by sortie
I expect the issue is white-space related and occurs when you copy from the wiki. This has happened a few times, I'll try do something about it. I'll make a git repo you can clone instead, so you know you got the right code. Also, that -m32 option looks suspicious, that's not something that is needed - you didn't get that from meaty skeleton. I suggest you verify kernel/arch/i386/make.config is as it should be.

Re: Failing to build wiki tutorial

Posted: Fri Dec 05, 2014 9:16 am
by Dawnkeeper
Thanks for looking into it.

The -m32 is from trying not get errors from being on a 64bit machine and compiling for 32bit. Turned out it was a messed up cross compiler that resolved itself after rebuilding it.

The whitespace error would be in the linker.ld ?

Re: Failing to build wiki tutorial

Posted: Fri Dec 05, 2014 9:55 am
by Dawnkeeper
After a bit of trial and error it now works. Seems there were some additional newlines something along the way didn't like.

If I find the time I'll put it up on github.

Re: Failing to build wiki tutorial

Posted: Fri Dec 05, 2014 10:13 am
by sortie
I updated the article with a section telling people to do a git clone from my git repository.

This should avoid such errors in the future. I'm glad you're using the tutorial and sorry you, among a bunch of errors, fall prone to issues when copying the code manually.

I did a copy of the code myself, with Firefox and a Linux system, and while blank lines was replaced with a single space, that was harmless and the code worked. I don't know how you got your whitespace errors.

Re: Failing to build wiki tutorial

Posted: Sat Dec 06, 2014 2:57 pm
by Dawnkeeper
I added my files for the Bare Bones and Meaty Skeleton to a repo on github.
It also includes the script I used for building the cross compiler.