Page 1 of 1
i386:x86-64 architecture of input file `kernel.o' is error
Posted: Sat Apr 09, 2022 6:53 am
by Mehmetdev1
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: Select all
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);
}
Re: i386:x86-64 architecture of input file `kernel.o' is err
Posted: Sat Apr 09, 2022 7:51 am
by iansjack
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.
Re: i386:x86-64 architecture of input file `kernel.o' is err
Posted: Sat Apr 09, 2022 8:46 am
by Mehmetdev1
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.
Re: i386:x86-64 architecture of input file `kernel.o' is err
Posted: Sat Apr 09, 2022 8:52 am
by iansjack
You are using a 64-bit compiler (or assembler) to produce kernel.o.
Re: i386:x86-64 architecture of input file `kernel.o' is err
Posted: Sat Apr 09, 2022 12:51 pm
by Octocontrabass
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.
Re: i386:x86-64 architecture of input file `kernel.o' is err
Posted: Sat Apr 09, 2022 2:20 pm
by Ethin
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.
Re: i386:x86-64 architecture of input file `kernel.o' is err
Posted: Sat Apr 09, 2022 2:38 pm
by Octocontrabass
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.