diff --git a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java index 1b9c3c7ef6c..171fa9077a7 100644 --- a/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java +++ b/build/org.eclipse.cdt.build.gcc.core/src/org/eclipse/cdt/build/gcc/core/internal/Msys2ToolChainProvider.java @@ -82,7 +82,7 @@ public class Msys2ToolChainProvider implements IToolChainProvider { String installLocation = registry.getCurrentUserValue(key, "InstallLocation"); //$NON-NLS-1$ Path msysPath = Paths.get(installLocation); boolean found = false; - for (String variant : List.of("mingw64", "ucrt64")) { //$NON-NLS-1$ //$NON-NLS-2$ + for (String variant : List.of("ucrt64", "mingw64")) { //$NON-NLS-1$ //$NON-NLS-2$ Path gccPath = msysPath.resolve(variant + "\\bin\\gcc.exe"); //$NON-NLS-1$ if (Files.exists(gccPath)) { IEnvironmentVariable[] vars = createEnvironmentVariables(msysPath, gccPath.getParent()); diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/MinGW.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/MinGW.java index 3043799dbfa..674c245e503 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/MinGW.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/MinGW.java @@ -42,7 +42,8 @@ public class MinGW { public static final String ENV_MSYS_HOME = "MSYS_HOME"; //$NON-NLS-1$ private static final String ENV_PATH = "PATH"; //$NON-NLS-1$ private static final Set MSYS2_64BIT_NAMES = Set.of("MSYS2", "MSYS2 64bit"); //$NON-NLS-1$ //$NON-NLS-2$ - private static final List MSYS2_MINGW_SUBSYSTEMS = List.of("mingw64", "mingw32", "ucrt64"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + private static final List MSYS2_MINGW_SUBSYSTEMS = List.of("ucrt64", "mingw64", "mingw32"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + private static final List MSYS2_MINGW_SUBSYSTEM_SELECTION_TOOLS = List.of("clangd", "clang", "gcc"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ private static final boolean isWindowsPlatform = Platform.getOS().equals(Platform.OS_WIN32); @@ -109,9 +110,14 @@ public class MinGW { String installLocation = registry.getCurrentUserValue(compKey, "InstallLocation"); //$NON-NLS-1$ for (String subsys : MSYS2_MINGW_SUBSYSTEMS) { String mingwLocation = installLocation + "\\" + subsys; //$NON-NLS-1$ - File gccFile = new File(mingwLocation + "\\bin\\gcc.exe"); //$NON-NLS-1$ - if (gccFile.canExecute()) { - rootValue = mingwLocation; + for (String toolName : MSYS2_MINGW_SUBSYSTEM_SELECTION_TOOLS) { + File toolFile = new File(mingwLocation + "\\bin\\" + toolName + ".exe"); //$NON-NLS-1$ //$NON-NLS-2$ + if (toolFile.canExecute()) { + rootValue = mingwLocation; + break; + } + } + if (null != rootValue) { break; } } diff --git a/doc/org.eclipse.cdt.doc.user/concepts/cdt_c_before_you_begin.htm b/doc/org.eclipse.cdt.doc.user/concepts/cdt_c_before_you_begin.htm index 3b1af1a978e..c354bf699f2 100644 --- a/doc/org.eclipse.cdt.doc.user/concepts/cdt_c_before_you_begin.htm +++ b/doc/org.eclipse.cdt.doc.user/concepts/cdt_c_before_you_begin.htm @@ -36,13 +36,14 @@ Download and run the latest MSYS2 installer by following instructions on the

- - - - - - - + + + + + + + +
Tool Installation command
clangd pacman -S mingw-w64-ucrt-x86_64-clang-tools-extra
cmake pacman -S mingw-w64-ucrt-x86_64-cmake
gcc pacman -S mingw-w64-ucrt-x86_64-gcc
gdb pacman -S mingw-w64-ucrt-x86_64-gdb
make pacman -S make
ninja pacman -S mingw-w64-ucrt-x86_64-ninja
Tool Installation command Notes
clang pacman -S mingw-w64-ucrt-x86_64-clang Provides the LLVM with Clang toolchain
clangd pacman -S mingw-w64-ucrt-x86_64-clang-tools-extra Required by the C/C++ Editor (LSP)
cmake pacman -S mingw-w64-ucrt-x86_64-cmake Required for building CMake projects
gcc pacman -S mingw-w64-ucrt-x86_64-gcc Provides the MinGW GCC toolchain
gdb pacman -S mingw-w64-ucrt-x86_64-gdb Required for debugging
make pacman -S make Required for building Managed Build projects
ninja pacman -S mingw-w64-ucrt-x86_64-ninja Required for building CMake projects