OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 6:23 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: i386:x86-64 architecture of input file `kernel.o' is error
PostPosted: Sat Apr 09, 2022 6:53 am 
Offline

Joined: Fri Apr 01, 2022 10:06 am
Posts: 23
Location: Türkiye, Uşak/Merkez
i386:x86-64 architecture of input file `kernel.o' is incompatible with i386 output It gives the error, what is the solution, I will post the screenshot and the c++ code.


Code:
void printf(char* str)
{

    unsigned short* VideoMemory = (unsigned short*)0xb8000;

    for(int i = 0; str[i] != '\0'; ++i)
    VideoMemory[i] = (VideoMemory[i] & 0xFF00) | str[i];

}


void kernelMain(void* multiboot_structure, unsigned int magicnumber)
{
    printf("Kapiler İsletim Sistemi");

    while(1);

}


Attachments:
İ386 Hata.png
İ386 Hata.png [ 12.54 KiB | Viewed 1637 times ]

_________________
M. Alp
Top
 Profile  
 
 Post subject: Re: i386:x86-64 architecture of input file `kernel.o' is err
PostPosted: Sat Apr 09, 2022 7:51 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
Seems pretty self-explanatory.

You are trying to link a 64-bit object file into a 32-bit executable. Not possible.

Presumably you compiled your source with a 64-bit compiler. You either need to tell it to produce 32-bit code or (much better) use a 32-bit cross compiler.


Top
 Profile  
 
 Post subject: Re: i386:x86-64 architecture of input file `kernel.o' is err
PostPosted: Sat Apr 09, 2022 8:46 am 
Offline

Joined: Fri Apr 01, 2022 10:06 am
Posts: 23
Location: Türkiye, Uşak/Merkez
iansjack wrote:
Seems pretty self-explanatory.

You are trying to link a 64-bit object file into a 32-bit executable. Not possible.

Presumably you compiled your source with a 64-bit compiler. You either need to tell it to produce 32-bit code or (much better) use a 32-bit cross compiler.


X32 I am using a compiler.

_________________
M. Alp


Top
 Profile  
 
 Post subject: Re: i386:x86-64 architecture of input file `kernel.o' is err
PostPosted: Sat Apr 09, 2022 8:52 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
You are using a 64-bit compiler (or assembler) to produce kernel.o.


Top
 Profile  
 
 Post subject: Re: i386:x86-64 architecture of input file `kernel.o' is err
PostPosted: Sat Apr 09, 2022 12:51 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
Mehmetdev1 wrote:
X32

Are you talking about the x32 ABI? That's still 64-bit. You need 32-bit.

Ideally, you should use a cross-compiler. I would also suggest working on some easier projects first so you can learn the basics.


Top
 Profile  
 
 Post subject: Re: i386:x86-64 architecture of input file `kernel.o' is err
PostPosted: Sat Apr 09, 2022 2:20 pm 
Offline
Member
Member

Joined: Sun Jun 23, 2019 5:36 pm
Posts: 618
Location: North Dakota, United States
I feel like this is becoming a trend -- people think that you can just use a hosted compiler to build an OS. I'm kinda curious why people repeatedly assume this, particularly since it causes so, so many problems and is so painful.


Top
 Profile  
 
 Post subject: Re: i386:x86-64 architecture of input file `kernel.o' is err
PostPosted: Sat Apr 09, 2022 2:38 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
It's because of all the tutorials that use a hosted compiler.

This code is also from a tutorial. I'm not sure which one, but based on the typos, I'd guess a video.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: SemrushBot [Bot] and 28 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group