[SOLVED] Nasm problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
LorenzoR
Posts: 3
Joined: Sat May 16, 2009 2:48 pm

[SOLVED] Nasm problem

Post 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.
Last edited by LorenzoR on Sat Oct 24, 2009 2:47 am, edited 1 time in total.
User avatar
NickJohnson
Member
Member
Posts: 1249
Joined: Tue Mar 24, 2009 8:11 pm
Location: Sunnyvale, California

Re: Nasm problem

Post 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.
LorenzoR
Posts: 3
Joined: Sat May 16, 2009 2:48 pm

Re: Nasm problem

Post by LorenzoR »

Thanks, that worked.
Post Reply