Page 1 of 1

Meaty Skeleton undefined reference to _init

Posted: Tue Nov 17, 2015 1:32 pm
by Kirdow
I am currently following the Meaty skeleton page. I've copied (by writing it by hand) the code and the file structure and I'm currently at the step where you run the shell scripts.
First I run

Code: Select all

./clean.sh
That one runs perfectly. Then I run

Code: Select all

./headers.sh
Which also seem to work fine. But then it comes to

Code: Select all

./iso.sh
That one ends with an error. The last few lines say:

Code: Select all

lf/4.9.2/crtend.o arch/i386/crtn.o     -nostdlib -lk -lgcc 
arch/i386/boot.o: In function `_start':
/home/kirdow/KirdOS/0.0.1/sysroot/kernel/arch/i386/boot.S:32: undefined reference to `_init'
collect2: error: ld returned 1 exit status
make: *** [kirdos.kernel] Error 1
make: Leaving directory `/home/kirdow/KirdOS/0.0.1/sysroot/kernel'
There you can see that I've got 1 error. The error says boot.S:32: undefined reference to `_init'. That's the line where you do call _init from the _start function.
I've tried to compare the code, and as far as I've seen I found no typos/errors. I guess the errors mean that it doesn't find _init anywhere in the code, and tells that the reference to it is undefined,
because like I said, it can't find it. I did find a post by Dennisbonke when searching google for "meaty skeleton _init" which was about a duplicate _init.
That is kindof what I'm looking for, but instead of 1 more of _init, I have 1 less of _init, In this case, I seem to have no _init.

So what could the problem be? why is _init undefined in boot.S when i actually declared it in crti.S?

Re: Meaty Skeleton undefined reference to _init

Posted: Tue Nov 17, 2015 3:08 pm
by Kirdow
Update
I've spent an hour comparing the files side by side. 1 window containing code that I've written, the other from the git clone. I've looked thru all files and I can't seem to find anything wrong.
This is getting weird in my opinion

Re: Meaty Skeleton undefined reference to _init

Posted: Tue Nov 17, 2015 3:18 pm
by BASICFreak
It is an external label.

AT&T:
.extern _init

Intel:
[extern _init]

I haven't checked the depository, but if it's the same as the sections on the WiKi the external labels are not defined locally (in the source file)

Re: Meaty Skeleton undefined reference to _init

Posted: Wed Nov 18, 2015 5:14 am
by Kirdow
Actually it was just a typo somewhere, accidentally switched position of 2 letters. It's fixed now :)

Re: Meaty Skeleton undefined reference to _init

Posted: Thu Nov 19, 2015 9:04 am
by sortie
Be sure to just git checkout instead of copying. The tutorial tells you to do that to avoid situations like this.