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

Programming, for all ages and all languages.
Post Reply
sirbounce
Posts: 3
Joined: Tue Apr 04, 2017 10:05 am

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

Post 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.
Last edited by sirbounce on Tue Apr 04, 2017 1:22 pm, edited 1 time in total.
User avatar
Octacone
Member
Member
Posts: 1138
Joined: Fri Aug 07, 2015 6:13 am

Re: GCC suddenly can't find kernel.o

Post 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 \
OS: Basic OS
About: 32 Bit Monolithic Kernel Written in C++ and Assembly, Custom FAT 32 Bootloader
sirbounce
Posts: 3
Joined: Tue Apr 04, 2017 10:05 am

Re: GCC suddenly can't find kernel.o

Post 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
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: GCC suddenly can't find kernel.o

Post 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.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
User avatar
Velko
Member
Member
Posts: 153
Joined: Fri Oct 03, 2008 4:13 am
Location: Ogre, Latvia, EU

Re: GCC suddenly can't find kernel.o

Post 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).
If something looks overcomplicated, most likely it is.
sirbounce
Posts: 3
Joined: Tue Apr 04, 2017 10:05 am

Re: GCC suddenly can't find kernel.o

Post 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
Post Reply