Page 1 of 1

[SOLVED] Nasm problem

Posted: Sat May 16, 2009 3:06 pm
by LorenzoR
When I try to compile this:

Code: Select all

nasm -f aout kstart.asm -o kstart.o
nasm -f aout libasm.asm -o libasm.o
gcc -c kernel.c -o kernel.o
gcc -c libc.c  -o libc.o
ld -T link.ld -o kernel.bin kernel.o kstart.o libc.o libasm.o
I get the following error:

Code: Select all

kstart.o: file not recognized: File format is ambiguous
kstart.o: matching formats: a.out-i386 a.out-i386-bsd a.out-i386-lynx a.out-m88k-mach3 a.out-pc532-mach a.out-pdp11 a.out-vax-bsd vms-vax vms-vax
I can compile it at school with gcc-4.2.4 but not in my house with gcc-4.3.3.

Re: Nasm problem

Posted: Sat May 16, 2009 4:31 pm
by NickJohnson
You should really be making everything ELF instead of a.out, which is barely supported by anything anymore. The stuff compiled by gcc is probably ELF, and therefore things cannot be linked together. Use the -felf flags with nasm instead of -faout.

Re: Nasm problem

Posted: Sat May 16, 2009 4:35 pm
by LorenzoR
Thanks, that worked.