the instalation of GCC seemed to work fine, but when i run gcc -- version, i get greeted by "bash:gcc: command not found" response. i followed the instructions with every step. what could be the issue?
I found a fix thanks to chatgpt ( who would've thought). turns out the MSYS2 link from the vs code page was simply outdated, so i used this one from the MSYS2 page and ran the commands in the ucrt window. I will leave this here in hopes someone else finds and needs this
Hi,
I have installed gcc in Windows 11 environment, but I want to execute gtk, I searched the following link:
https://www.msys2.org/
I installed msys2-x86_64-2025221.exe
After that I tried the following command:
pacman -S mingw-w64-ucrt-x86_64-gcc
but finally gcc is not working please guide me.
The output is:
MSYS ~
$ pacman -S mingw-w64-ucrt-x86_64-gcc
resolving dependencies...
looking for conflicting packages...
Packages (16) mingw-w64-ucrt-x86_64-binutils-2.44-1
mingw-w64-ucrt-x86_64-crt-git-12.0.0.r576.g49111ba98-1
mingw-w64-ucrt-x86_64-gcc-libs-14.2.0-3 mingw-w64-ucrt-x86_64-gettext-runtime-0.24-1
mingw-w64-ucrt-x86_64-gmp-6.3.0-2
mingw-w64-ucrt-x86_64-headers-git-12.0.0.r576.g49111ba98-1
mingw-w64-ucrt-x86_64-isl-0.27-1 mingw-w64-ucrt-x86_64-libiconv-1.18-1
mingw-w64-ucrt-x86_64-libwinpthread-git-12.0.0.r576.g49111ba98-1
mingw-w64-ucrt-x86_64-mpc-1.3.1-2 mingw-w64-ucrt-x86_64-mpfr-4.2.1-2
mingw-w64-ucrt-x86_64-windows-default-manifest-6.4-4
mingw-w64-ucrt-x86_64-winpthreads-git-12.0.0.r576.g49111ba98-1
mingw-w64-ucrt-x86_64-zlib-1.3.1-1 mingw-w64-ucrt-x86_64-zstd-1.5.7-1
mingw-w64-ucrt-x86_64-gcc-14.2.0-3
Total Download Size: 65.83 MiB
Total Installed Size: 519.08 MiB
:: Proceed with installation? [Y/n] Y
:: Retrieving packages...
mingw-w64-ucrt-x86_64-gcc-... 43.5 MiB 14.3 MiB/s 00:03 [###############################] 100%
mingw-w64-ucrt-x86_64-isl-... 1453.5 KiB 420 KiB/s 00:03 [###############################] 100%
mingw-w64-ucrt-x86_64-libi... 725.4 KiB 930 KiB/s 00:01 [###############################] 100%
mingw-w64-ucrt-x86_64-gcc-... 1021.6 KiB 823 KiB/s 00:01 [###############################] 100%
mingw-w64-ucrt-x86_64-zstd... 642.3 KiB 2.55 MiB/s 00:00 [###############################] 100%
mingw-w64-ucrt-x86_64-gmp-... 578.5 KiB 963 KiB/s 00:01 [###############################] 100%
mingw-w64-ucrt-x86_64-mpfr... 535.7 KiB 1739 KiB/s 00:00 [###############################] 100%
mingw-w64-ucrt-x86_64-mpc-... 128.3 KiB 594 KiB/s 00:00 [###############################] 100%
mingw-w64-ucrt-x86_64-gett... 311.6 KiB 499 KiB/s 00:01 [###############################] 100%
mingw-w64-ucrt-x86_64-zlib... 92.1 KiB 165 KiB/s 00:01 [###############################] 100%
mingw-w64-ucrt-x86_64-winp... 39.8 KiB 128 KiB/s 00:00 [###############################] 100%
mingw-w64-ucrt-x86_64-binu... 6.0 MiB 994 KiB/s 00:06 [###############################] 100%
mingw-w64-ucrt-x86_64-head... 6.4 MiB 1046 KiB/s 00:06 [###############################] 100%
mingw-w64-ucrt-x86_64-libw... 28.6 KiB 97.4 KiB/s 00:00 [###############################] 100%
mingw-w64-ucrt-x86_64-wind... 3.0 KiB 12.9 KiB/s 00:00 [###############################] 100%
mingw-w64-ucrt-x86_64-crt-... 4.6 MiB 679 KiB/s 00:07 [###############################] 100%
Total (16/16) 65.8 MiB 9.35 MiB/s 00:07 [###############################] 100%
(16/16) checking keys in keyring [###############################] 100%
(16/16) checking package integrity [###############################] 100%
(16/16) loading package files [###############################] 100%
(16/16) checking for file conflicts [###############################] 100%
(16/16) checking available disk space [###############################] 100%
:: Processing package changes...
( 1/16) installing mingw-w64-ucrt-x86_64-libwinpthread-git [###############################] 100%
( 2/16) installing mingw-w64-ucrt-x86_64-gcc-libs [###############################] 100%
( 3/16) installing mingw-w64-ucrt-x86_64-libiconv [###############################] 100%
( 4/16) installing mingw-w64-ucrt-x86_64-gettext-runtime [###############################] 100%
( 5/16) installing mingw-w64-ucrt-x86_64-zlib [###############################] 100%
( 6/16) installing mingw-w64-ucrt-x86_64-zstd [###############################] 100%
( 7/16) installing mingw-w64-ucrt-x86_64-binutils [###############################] 100%
( 8/16) installing mingw-w64-ucrt-x86_64-headers-git [###############################] 100%
( 9/16) installing mingw-w64-ucrt-x86_64-crt-git [###############################] 100%
(10/16) installing mingw-w64-ucrt-x86_64-gmp [###############################] 100%
(11/16) installing mingw-w64-ucrt-x86_64-isl [###############################] 100%
(12/16) installing mingw-w64-ucrt-x86_64-mpfr [###############################] 100%
(13/16) installing mingw-w64-ucrt-x86_64-mpc [###############################] 100%
(14/16) installing mingw-w64-ucrt-x86_64-windows-default... [###############################] 100%
(15/16) installing mingw-w64-ucrt-x86_64-winpthreads-git [###############################] 100%
(16/16) installing mingw-w64-ucrt-x86_64-gcc [###############################] 100%
zulfi@DESKTOP-070V6RM MSYS ~
$ gcc --version
-bash: gcc: command not foundHowever, gcc is already working on my computer on windows shell,
c:\msys64>gcc gcc: fatal error: no input files compilation terminated.
I want to install gtk.
Somebody please guide me.
Zulfi.
Videos
I tried to compile a default key map and get the error message "sh: avr-gcc: comand not found".
When using make iris/rev2:default following error message appeared.
$ make iris/rev2:default QMK Firmware 0.6.246 Making iris/rev2 with keymap default /bin/sh: avr-gcc: command not found sh: avr-gcc: command not found sh: avr-gcc: command not found make[1]: *** [tmk_core/rules.mk:256: gccversion] Error 127 Make finished with errors make: *** [Makefile:544: iris/rev2:default] Error 1
I use windows10 and Msys2 64bit with "MSYS2 MinGW 64-bit".
I tried following to solve this error, but didn't solve the problem.
reinstall msys2 and qmk
rerun util/qmk_install.sh
run echo 'export PATH="/usr/local/opt/avr-gcc@7/bin:$PATH"' >> ~/.bash_profile and restart terminal
run pacman -S avr-gcc and "Error target not found: avr-gcc" appeared.
This is my first time of building key map, then I'm a beginner.
Any information would greatly help.
Unable to resolve configuration with compilerPath "gcc". Using "C:\MinGW\bin\gcc.exe" instead. (this is visual studio code ide)
so i tried to follow the basic guide as stated on the msys2 site and installed the program and ran the pacman commands....i included the mingw bin folder in the environment variables but when i ran the gcc -- version command in the command prompt...it didnt recognize it. the bin folder in my mingw64 directory is empty btw i checked a youtube video for the same and the bin folder had some files
Since you installed mingw-w64-x86_64-gcc it seems like you want to compile 64-bit native Windows applications. Therefore, you should start MSYS2 by running mingw64.exe, found at the top level of your MSYS2 installation. That will put /mingw64/bin/ on your PATH and set some other useful environment variables.
Solution
I have found simply adding C:\msys64\mingw64\bin to the host windows computers PATH variable this, in turn, adds \mingw64\bin to the MSYS2 $PATH solving the problem.
I'm still a noob learning cs50, I wanted to do a project on my main machine so installed vscode on windows 10 and msys2 and made msys2 the default shell for vscode then downloaded gcc and gdb and edited system variables and it worked I can access gcc from PowerShell or MSYS2 MINGW64
but I can't do this from MSYS2 shell in vscode, does anyone have an idea why this happens? How to fix it?
MSYS /d/code $ gcc --versions bash: gcc: command not found
so i wanted to install the gtk package with this command > pacman -s mingw-w64-x86_64-gtk3
but it just says -bash: -S: command not found
note: if i search for mysys in start i get like 5 options so i just click on the first one
The gcc compiler for MSYS2 on windows does some really funky linux shell emulation.
https://packages.msys2.org/packages/mingw-w64-x86_64-crt-git
It causes the following:
> cat foo.c
#include <stdio.h>
int main( int argc, char**argv ) {
printf("%s\n", argv[1]);
}
> gcc foo.c
> a.exe "*"
.bashrc (or some such file)So even quoting the "*" or escaping it with \* does not pass the raw asterisk to the program. It must do some funky "prior to calling main" hooks in there because it's not the shell, it's things specifically built with this particular compiler.
> echo "*" *
However, there's an out.
https://github.com/search?q=repo%3Amsys2-contrib%2Fmingw-w64%20CRT_glob&type=code
This is the fix.
> cat foo.c
#include <stdio.h>
int _CRT_glob = 0;
int main( int argc, char**argv ) {
printf("%s\n", argv[1]);
}
> gcc foo.c
> a.exe "*"
*FYI / PSA
This is an informational post in reply to a recent other post that the OP deleted afterwards, thus it won't show up in searches, but I only found the answer in one stackoverflow question and not at all properly explained in MINGW/MSYS documentation (that I can find, feel free to comment with an article I missed), so I figure it's better to have some more google oracle search points for the next poor victim of this to find. :-p
See title -- it's what I'm trying to do. I'd like the MSYS2 installaton to work with Eclipse CDT, which is why I'm also taking these instructions into account. Working with CDT is not my primary goal though -- most important is to set up a 64-bit MSYS2/MinGW dev environment.
I've downloaded and installed msys2-x86_64-20250622.exe. I'm pretty sure that's the correct installer for a 64-bit Windows 10 machine, which is what I'm on. So far so good.
So I run it, and start up "MSYS2" from the Start menu, run "pacman -Syu", then "pacman -S gcc make vim".
But then I look at the instructions linked above, and it seems that "pacman -S gcc" is a mistake, even though gcc works fine from the MSYS2 command line after installation. Apparently, in order for things to work with Eclipse CDT, I should have done "pacman -S mingw-w64-ucrt-x86_64-gcc", which installs GCC stuff into /msys64/ucrt64. Strangely though, the urct64 subdir is is not on MSYS' own PATH, so after installation the binaries aren't found when called from the MSYS2 console.
So here's one question: why does MSYS2 have a "normal" GCC package (with all its dependencies), and also an alternative "UCRT64" GCC package, with its own dependencies (also marked URCT64). The suffix "64" seems to suggest that that's what I want on a 64-bit machine -- but since the MSYS2 core that I installed is itself 64-bit, I have no idea why I would have to specify the 64-bit packages explicitly -- and even less of an idea as to why the binaries inside those "ucrt64" packages aren't even put on MSYS2' own PATH.
BUT! Now things turn even more complicated when I read this MinGW page. As it turns out, the MSYS2 distributation has created multiple additional startup-links in the Windows start folder, including an "MSYS2 UCRT64", "MSYS2 CLANG64", "MSYS2 MINGW64", etc. Great! What the heck are these for? And why does each of these variants require its own variation of the GCC package and its dependencies?
And why isn't any of this explained anywhere? (Or maybe it is. But DuckDuckGo doesn't know about it.)
First of all, I'd really like to know how I produce 64-bit executables for Windows, using MSYS2. If I run the "regular" (non-UCRT64 gcc", will it create a 32-bit executable or a 64-bit?
Help please.
PS. Among the dependencies of the regular gcc package are msys2-w32api-headers and msys2-w32api-runtime. Is "win32api" an indication that using this gcc I'll be compiling for 32-bit Windows? Or is "win32api" simply the legacy name left over from the 1990's, designating the Windows API against which all Windows programs (regardless whether 32-bit or 64-bit) are compiled?
fyi I am a big noob in programming.
So I installed VS Code with no issue.
But I am having problem with the compiler. I downloaded minGW 64 from multiple sites, and I'm keep having problems related with my bin folder; either the bin folder is entirely empty, or, there is no gcc.exe file which I need to put in the Environmental Variables.
Please help me out.
I recently downloaded the QMK stuff to add macros to my TADA68, but whenever I try to make the default layout I get this output:
QMK Firmware 0.7.38
WARNING:
Some git sub-modules are out of date or modified, please consider running:
make git-submodule
You can ignore this warning if you are not compiling any ChibiOS keyboards,
or if you have modified the ChibiOS libraries yourself.
Making tada68 with keymap default
/bin/sh: avr-gcc: command not found
tmk_core/protocol/lufa.mk:14: lib/lufa/LUFA/makefile: No such file or directory
make[1]: *** No rule to make target 'lib/lufa/LUFA/makefile'. Stop.
Make finished with errors
make: *** [Makefile:574: tada68:default] Error 1
I've looked at several other Reddit threads in an effort to fix this issue. I've reinstalled QMK a few times now at least, reinstalled MSYS2, etc etc. I've tried everything I can think of. Does anyone know how I can fix this?
EDIT: Doing this on W10, thru MSYS2 MINGW64
EDIT 2: Ok I got it to work. I deleted/uninstalled EVERYTHING, and then started over again. I missed the instillation instructions on the MSYS2 website; there are two commands there that need to be run. Not sure if that was what was causing the issue before, but future people who are having problems: make sure to run every command and follow all directions!
I'm trying to build my layout for the first time, but I keep running into this error that says that avr-gcc is missing.
I'm on windows and I'm using msys2. I ran utils/msys2_install.sh to install everything initially. I also tried running utils/qmk_install.sh but it didn't do anything. Thanks!
$ make levinson/rev2:default QMK Firmware 0.6.87 Making levinson/rev2 with keymap default /bin/sh: avr-gcc: command not found sh: avr-gcc: command not found sh: avr-gcc: command not found make[1]: *** [tmk_core/rules.mk:243: gccversion] Error 127 Make finished with errors make: *** [Makefile:544: levinson/rev2:default] Error 1
I know this has since been resolved for OP, but since this was the top reddit result when googling this error, I figured I'd post the solution that worked for me in macOS.
run echo 'export PATH="/usr/local/opt/avr-gcc@7/bin:$PATH"' >> ~/.bash_profile then restart Terminal.
source: https://github.com/qmk/qmk_firmware/issues/4120
Are you sure you installed everything? The script that you run will ask you if you want to install stuff a few times, and you need to input Y for those.