title: Issue with Linking a 32-bit NASM file on a 64-bit machine
body: <p>So I'm learning x86 NASM assembly, and I'm making my first little program.</p>
  
  <p>The NASM code is</p>
  
  <pre><code>extern printf
  
  segment .data
  
  prompt1 db  "Hello World!", 0   ; Null-terminated
  
  segment .text
  
  global main
  
  main:
    pushad
  
    push dword    prompt1
    call          printf
    add           esp, 4
    popad
    ret
  </code></pre>
  
  <p>I then do <code>nasm -f elf32 HelloWorld.asm</code>, which creates a HelloWorld.o file.  Then I do <code>gcc -m32 HelloWorld.o -o HelloWorld</code>.</p>
  
  <p>This returns an error: </p>
  
  <pre><code>/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc.a when searching for -lgcc
  /usr/bin/ld: cannot find -lgcc
  /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.8/libgcc_s.so when searching for -lgcc_s
  /usr/bin/ld: cannot find -lgcc_s
  </code></pre>
  
  <p>collect2: error: ld returned 1 exit status</p>
  
  <p>The use of <code>-m32</code> and <code>elf32</code> was on the advice of various other StackOverflow threads.  I've tried installing stuff like the i386 GCC and G++ libraries (which fixed issues where it was saying the architecture was wrong).</p>
  
  <p>As the title says, this is 32-bit assembly but my laptop is 64-bit.</p>
  
  <p>Thanks in advance.</p>