title: How to build a cross compile NetBSD toolchain using NetBSD
body: <p>I have a NetBSD VM that I created using qemu, and I am trying to compile a simple <code>Hello World.c</code> program with the cross compiled toolchain that I built using the <code>build.sh</code> script that comes with the NetBSD source.  However, I can not get the program to compile.</p>
  
  <p>I built the toolchain with the following commands,</p>
  
  <p><code>./build.sh -m evbarm tools</code></p>
  
  <p><code>./build.sh -m evbarm -U distribution</code></p>
  
  <p>And the output from the above commands yields,</p>
  
  <pre><code>===&gt; Tools built to /opt/cross/evbarm/usr/src/tooldir.NetBSD-4.0.1-i386
  ===&gt; build.sh ended:   Sat Nov 28 12:52:34 CST 2015
  ===&gt; Summary of results:
           build.sh command: ./build.sh -m evbarm tools
           build.sh started: Sat Nov 28 12:48:47 CST 2015
           NetBSD version:   4.0
           MACHINE:          evbarm
           MACHINE_ARCH:     arm
           Build platform:   NetBSD 4.0.1 i386
           HOST_SH:          /bin/sh
           No nonexistent/bin/nbmake, needs building.
           Bootstrapping nbmake
           TOOLDIR path:     /opt/cross/evbarm/usr/src/tooldir.NetBSD-4.0.1-i386
           DESTDIR path:     /opt/cross/evbarm/usr/src/destdir.evbarm
           RELEASEDIR path:  /opt/cross/evbarm/usr/src/releasedir
           Created /opt/cross/evbarm/usr/src/tooldir.NetBSD-4.0.1-i386/bin/nbmake
           makewrapper:      /opt/cross/evbarm/usr/src/tooldir.NetBSD-4.0.1-i386/bin/nbmake-evbarm
           Updated /opt/cross/evbarm/usr/src/tooldir.NetBSD-4.0.1-i386/bin/nbmake-evbarm
           Tools built to /opt/cross/evbarm/usr/src/tooldir.NetBSD-4.0.1-i386
           build.sh ended:   Sat Nov 28 12:52:34 CST 2015
  ===&gt; .
  
  
  make distribution started at:  Sat Nov 28 14:31:23 CST 2015
  make distribution finished at: Sat Nov 28 15:04:34 CST 2015
  ===&gt; Successful make distribution
  ===&gt; build.sh ended:   Sat Nov 28 15:04:34 CST 2015
  ===&gt; Summary of results:
           build.sh command: ./build.sh -m evbarm -U distribution
           build.sh started: Sat Nov 28 14:31:20 CST 2015
           NetBSD version:   4.0
           MACHINE:          evbarm
           MACHINE_ARCH:     arm
           Build platform:   NetBSD 4.0.1 i386
           HOST_SH:          /bin/sh
           No nonexistent/bin/nbmake, needs building.
           Bootstrapping nbmake
           TOOLDIR path:     /opt/cross/evbarm/usr/src/tooldir.NetBSD-4.0.1-i386
           DESTDIR path:     /opt/cross/evbarm/usr/src/destdir.evbarm
           RELEASEDIR path:  /opt/cross/evbarm/usr/src/releasedir
           Created /opt/cross/evbarm/usr/src/tooldir.NetBSD-4.0.1-i386/bin/nbmake
           makewrapper:      /opt/cross/evbarm/usr/src/tooldir.NetBSD-4.0.1-i386/bin/nbmake-evbarm
           Updated /opt/cross/evbarm/usr/src/tooldir.NetBSD-4.0.1-i386/bin/nbmake-evbarm
           Successful make distribution
           build.sh ended:   Sat Nov 28 15:04:34 CST 2015
  ===&gt; .
  </code></pre>
  
  <p>However, when I try to compile <code>helloARM.c</code> using the <code>nbmake-evbarm</code> wrapper I get the following output,</p>
  
  <pre><code>$ nbmake-evbarm ./helloARM
  /opt/cross/evbarm/usr/src/tooldir.NetBSD-4.0.1-i386/bin/arm--netbsdelf-gcc -O2   -Werror    -nostdinc -isystem /opt/cross/evbarm/usr/src/destdir.evbarm/usr/include    -o ./helloARM ./helloARM.c 
  /opt/cross/evbarm/usr/src/tooldir.NetBSD-4.0.1-i386/lib/gcc/arm--netbsdelf/4.1.2/../../../../arm--netbsdelf/bin/ld: crt0.o: No such file: No such file or directory
  collect2: ld returned 1 exit status
  
  *** Failed target:  ./helloARM
  *** Failed command: /opt/cross/evbarm/usr/src/tooldir.NetBSD-4.0.1-i386/bin/arm--netbsdelf-gcc -O2 -Werror -nostdinc -isystem /opt/cross/evbarm/usr/src/destdir.evbarm/usr/include -o ./helloARM ./helloARM.c 
  *** Error code 1
  
  Stop.
  nbmake: stopped in /home/capin/apps
  </code></pre>