User Tools

Site Tools


blog:2022:0808_revisiting_mingw

Revisiting MinGW (for sdcc build)

I want to build sdcc for NMK322 so that my students can use EXACTLY what I have. So, here we go again:

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

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

Some useful things to do:

  • 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
      MY1GITPATH="/c/users/public/tool/git/bin"
      [ -d "$MY1GITPATH" ] && PATH="$MY1GITPATH:$PATH"

      before the block containing an export PATH line(s)

  • 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
  • If you want to use normal Windows command prompt to run stuff, these two scripts are you friend (you may ignore them otherwise)
    • Running mingw-setup.bat sets up normal command prompt for command-line compilation
      • place mingw-term.bat script (form tools folder) 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
blog/2022/0808_revisiting_mingw.txt · Last modified: 2023/08/29 10:43 by 127.0.0.1