Search code examples
windowsgcccompiler-errorsmingw-w64msys2

How to Compile mingw-w64-crt


I'm on Windows 10 and using the latest version of MSYS2 (with gcc installed: pacman -S gcc)

I'm trying to compile mingw-w64-headers and mingw-w64-crt from mingw-w64-v7.0.0

Inside of my MSYS2 installation directory C:\msys2 I have created the folder mingw-w64 which I reference in the prefix argument below.

To compile each of these I use the same steps (replace name of library where appropriate):

mkdir mingw-w64-crt && cd mingw-w64-crt
../mingw-w64-v7.0.0/mingw-w64-crt/configure --prefix=/mingw-w64
make
make install

This works for mingw-w64-headers however for mingw-w64-crt I encounter errors at the make step. Specifically: incompatible types when assigning to type 'mbstate_t' {aka 'struct anonymous'} from type 'int'. A more detailed error image can be found here.

I would appreciate some guidance as to how to proceed.


Solution

  • Performing the following has allowed me to successfully compile:

    pacman -S $MINGW_PACKAGE_PREFIX-toolchain
    mkdir mingw-w64-crt && cd mingw-w64-crt
    ../mingw-w64-v7.0.0/mingw-w64-crt/configure --prefix=/mingw-w64 --with-sysroot=/mingw64
    make -j %NUMBER_OF_PROCESSORS%
    make install