title: Building GCC cross compiler (from "Linux" to "Windows")
body: <p>I want to build "gcc cross-compiler" to compile "c/c++" applications on "Linux" environment but for "Windows" target.</p>
  
  <p>I have made this so far:</p>
  
  <ol>
  <li><p>Installed the necessary tools and packages for building GCC listed on "<a href="http://gcc.gnu.org/install/prerequisites.html" rel="noreferrer">Prerequisites for GCC</a>" page.</p></li>
  <li><p>Downloaded required sources:<br>
  "<a href="http://ftp.gnu.org/gnu/gcc/gcc-4.4.1/gcc-core-4.4.1.tar.bz2" rel="noreferrer">gcc-core-4.4.1</a>", "<a href="http://ftp.gnu.org/gnu/gcc/gcc-4.4.1/gcc-g++-4.4.1.tar.bz2" rel="noreferrer">gcc-g++-4.4.1</a>", "<a href="http://ftp.gnu.org/gnu/binutils/binutils-2.19.1.tar.bz2" rel="noreferrer">binutils-2.19.1</a>", "<a href="http://sourceforge.net/projects/mingw/files/MinGW%20API%20for%20MS-Windows/Current%20Release_%20w32api-3.13/w32api-3.13-mingw32-src.tar.gz/download" rel="noreferrer">w32api-3.13-mingw32</a>", "<a href="http://sourceforge.net/projects/mingw/files/MinGW%20Runtime/mingwrt-3.16/mingwrt-3.16-mingw32-src.tar.gz/download" rel="noreferrer">mingwrt-3.16-mingw32</a>"</p></li>
  <li><p>Created this directory hierarchy:<br>
  "${HOME}/gcc/" - for final cross-compiler<br>
  "${HOME}/src/" - for sources<br>
  "${HOME}/src/build-binutils/i386-mingw32/" - for building binutils to "i386-mingw32" target<br>
  "${HOME}/src/build-gcc/i386-mingw32/" - for building gcc to "i386-mingw32" target</p></li>
  <li><p>Builded binutils package:</p>
  
  <p>cd "${HOME}/src/build-binutils/i386-mingw32/"<br>
  ../../binutils-2.19.1/configure --prefix="${HOME}/gcc" --target=i386-mingw32 --disable-nls<br>
  make<br>
  make install</p></li>
  <li><p>Copied "w32api" and "mingwrt" headers to the install directory:</p>
  
  <p>cp -R "${HOME}/src/w32api-3.13-mingw32/include" "${HOME}/gcc/i386-mingw32"<br>
  cp -R "${HOME}/src/mingwrt-3.16-mingw32/include" "${HOME}/gcc/i386-mingw32"</p></li>
  </ol>
  
  <p><br>
  And now when I am trying to build the "c (only) cross-compiler":</p>
  
  <pre><code>cd "${HOME}/src/build-gcc/i386-mingw32/"
  ../../gcc-4.4.1/configure --prefix="${HOME}/gcc" --target=i386-mingw32 --enable-languages=c --with-headers="${HOME}/gcc/i386-mingw32/include" --disable-nls
  make&lt;br&gt;
  </code></pre>
  
  <p>it was building something about 4 minutes and then gives me these errors:</p>
  
  <pre><code>${HOME}/gcc/i386-mingw32/bin/ld: dllcrt2.o: No such file: No such file or directory
  collect2: ld returned 1 exit status
  make[2]: *** [libgcc_s.dll] Error 1
  make[2]: Leaving directory `${HOME}/src/build-gcc/i386-mingw32/i386-mingw32/libgcc'
  make[1]: *** [all-target-libgcc] Error 2
  make[1]: Leaving directory `${HOME}/src/build-gcc/i386-mingw32'
  make: *** [all] Error 2
  </code></pre>
  
  <p>From that error message I really don't know what to do now :-((( .</p>
  
  <p><br>
  Does anybody know where is the problem?<br>
  Thanks.</p>