Meaty Skeleton undefined reference to _init

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
User avatar
Kirdow
Member
Member
Posts: 35
Joined: Sun Sep 06, 2015 2:20 pm
Libera.chat IRC: Kirdow
Location: Sweden

Meaty Skeleton undefined reference to _init

Post 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?
User avatar
Kirdow
Member
Member
Posts: 35
Joined: Sun Sep 06, 2015 2:20 pm
Libera.chat IRC: Kirdow
Location: Sweden

Re: Meaty Skeleton undefined reference to _init

Post 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
User avatar
BASICFreak
Member
Member
Posts: 284
Joined: Fri Jan 16, 2009 8:34 pm
Location: Louisiana, USA

Re: Meaty Skeleton undefined reference to _init

Post 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)
BOS Source Thanks to GitHub
BOS Expanded Commentary
Both under active development!
Sortie wrote:
  • Don't play the role of an operating systems developer, be one.
  • Be truly afraid of undefined [behavior].
  • Your operating system should be itself, not fight what it is.
User avatar
Kirdow
Member
Member
Posts: 35
Joined: Sun Sep 06, 2015 2:20 pm
Libera.chat IRC: Kirdow
Location: Sweden

Re: Meaty Skeleton undefined reference to _init

Post by Kirdow »

Actually it was just a typo somewhere, accidentally switched position of 2 letters. It's fixed now :)
User avatar
sortie
Member
Member
Posts: 931
Joined: Wed Mar 21, 2012 3:01 pm
Libera.chat IRC: sortie

Re: Meaty Skeleton undefined reference to _init

Post by sortie »

Be sure to just git checkout instead of copying. The tutorial tells you to do that to avoid situations like this.
Post Reply