title: compile 32bit code from cygwin64
body: <p>I installed Cygwin64 on a win7-64 with gcc dev tools and I just noticed that it produces 64bit binaries. (Well, not that surprising :o) Is there a mean to make it producing some 32bit binaries?</p>
  
  <p>I am compiling the socat tool for windows, compiled in 64bit it is working, but I am trying to make another version suitable for an XP-32.</p>
  
  <p>The <code>configure</code> script does not seem to support a <code>-b 32</code> switch (that I must have seen for ming64 from <a href="http://math-atlas.sourceforge.net/atlas_install/node57.html" rel="noreferrer">this thread</a>, and if I try to specify the <code>-m32</code> switch in <code>CFLAGS</code> for <code>configure</code> it fails:</p>
  
  <pre><code>$ CFLAGS=-m32 ./configure
  checking which defines needed for makedepend...
  checking for a BSD-compatible install... /usr/bin/install -c
  checking for gcc... gcc
  checking whether the C compiler works... no
  configure: error: in `/cygdrive/c/dev/tools/nettools/socat/socat-2.0.0-b8':
  configure: error: C compiler cannot create executables
  See `config.log' for more details
  </code></pre>
  
  <p>Would the option be to also install Cygwin32, or can I compile 32bit code with another setting or additional cygwin package?</p>
  
  <p><strong>Edit:</strong>
  I have found that my cygwin64/gcc cannot compile a simple <code>hello.c</code> program in 32bits:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main (int argc, char *argv[]){
      printf("Hello, world!\n");
      return 0;
  }
  </code></pre>
  
  <p>with a <code>gcc -o hello.exe hello.c</code> it works flawlessly, but <code>gcc -o hello.exe hello.c -m32</code> spits</p>
  
  <pre><code>/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc_s.dll.a when searching for -lgcc_s
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc_s.dll.a when searching for -lgcc_s
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc_s.dll.a when searching for -lgcc_s
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc_s.dll.a when searching for -lgcc_s
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc_s
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc.a when searching for -lgcc
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc.a when searching for -lgcc
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc.a when searching for -lgcc
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc.a when searching for -lgcc
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc.a when searching for -lgcc
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc.a when searching for -lgcc
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../libcygwin.a when searching for -lcygwin
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../libcygwin.a when searching for -lcygwin
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../libcygwin.a when searching for -lcygwin
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lcygwin
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -ladvapi32
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lshell32
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -luser32
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lkernel32
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc_s.dll.a when searching for -lgcc_s
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc_s.dll.a when searching for -lgcc_s
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc_s.dll.a when searching for -lgcc_s
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc_s.dll.a when searching for -lgcc_s
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc_s
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc.a when searching for -lgcc
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc.a when searching for -lgcc
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc.a when searching for -lgcc
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc.a when searching for -lgcc
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2//libgcc.a when searching for -lgcc
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/libgcc.a when searching for -lgcc
  /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lgcc
  collect2: error: ld returned 1 exit status
  </code></pre>