Skip to content

Instantly share code, notes, and snippets.

@ngleb
Last active January 11, 2024 10:52
Show Gist options
  • Save ngleb/96efdfc79a7773ea2c3719a63aba58f0 to your computer and use it in GitHub Desktop.
Save ngleb/96efdfc79a7773ea2c3719a63aba58f0 to your computer and use it in GitHub Desktop.
Bulding MinGW toolchain on gentoo with crossdev and posix threads

Sources

crossdev

emerge -av crossdev

localrepo

mkdir -p /var/db/repos/localrepo-crossdev/{profiles,metadata}
echo "crossdev" > /var/db/repos/localrepo-crossdev/profiles/repo_name
echo 'masters = gentoo' > /var/db/repos/localrepo-crossdev/metadata/layout.conf
chown -R portage:portage /var/db/repos/localrepo-crossdev/

toolchain

Accept keywords:

/etc/portage/package.accept_keywords/mingw

cross-i686-w64-mingw32/mingw64-runtime ~amd64
cross-x86_64-w64-mingw32/mingw64-runtime ~amd64

Create toolchain:

crossdev -S x86_64-w64-mingw32
crossdev -S i686-w64-mingw32

enable posix threads & additional mingw64-runtime libraries

/etc/portage/env/mingw-gcc.conf:

EXTRA_ECONF="--enable-threads=posix"

Adjust USE flags:

/etc/portage/package.use/mingw

cross-i686-w64-mingw32/gcc -fortran -vtv -sanitize
cross-x86_64-w64-mingw32/gcc -fortran -vtv -sanitize

cross-i686-w64-mingw32/mingw64-runtime libraries
cross-x86_64-w64-mingw32/mingw64-runtime libraries

rebuild toolchain

emerge -1 cross-i686-w64-mingw32/mingw64-runtime cross-x86_64-w64-mingw32/mingw64-runtime
emerge -1 cross-i686-w64-mingw32/gcc cross-x86_64-w64-mingw32/gcc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment