Sure I'll elaborate on that. This patch was written to fix (and does fix) this 
issue in w64devkit.

https://github.com/skeeto/w64devkit/issues/395

It may not fix it for the right reasons.

 w64devkit builds two toolchains. One with --host of Linux, and --target of 
x86_64-w64-mingw32, and it then uses that gcc to cross-compile a gcc with host 
of x86_64-64-mingw32 and target of x86_64-w64-mingw32.

It's done in this dockerfile:
https://github.com/skeeto/w64devkit/blob/master/Dockerfile

The two relevant configure commands are:

```
COPY src/gcc-*.patch $PREFIX/src/
RUN cat $PREFIX/src/gcc-*.patch | patch -d/dl/gcc -p1 \
 && /dl/gcc/configure \
        --prefix=/bootstrap \
        --with-sysroot=/bootstrap \
        --target=$ARCH \
        --enable-static \
        --disable-shared \
        --with-pic \
        --enable-languages=c,c++,fortran \
        --enable-libgomp \
        --enable-threads=posix \
        --enable-tls \
        --enable-version-specific-runtime-libs \
        --disable-libstdcxx-verbose \
        --disable-dependency-tracking \
        --disable-nls \
        --disable-lto \
        --disable-multilib \
        CFLAGS_FOR_TARGET="-O2" \
        CXXFLAGS_FOR_TARGET="-O2" \
        LDFLAGS_FOR_TARGET="-s" \
        CFLAGS="-O2" \
        CXXFLAGS="-O2" \
        LDFLAGS="-s" \
 && make -j$(nproc) all-gcc \
 && make install-gcc
```
And
```
& /dl/gcc/configure \
        --prefix=$PREFIX \
        --with-sysroot=$PREFIX \
        --with-native-system-header-dir=/include \
        --target=$ARCH \
        --host=$ARCH \
        --enable-static \
        --disable-shared \
        --with-pic \
        --with-gmp=/deps \
        --with-mpc=/deps \
        --with-mpfr=/deps \
        --enable-languages=c,c++,fortran \
        --enable-libgomp \
        --enable-threads=posix \
        --enable-tls \
        --enable-version-specific-runtime-libs \
        --disable-libstdcxx-verbose \
        --disable-dependency-tracking \
        --disable-lto \
        --disable-multilib \
        --disable-nls \
        --disable-win32-registry \
        --enable-mingw-wildcard \
        CFLAGS_FOR_TARGET="-O2" \
        CXXFLAGS_FOR_TARGET="-O2" \
        LDFLAGS_FOR_TARGET="-s" \
        CFLAGS="-O2" \
        CXXFLAGS="-O2" \
        LDFLAGS="-s" \
       ```

--
https://forge.sourceware.org/gcc/gcc-TEST/pulls/172#issuecomment-6639

Reply via email to