Install mingw and msys to run c programs on windows

23
2014-04
  • Hesham Abouelsoaod

    I installed MinGW by using mingw-get-inst-20111118.exe and it works but it is very slow!

    I don't want to install it online, I remember that I have previously installed MinGW and msys by using two files mingw.exe and msys.exe without using the internet and it was great, but now I cant repeat what I have done and I cant find a link to mingw.exe!

    Please, I want a simple steps for better offline installation?

    Thanks

  • Answers
  • shunty

    I wrote myself a small aide-memoire the other day on how to update (or set up) my MinGW and MSYS installation for building 32 and 64 programs on Windows. I doesn't involve mingw-get so you may have to go fetch any additional stuff manually but I think it includes pretty much all you might need.

    It goes like this:

    MinGW Environment

    eg:

    http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.7.2/64-bit/threads-posix/sjlj/x64-4.7.2-release-posix-sjlj-rev2.7z/download

    and

    http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/4.7.2/32-bit/threads-posix/sjlj/x32-4.7.2-release-posix-sjlj-rev2.7z/download

    Use the Posix threads sjlj version

    • Unzip the 32 bit version to eg c:\mingw
    • Unzip the 64 bit version over the top

    MSYS

    • Copy MSys directory from previous installation into c:\mingw\msys\1.0 or get an updated version from Sourceforge and unzip it.

    eg: MSYS-20111123

    Add c:\mingw\bin and c:\mingw\msys\1.0\bin to path


  • Related Question

    path - How do I stop MSYS from transforming my compiler options?
  • Carl Norum

    Is there a way to stop MSYS/MinGW from transforming what it thinks are paths on my command lines? I have a project that's using nmake & Microsoft Visual Studio 2003 (yeecccch). I have the build system all ported and ready to go for GNU make (and tested with Cygwin). Something weird is happening to my compiler flags when I try to compile in an MSYS environment, though. Here's a simplified example:

    $ cl /nologo
    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.6030 for 80x86
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    /out:nologo.exe
    C:/msys/1.0/nologo
    LINK : fatal error LNK1181: cannot open input file 'C:/msys/1.0/nologo.obj'
    

    As you can see, MSYS is transforming the /nologo compiler switch into a windows path, and then sending that to the compiler. I really don't want this to happen - in fact I'd be happy if MSYS never transformed any paths - my build system had to take care of all that when I first ported to Cygwin. Is there a way to make that happen?

    It does work to change the command to

    $ cl -nologo
    

    Which produces the expected results, but this build system is very large and very painful to update. I really don't want to have to go in and change every use of a / for a flag to a -. In particular, there may be tools that don't support the use of the - at all, and then I'll really be stuck.

    Thanks for any suggestions!


  • Related Answers
  • actf

    I found this question while searching for a way to run a windows program which requires an argument in the form:

    /arg:<path>
    

    where path must be a fully qualified windows path

    I just wanted to elaborate on the following from the original question:

    It does work to change the command to

    cl -nologo
    

    Which produces the expected results .... In particular, there may be tools that don't support the use of the - at all, and then I'll really be stuck.

    As the original poster suggests, transforming the argument using - as follows, works perfectly:

    -arg:<path>
    

    I was actually really surprised by this, as this is not documented by the program's help. It just so happens the program in this case is also made by Microsoft (as is nmake in the original poster's case). So if the program you're attempting to run is made by Microsoft give this a shot even if it's undocumented.

    Hopefully there aren't any programs out there that use this (imho insane) form of command line arguments outside of Microsoft, if there are, I don't think it's possible to run them with MSYS

  • Carl Norum

    The final answer is that there is fact no way to stop this behaviour. I had to go through every line in the build system and change every / into a -.