ld:i386 architecture of input file is incompatible with i386
Posted: Tue Jun 01, 2010 10:03 pm
Whole error and offending command:
'start.o' is a standard elf32 object file compiled with Fasm 1.69.14 and 'main.o' was compiled with gcc with "-c -ffreestanding" flags. I'm running Fedora Core 13, gcc ver 4.4.4 if it matters.
I'm not sure the whole thing is relevant, but my makefile is simple so I'll post to save you from asking later if you think it will help.
main makefile:
init makefile:
It's by no means perfect. I'm trying to get a good setup for maintaining my project, I'm going to restart my OS after I get my makefiles planned out.
Code: Select all
ld --oformat=elf32-i386 main.o start.o -o init.o
ld: i386 architecture of input file `main.o' is incompatible with i386:x86-64 output
ld: i386 architecture of input file `start.o' is incompatible with i386:x86-64 output
I'm not sure the whole thing is relevant, but my makefile is simple so I'll post to save you from asking later if you think it will help.
main makefile:
Code: Select all
AS=fasm
ASFLAGS=
CC=gcc
CFLAGS=-c -ffreestanding
CPP=gcc
CPPFLAGS=
LDFLAGS=-nostdlib --oformat=elf32-i386
all : Image
Image : init/init.o
ld --script link.ld init/init.o
init/init.o :
(cd init; make)
clean :
(cd init; make clean)
Code: Select all
AS=fasm
ASFLAGS=
CC=gcc
CFLAGS=-ffreestanding -Wl,--oformat=elf32-i386
CPP=gcc
CPPFLAGS=
LDFLAGS=--oformat=elf32-i386
all : init.o
init.o : main.o start.o
ld $(LDFLAGS) main.o start.o -o init.o
main.o : main.c
$(CC) $(CFLAGS) main.c
start.o : start.asm
$(AS) $(ASFLAGS) start.asm start.o
clean :
rm init.o main.o start.o