From 4a51190b600604df9d845d6997fe2f330c73458e Mon Sep 17 00:00:00 2001 From: Aitor Guevara <428243+aitorciki@users.noreply.github.com> Date: Thu, 16 Nov 2023 12:53:29 +0100 Subject: [PATCH] Update MinGW-w64 instructions for Windows cross-compilation (#8469) Fix outdated environment variables when setting up MinGW-w64 paths. Also add a note to mind different host/target architectures (common pitfall when compiling from e.g. Apple silicon). Co-authored-by: Hugo Locurcio --- .../compiling/compiling_for_windows.rst | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/contributing/development/compiling/compiling_for_windows.rst b/contributing/development/compiling/compiling_for_windows.rst index 6df134c56..5e7bfbfe4 100644 --- a/contributing/development/compiling/compiling_for_windows.rst +++ b/contributing/development/compiling/compiling_for_windows.rst @@ -221,18 +221,26 @@ the following binaries in your ``PATH`` environment variable:: x86_64-w64-mingw32-gcc If the binaries are not located in the ``PATH`` (e.g. ``/usr/bin``), -you can define the following environment variables to give a hint to +you can define the following environment variable to give a hint to the build system:: - export MINGW32_PREFIX="/path/to/i686-w64-mingw32-" - export MINGW64_PREFIX="/path/to/x86_64-w64-mingw32-" + export MINGW_PREFIX="/path/to/mingw" + +Where ``/path/to/mingw`` is the path containing the ``bin`` directory where +``i686-w64-mingw32-gcc`` and ``x86_64-w64-mingw32-gcc`` are located (e.g. +``/opt/mingw-w64`` if the binaries are located in ``/opt/mingw-w64/bin``). To make sure you are doing things correctly, executing the following in the shell should result in a working compiler (the version output may differ based on your system):: - ${MINGW32_PREFIX}gcc --version - # i686-w64-mingw32-gcc (GCC) 6.1.0 20160427 (Mageia MinGW 6.1.0-1.mga6) + ${MINGW_PREFIX}/bin/x86_64-w64-mingw32-gcc --version + # x86_64-w64-mingw32-gcc (GCC) 13.2.0 + +.. note:: When cross-compiling for Windows using MinGW-w64, keep in mind only + ``x86_64`` and ``x86_32`` architectures are supported. Be sure to + specify the right ``arch=`` option when invoking SCons if building + from a different architecture. Troubleshooting ~~~~~~~~~~~~~~~