On Mon, 4 Apr 2022, Christer Solskogen wrote:

On 04.04.2022 15:37, Martin Storsjö wrote:
On Mon, 4 Apr 2022, Christer Solskogen wrote:

I'm cross compiling mingw-w64-crt on Linux and sometimes compiling mingw-w64 (v10) fails when using a high(ish) number to make -j. -j8 sometimes fails, -j4 seems to work.

builder@champ:/tmp/build/mingw-w64-crt$ x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc

COLLECT_LTO_WRAPPER=/tmp/cross-mingw-w64/lib/gcc/x86_64-w64-mingw32/11.2.0/lto-wrapper

Target: x86_64-w64-mingw32
Configured with: /home/builder/gcc/configure --prefix=/tmp/cross-mingw-w64 --libexecdir=/tmp/cross-mingw-w64/lib --target=x86_64-w64-mingw32 --enable-languages=c,c++ --disable-libstdcxx-pch --enable-libgomp --enable-threads=posix --with-sysroot=/tmp/cross-mingw-w64 --with-checking=release --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.2.0 (GCC)

builder@champ:/tmp/build/mingw-w64-crt$ x86_64-w64-mingw32-ld -v
GNU ld (GNU Binutils) 2.38

Known problem, or something to file a bug for?

This sounds a lot like https://sourceware.org/bugzilla/show_bug.cgi?id=28885 - but that one wouldn't manifest if you're building the v10 release, only with older releases. (In latest mingw-w64, that bug would be masked by 0ad299826ca14987fd53664c1047f4dfe848c3f8.)

To have any clue about what it is, if it isn't this, you'd need to provide the build log, along with the command that failed and its output (which usually would be buried somewhere in the build log, if building with lots of parallel jobs).



x86_64-w64-mingw32-dlltool --as-flags=--32 -m i386 -k --as=x86_64-w64-mingw32-as --output-lib lib32/libd3dx9.a --temp-prefix $(basename lib32/libd3dx9.a .a) --input-def /home/builder/mingw-w64/mingw-w64-crt/lib32/d3dx9_43.def x86_64-w64-mingw32-dlltool: lib32/libd3dx9.a: error reading libd3dx9h.o: file truncated


As I have a workaround I'll wait until a newer binutils is released, and check if it happens there as well.

FWIW I tried to reproduce this, and it builds fine for me with binutils 2.38 when building mingw-w64 v10 on a system with a huge number of cores. When building v9, I do run into the bug in binutils 2.38 though. See the attached dockerfile; this builds binutils 2.38, GCC 11.2.0 and mingw-w64 v10.0.0, and it builds fine for me on a system with lots of cores.

// Martin
FROM ubuntu:18.04

RUN apt-get update -qq && apt-get install -qqy \
    git wget bzip2 file unzip zip build-essential m4 \
    vim git-svn subversion texinfo && \
    apt-get clean -y && \
    rm -rf /var/lib/apt/lists/*

RUN git config --global user.name "MinGW" && \
    git config --global user.email root@localhost

WORKDIR /build

ENV TOOLCHAIN_PREFIX=/opt/gcc-mingw

ENV GMP_VER=6.1.2
RUN wget http://ftp.funet.fi/pub/gnu/gnu/gmp/gmp-$GMP_VER.tar.bz2
RUN tar -jxvf gmp-$GMP_VER.tar.bz2 && \
    cd gmp-$GMP_VER && \
    ./configure --prefix=$TOOLCHAIN_PREFIX --disable-shared && \
    make -j$(nproc) && \
    make install
ENV MPFR_VER=4.0.2
RUN wget http://ftp.funet.fi/pub/gnu/gnu/mpfr/mpfr-$MPFR_VER.tar.bz2
RUN tar -jxvf mpfr-$MPFR_VER.tar.bz2 && \
    cd mpfr-$MPFR_VER && \
    ./configure --prefix=$TOOLCHAIN_PREFIX --with-gmp=$TOOLCHAIN_PREFIX 
--disable-shared && \
    make -j$(nproc) && \
    make install
ENV MPC_VER=1.1.0
RUN wget http://www.multiprecision.org/downloads/mpc-$MPC_VER.tar.gz
RUN tar -zxvf mpc-$MPC_VER.tar.gz && \
    cd mpc-$MPC_VER && \
    ./configure --prefix=$TOOLCHAIN_PREFIX --with-gmp=$TOOLCHAIN_PREFIX 
--disable-shared && \
    make -j$(nproc) && \
    make install
ENV BINUTILS_VER=2.38
ENV TARGET_TRIPLET=x86_64-w64-mingw32
RUN wget http://ftp.funet.fi/pub/gnu/gnu/binutils/binutils-$BINUTILS_VER.tar.bz2
RUN tar -jxvf binutils-$BINUTILS_VER.tar.bz2 && \
    cd binutils-$BINUTILS_VER && \
    mkdir build-x86_64 && \
    cd build-x86_64 && \
    ../configure --prefix=$TOOLCHAIN_PREFIX --target=$TARGET_TRIPLET 
--disable-werror --disable-multilib && \
    make -j$(nproc) && \
    make install-strip
ENV PATH=$TOOLCHAIN_PREFIX/bin:$PATH
ENV GCC_VER=11.2.0
ENV GCC_LANGUAGES="c,c++"
# --with-dwarf2 --disable-sjlj-exceptions
ENV GCC_OPTIONS="--enable-threads=posix"
RUN wget http://ftp.funet.fi/pub/gnu/gnu/gcc/gcc-$GCC_VER/gcc-$GCC_VER.tar.xz
# First build only the compiler from the gcc package
RUN tar -Jxvf gcc-$GCC_VER.tar.xz && \
    cd gcc-$GCC_VER && \
    mkdir build-x86_64 && \
    cd build-x86_64 && \
    ../configure --prefix=$TOOLCHAIN_PREFIX --target=$TARGET_TRIPLET 
--enable-languages=$GCC_LANGUAGES --disable-multilib 
--with-gmp=$TOOLCHAIN_PREFIX $GCC_OPTIONS && \
    make -j$(nproc) all-gcc && \
    make install-strip-gcc
# Then with the compiler, build the mingw-w64 runtime
ENV MINGW_VER=v10.0.0
RUN git clone git://git.code.sf.net/p/mingw-w64/mingw-w64 && \
    cd mingw-w64 && \
    git checkout $MINGW_VER
ENV DEFAULT_CRT="ucrt"
RUN cd mingw-w64/mingw-w64-headers && \
    mkdir build-x86_64 && \
    cd build-x86_64 && \
    ../configure --prefix=$TOOLCHAIN_PREFIX/$TARGET_TRIPLET 
--host=$TARGET_TRIPLET --with-default-msvcrt=$DEFAULT_CRT && \
    make install && \
    cd ../../mingw-w64-crt && \
    mkdir build-x86_64 && \
    cd build-x86_64 && \
    ../configure --prefix=$TOOLCHAIN_PREFIX/$TARGET_TRIPLET 
--host=$TARGET_TRIPLET --disable-lib32 --enable-lib64 
--with-default-msvcrt=$DEFAULT_CRT && \
    make -j$(nproc) && \
    make install && \
    cd ../../mingw-w64-libraries/winpthreads && \
    mkdir build-x86_64 && \
    cd build-x86_64 && \
    ../configure --prefix=$TOOLCHAIN_PREFIX/$TARGET_TRIPLET 
--host=$TARGET_TRIPLET && \
    make -j$(nproc) && \
    make install
# Then with the mingw-w64 runtime in place, build the runtime parts of gcc 
(libgcc/libstdc++) which needs the mingw-w64 headers and runtime.
RUN cd gcc-$GCC_VER/build-x86_64 && \
    make -j$(nproc) && \
    make install-strip
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to