Let msys2 configure find mingw gcc/g++

I have gcc.exe, g++.exe, make.exe, etc. in C:\MinGW\bin

In the msys2 terminal, I can say PATH=$PATH:/c/MinGW/bin but it does not save this change after I close the msys terminal.

A StackOverflow question says I have to edit ~/.profile.
I did this by adding the line in bold:
# ~/.profile: executed by the command interpreter for login shells.

# Set user-defined locale
export LANG=$(locale -uU)
export PATH=$PATH:/c/MinGW/bin

And then I ran source ~/.profile.

Still doesn't work though, the path is not set permanently; I'm still getting ./configure for libraries I try to build to output the following
$ ./configure
No working C compiler found.

Any ideas?

Edit: And in case this is one of those "xy problems", am I setting up msys[2] wrong to compile projects? Is there another suggested way to do this? I got fftw3 to compile correctly using msys2 (although I think it ignored the --enable-portable-binary option, but I don't think this is a big deal) and then run correctly in windows code.

Also, just to clarify, what I am currently doing is compiling the x264 library, which is apparently needed in order to compile FFMPEG library features
Last edited on
I suggest you delete the separate MinGW and install it properly in MSYS2 via pacman:

$ pacman -S mingw-w64-i686-gcc
$ pacman -S mingw-w64-x86_64-gcc
$ pacman -S make

Additionally, before doing the above, you should probably refresh MSYS2 if it's an old installation:

$ pacman -Syu
$ # close window
$ pacman -Su

I guess that'll work. Will that affect compatibility with libraries that I've already built outside of msys2? Guess it can't hurt to try, so thank you. I'm probably going to keep the original MinGW since I don't think it hurts anything, to be used outside of msys2, but then use the mingw install via pacman for building the necessary libraries that aren't easy to build in windows by itself.
Registered users can post here. Sign in or register to post.