Skip to contentSkip to conversation

simple hello.asm (NASM) not compile in x64, plz help

DISCUSSION eric lin 3 participants 3 messages Nov 29, 2014 – Dec 24, 2014

lore
Share & tools
lore

eric lin

author
#0 lore raw

hello:
I copied a simple hello.asm (NASM) assembly program from www.tldp.org/HOWTO/html_single/Assembly-HOWTO/
try to compile and run on my linux 64(ubuntu14.04), but I got errors:

-------------------------------------

ld -s -o heworl heworl.o
ld:i386 architecture of input file *.o is incompatible with i386:x86-64 output
-------------------------------------------------
please help,(how to make it compile and run on my 64 platform rather than ask me switch to 32 bit platform),thanks a lot ina dvance, eric

_____________________________________________________________
Luxmail.com

#1 lore raw
Quoted 3 lines

ld -s -o heworl heworl.o
ld:i386 architecture of input file *.o is incompatible with i386:x86-64 output

You told nasm to create a 32-bit .o file. Tell nasm to create a 64-bit .o file instead. Use "-f elf64" instead of "-f elf32".

The command "nasm -hf" will display all the valid output formats that nasm supports.

b

#2 lore raw
In reply to eric lin

(Note: I originally sent this message on Nov. 29, but the server bounced it because my email client included some HTML. I'm trying again here. I apologize if this is a duplicate for you.)

If you’re interested in using the gnu programming environment, I have written an introductory textbook on the topic. You can get more information at http://bob.cs.sonoma.edu/. I sell it at lulu.com, but you can download a preview copy (first seven chapters) for free from my website. It’s specifically about the 64-bit platform.

--Bob Plantz

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of eric lin
Sent: Friday, November 28, 2014 8:36 PM
To: [email protected]
Subject: simple hello.asm (NASM) not compile in x64, plz help

hello:
I copied a simple hello.asm (NASM) assembly program from www.tldp.org/HOWTO/html_single/Assembly-HOWTO/ try to compile and run on my linux 64(ubuntu14.04), but I got errors:

-------------------------------------

ld -s -o heworl heworl.o
ld:i386 architecture of input file *.o is incompatible with i386:x86-64 output
-------------------------------------------------
please help,(how to make it compile and run on my 64 platform rather than ask me switch to 32 bit platform),thanks a lot ina dvance, eric

_____________________________________________________________
Luxmail.com
--
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html