Page 1 of 1

[SOLVED] GCC suddenly can't find kernel.o

Posted: Tue Apr 04, 2017 11:00 am
by sirbounce
Hello,
I followed the video tutorial from the wiki on how to build the GCC cross compiler with cygwin on Windows and I used the Meaty Skeleton page to structure the folders, so basically I have the same structure as on the wiki page.
Everything worked fine, I modified the Hello world program and added some stuff like color changing and automatic scroll down, added %d and hex support to printf and stuff like that.

Then I started following the GDT and IDT section of the James Molloy tutorial and I created a VS solution so I can use a decent editor (was using np++) and for a while it compiled fine but I must have messed something up along the way because now GCC says it can't find kernel/kernel.o:
Screenshot
Even though kernel.o is there and it is being generated because when i run build.sh the file is recreated when i delete it.
Obviously I had to modify the ASM files to work with GCC and it seems that I fixed all the errors.

I tried messing with the Makefile but if i try to change the path there, make will output that there are missing rules to make the object (or something like that, it's translated).

My Makefile right now is exactly the same as the one on the wiki, I didn't even change the "myos" name anywhere. And before I started adding the new files from the James Molloy tutorial the kernel compiled fine, maybe I creating a VS solution did some damage?
I tried excluding the new files from the build (see below) as the GDT part was not even implemented in the kernel yet but it still throws that error.

Also, to make new C files work i have to manually add them to the makefile.conf file like that:
KERNEL_ARCH_OBJS=\
$(ARCHDIR)/boot.o \
$(ARCHDIR)/tty.o \
$(ARCHDIR)/common.o \
$(ARCHDIR)/gdt.o \
$(ARCHDIR)/interrupt.o \
$(ARCHDIR)/isr.o \
$(ARCHDIR)/descriptor_tables.o \

Is this the right way to do that?

Is there something more I need to provide? I can't figure out what caused this problem.
Thanks.

Re: GCC suddenly can't find kernel.o

Posted: Tue Apr 04, 2017 12:14 pm
by Octacone
=D> :wink:
sirbounce wrote: KERNEL_ARCH_OBJS=\
$(ARCHDIR)/boot.o \
$(ARCHDIR)/kernel.o \ //Where is this?
$(ARCHDIR)/tty.o \
$(ARCHDIR)/common.o \
$(ARCHDIR)/gdt.o \
$(ARCHDIR)/interrupt.o \
$(ARCHDIR)/isr.o \
$(ARCHDIR)/descriptor_tables.o \

Re: GCC suddenly can't find kernel.o

Posted: Tue Apr 04, 2017 12:24 pm
by sirbounce
octacone wrote:=D> :wink:
sirbounce wrote: $(ARCHDIR)/kernel.o \ //Where is this?
kernel.o gets added later in the Makefile, that list is from arch/i386/make.conf, while in the root Makefile it looks like this:

Code: Select all

KERNEL_OBJS=\
$(KERNEL_ARCH_OBJS) \
kernel/kernel.o \
So yeah it is there

Re: GCC suddenly can't find kernel.o

Posted: Tue Apr 04, 2017 1:02 pm
by Schol-R-LEA
sirbounce wrote:Hello,
I followed the video tutorial from the wiki on how to build the GCC cross compiler with cygwin on Windows
The what?

checks the page

Huh. I never noticed that there.

Re: GCC suddenly can't find kernel.o

Posted: Tue Apr 04, 2017 1:03 pm
by Velko
In your screenshot there's a backslash (\) character before kernel/kernel.o

I think linker searches for a file named ' kernel/kernel.o' (note the space character).

Re: GCC suddenly can't find kernel.o

Posted: Tue Apr 04, 2017 1:22 pm
by sirbounce
Velko wrote:In your screenshot there's a backslash (\) character before kernel/kernel.o

I think linker searches for a file named ' kernel/kernel.o' (note the space character).
Wow, that was it #-o
I fixed it by removing the last backslash in the KERNEL_ARCH_OBJS list.
Thank you so much!
Schol-R-LEA wrote:
sirbounce wrote:Hello,
I followed the video tutorial from the wiki on how to build the GCC cross compiler with cygwin on Windows
The what?

checks the page

Huh. I never noticed that there.
Yeah it took me some time to notice that too