Cross compiling

In Arch-Linux if you want to cross compile Rust programs for Windows 32-bit you need to install mingw-w64-gcc package from AUR.

Unfortunately, it is configured to build sjlj exception handling for i686 build and seh version for x86_64 build. Rust requires dwarf2 exception handling for i686 gcc.

To fix it, you can edit the PKGBUILD script and replace build function with:

build() {
  for _target in ${_targets}; do
    mkdir -p "$srcdir"/gcc-build-${_target} && cd "$srcdir"/gcc-build-${_target}

    case "${_target}" in
      i686-w64-mingw32)
        "$srcdir"/gcc/configure --prefix=/usr --libexecdir=/usr/lib \
          --target=${_target} \
          --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada \
          --enable-shared --enable-static \
          --enable-threads=posix --enable-fully-dynamic-string --enable-libstdcxx-time=yes \
          --with-system-zlib --enable-cloog-backend=isl \
          --enable-lto --disable-sjlj-exceptions --with-dwarf2 --enable-libgomp \
          --disable-multilib --enable-checking=release
      ;;
      x86_64-w64-mingw32)
        "$srcdir"/gcc/configure --prefix=/usr --libexecdir=/usr/lib \
          --target=${_target} \
          --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada \
          --enable-shared --enable-static \
          --enable-threads=posix --enable-fully-dynamic-string --enable-libstdcxx-time=yes \
          --with-system-zlib --enable-cloog-backend=isl \
          --enable-lto --disable-dw2-exceptions --enable-libgomp \
          --disable-multilib --enable-checking=release
      ;;
    esac
    make all
  done
}

The only change is: replaced "--disable-dw2-exceptions" with "--disable-sjlj-exceptions --with-dwarf2" for i686-w64-mingw32 target.