User Tools

Site Tools


notes:mingw_compiler

MinGW Compiler

I have been using MinGW (Minimalist GNU for Windows) to build my code for Windows platform. It has changed a bit since I last used it to build a cross compiler for my class. So, I want to keep a note on how I build using latest binaries. The project has moved here.

Installing MinGW:

  • Get the 'package manager' from here
  • Pick a location and extract the zip file
    • I choose C:\Users\Public\Tool
    • change the folder name so that we have C:\Users\Public\Tool\mingw\bin\mingw-get.exe
  • Prepare to use mingw-get binary
    • cd C:\Users\Public\Tool\mingw\var\lib\mingw-get\data\
    • copy defaults.xml profile.xml
  • Open a command prompt and update catalogue
    • cd C:\Users\Public\Tool\mingw\bin\
    • mingw-get.exe update
  • Get stuffs (compiler with Unix-like environment) without using GUI
    • mingw-get.exe install gcc g++ gmp mpfr mpc msys msys-wget-bin
  • To get GUI interface install mingw-get (apparently, we are NOT running mingw-get! 8-))
    • mingw-get.exe install mingw-get
    • now, a window will come up when you run mingw-get

Note20211207 Current software versions {gcc:9.2.0,binutils:2.32}

Some useful things to do:

  • Get helper script(s) - I wrote that for personal use
    • copy everything (except LICENSE, README.md and msys2.vbs) to C:\Users\Public\Tool\mingw
    • allows environment to be used on shared computer (no need for admin account)
  • Running msys.vbs (*Hint*: double-click) will install (or remove if already installed) a pop-up context menu entry (MinGW Shell) whenever you right-click on a folder in Windows Explorer
    • edit C:\Users\Public\Tool\mingw\msys\1.0\etc\profile and comment (place '#' at the beginning of) the last line with cd $HOME command
  • To have git in MinGW shell, install Git-for-Windows at C:\Users\Public\Tool\Git
    • edit C:\Users\Public\Tool\mingw\msys\1.0\etc\profile and insert PATH=“/c/users/public/tool/git/bin:$PATH” before the block containing an export PATH line(s)
  • Running mingw-setup.bat sets up normal command prompt for command-line compilation
    • place mingw-term.bat script in any folder - when executed, it will open a command prompt (with MinGW path properly configured) in that folder
  • Running mingw-clear.bat cleans up settings created by mingw-setup.bat

Installing wxWidgets

This is what I recommend to my students when developing cross-platform GUI solution. I now compile from source because I can never completely download the pre-built binaries… problem with my uni's network maybe? :-(

Obviously, MinGW must already be installed.

  • Get the source file from here
    • since we are compiling on MinGW, get the 'source for Linux…' (I got wxWidgets-3.0.3.tar.bz2)
    • extract (can be done in MinGW shell: tar xf <file>)
  • Compile… (note: '$' is the prompt)
    $ ./configure --prefix=/c/Users/Public/Tool/wxwidgets --disable-shared
    $ make
    $ make install

work in progress…

notes/mingw_compiler.txt · Last modified: 2021/12/07 15:29 by 127.0.0.1