Why do MinGW and MSYS have separate versions of gcc?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Why do MinGW and MSYS have separate versions of gcc?

Andrew Sauber

This is my understanding of the relationship between MinGW and MSYS.

When installing MinGW and its gcc toolchain, installing MSYS is optional.

With MSYS installed, you get bash and a few other tools that I assume are meant to be used with the MinGW gcc that you just installed. However, when you run the MSYS batch script that opens up a bash shell, gcc is not on your PATH. At this point you do one of two things:

  • You launch the MinGW installer again, and notice that you didn't select gcc under the MSYS category. You think to yourself, "didn't I already install gcc?" You wait for that package to download, and drop back to MSYS's bash shell. You run gcc --version and see that it's an ancient version of gcc from ten years ago. You then proceed to do the thing below, if you even realize that it's an option.

OR

  • You echo $PATH, to find that C:\MinGW\bin is on your path, but C:\MinGW\bin is not mounted. You add the proper mount command to your ~/.profile, and are happy to find that the recent version of gcc provided by MinGW is now on your PATH.

Why do MinGW and MSYS have separate versions of gcc? Why doesn't the user have access to the recent version of gcc provided by MinGW immediately within MSYS? I don't use Windows very often, and I was trying to use MinGW and MSYS to teach my brother C. I didn't want to be using a version of gcc from ten years ago. This behavior was baffling.


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Why do MinGW and MSYS have separate versions of gcc?

Eli Zaretskii
> Date: Fri, 1 Aug 2014 15:16:25 -0400
> From: Andrew Sauber <[hidden email]>
>
> Why do MinGW and MSYS have separate versions of gcc?

Because MSYS programs and MinGW programs use different runtimes.

> Why doesn't the user have access to the recent version of gcc
> provided by MinGW immediately within MSYS?

You will, if you install MinGW correctly (which includes putting its
bin directory on PATH), before you install MSYS.  Installing MSYS
prepends a few directories to the existing PATH, so your MinGW GCC
will be accessible from MSYS Bash.

> I don't use Windows very often, and I was trying to use MinGW and
> MSYS to teach my brother C.

In that case, you shouldn't be installing MSYS at all.  It is not
needed for compiling and running MinGW programs written in C.  Just
install MinGW, and start using it.

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Why do MinGW and MSYS have separate versions of gcc?

Keith Marshall
On 01/08/14 20:27, Eli Zaretskii wrote:
>> Date: Fri, 1 Aug 2014 15:16:25 -0400
>> From: Andrew Sauber <[hidden email]>
>>
>> Why do MinGW and MSYS have separate versions of gcc?
>
> Because MSYS programs and MinGW programs use different runtimes.

Correct.  The MSYS specific GCC -- the ancient version -- is intended to
be used only by those who are developing MSYS itself.

>> Why doesn't the user have access to the recent version of gcc
>> provided by MinGW immediately within MSYS?
>
> You will, if you install MinGW correctly (which includes putting its
> bin directory on PATH), before you install MSYS.  Installing MSYS
> prepends a few directories to the existing PATH, so your MinGW GCC
> will be accessible from MSYS Bash.

That's not strictly accurate.  MSYS relies on a mount table assignment,
*not* on a Windows PATH setting, to locate the MinGW /bin directory,
(which is where MinGW GCC executables live).  Correctly *starting* the
MSYS shell, (with the --login option, and usually also the -i option),
places /mingw/bin early in $PATH, but it's the MSYS mount table which
maps that to the correct Windows path.

Right now, the MSYS installation instructions request the user to
manually configure the requisite mount table entry; mingw-get needs a
hook, which I contributed a couple of months ago, to have it do that
automatically.  This hook should be activated with the next (1.0.19)
MSYS release, but it doesn't work with the current (1.0.18) release.

>> I don't use Windows very often, and I was trying to use MinGW and
>> MSYS to teach my brother C.
>
> In that case, you shouldn't be installing MSYS at all.

That's a rather draconian assertion...

> It is not needed for compiling and running MinGW programs written in C.  Just
> install MinGW, and start using it.

No, it isn't *needed*, but maybe the OP would just prefer it anyway; (I
certainly do, on the increasingly rare occasions when I have to fire up
my Windows VM).

--
Regards,
Keith.

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Why do MinGW and MSYS have separate versions of gcc?

Andrew Sauber
In reply to this post by Andrew Sauber

Ah! I just sent this in reply to the digest by accident. Sorry about that.

Thanks Keith and Eli, I have a complete picture of the situation now. Hopefully that mingw-get hook gets patched in soon! It's great to have bash and gcc that targets Windows, but confusing when it doesn't work out of the box.

- Andrew


------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Why do MinGW and MSYS have separate versions of gcc?

Keith Marshall
On 03/08/14 20:44, Andrew Sauber wrote:
> Hopefully that mingw-get hook gets patched in soon!

Well, it's not a mingw-get patch, as such.  It requires a new (Lua)
post-install script to be added to the msys-core package itself, with an
associated hook to invoke it, in the on-line XML catalogue file which
describes this package to mingw-get.

Thus, a new MSYS release is necessary to make this feature available;
AFAIK, Cesar is considering it for the upcoming MSYS-1.0.19 release.

--
Regards,
Keith.

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Why do MinGW and MSYS have separate versions of gcc?

Keith Marshall
In reply to this post by Andrew Sauber
On 01/08/14 20:16, Andrew Sauber wrote:
> You add the proper mount command to your ~/.profile, and are happy to
> find that the recent version of gcc provided by MinGW is now on your
> PATH.

Adding the mount command to ~/.profile is a bad idea.  Mounts in MSYS
are persistent; the first time that command is run, the corresponding
mount point entry will be added to /etc/fstab.  On your next --login
start-up of the shell, the mount point will already be mapped, so the
mount command will fail.

Just leave the mount point mapping in /etc/fstab, remove the mount
command from ~/.profile, and you should be good to go.

--
Regards,
Keith.

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Why do MinGW and MSYS have separate versions of gcc?

Gayle Lee Fairless
In reply to this post by Andrew Sauber
From:
Eli Zaretskii <[hidden email]>
Date:
8/1/2014 2:27 PM

To:
MinGW Users List <[hidden email]>


> Date: Fri, 1 Aug 2014 15:16:25 -0400
> From: Andrew Sauber <[hidden email]>
>
> Why do MinGW and MSYS have separate versions of gcc?

Because MSYS programs and MinGW programs use different runtimes.

> Why doesn't the user have access to the recent version of gcc
> provided by MinGW immediately within MSYS?

You will, if you install MinGW correctly (which includes putting its
bin directory on PATH), before you install MSYS.  Installing MSYS
prepends a few directories to the existing PATH, so your MinGW GCC
will be accessible from MSYS Bash.

> I don't use Windows very often, and I was trying to use MinGW and
> MSYS to teach my brother C.

In that case, you shouldn't be installing MSYS at all.  It is not
needed for compiling and running MinGW programs written in C.  Just
install MinGW, and start using it.



------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe