Static MinGW-w64-GCC-15.2.0

#### Gaming Linux® From Scratch - Version 13.0

### Chapter 20. The MinGW-w64 Toolchain

- Prev

  MinGW-w64-Binutils-2.46

- Next

  MinGW-w64-13.0.0

- Up
- Home

# Static MinGW-w64-GCC-15.2.0

## Introduction to Static MinGW-w64-GCC

MinGW-w64-GCC provides GCC compilers for MinGW-w64, allowing users and applications to compile code targeting Windows. This will be done in steps to avoid the need for already present binaries. This is the static build, which will have limited support but will be able to compile software better for the MinGW-w64 targets.

### Note

This may take a while to build. Feel free to do something else while this is building.

- Download: https://ftpmirror.gnu.org/gnu/gcc/gcc-15.2.0/gcc-15.2.0.tar.xz

### Additional Downloads

- Required patch: https://www.linuxfromscratch.org/glfs/view/13.0/download/gcc/gcc-15.2.0-mingw_fixes-1.patch

### Static MinGW-w64-GCC Dependencies

Required
MinGW-w64-Binutils-2.46 and MinGW-w64-headers-13.0.0

## Installation of Static MinGW-w64-GCC

Fix a MinGW-w64 issue within libstdc++:

    patch -Np1 -i ../gcc-15.2.0-mingw_fixes-1.patch

### x86_64 Installation of Static MinGW-w64-GCC

Install x86_64 Static MinGW-w64-GCC by running the following commands:

    mkdir build-x86_64-mingw-w64-static &&
    cd    build-x86_64-mingw-w64-static &&

    ../configure --prefix=/usr               \
                 --target=x86_64-w64-mingw32 \
                 --disable-shared            \
                 --disable-multilib          \
                 --disable-threads           \
                 --enable-languages=c,c++ &&

    make all-gcc

Now, as the `root` user:

    make install-gcc && cd ..

### i686 Installation of Static MinGW-w64-GCC

Install i686 Static MinGW-w64-GCC by running the following commands:

    mkdir build-i686-mingw-w64-static &&
    cd    build-i686-mingw-w64-static &&

    ../configure --prefix=/usr             \
                 --target=i686-w64-mingw32 \
                 --disable-shared          \
                 --disable-multilib        \
                 --disable-threads         \
                 --enable-languages=c,c++ &&

    make all-gcc

Now, as the `root` user:

    make install-gcc

## Command Explanations

### Note

Run ../configure --help for a full list of options.

mkdir build; cd build: The GCC documentation recommends building the package in a dedicated build directory.

`--disable-shared`: This option disables building shared libraries. They will be built later.

`--disable-multilib`: This option ensures that files are created for the specific architecture of your computer.

`--disable-threads`: This option disables thread support due to building errors in GCC. This support will be built in later.

`--enable-languages=c,c++`: This command builds support for C and C++. Refer to https://www.linuxfromscratch.org/blfs/view/13.0-systemd/general/gcc.html to find what other languages are supported.

## Contents

There are no binaries specific to this package besides the format the compilers are targeting, and thus are prefixed with the architecture triplet, such as x86_64-w64-mingw32-gcc. For in-depth descriptions, read https://www.linuxfromscratch.org/lfs/view/13.0-systemd/chapter08/gcc.html#contents-gcc.

- Prev

  MinGW-w64-Binutils-2.46

- Next

  MinGW-w64-13.0.0

- Up
- Home