Setup mingw

From PLplotWiki
Jump to: navigation, search

Setup MinGW command line tools

MinGW[1] a collection of freely available and freely distributable Windows specific header files and import libraries, augmenting the GNU Compiler Collection, (GCC), and its associated tools, (GNU binutils). MinGW provides a complete Open Source programming tool set which is suitable for the development of native Windows programs that do not depend on any 3rd-party C runtime DLLs.

Download and install

Official MinGW 4.4

Recently a new version (4.4) of the MinGW command line tools were released. Since the MinGW installer only installs the old version (3.4.5) here are the instructions to install version 4.4 manually.

  • Download from [1]:
    • GNU Binutils (binutils-2.19.1-mingw32-bin.tar.gz)
    • GCC Version 4 (gcc-core-4.4.0-mingw32-bin.tar.gz, gcc-core-4.4.0-mingw32-dll.tar.gz, gcc-c++-4.4.0-mingw32-bin.tar.gz, gcc-c++-4.4.0-mingw32-dll.tar.gz, gmp-4.2.4-mingw32-dll.tar.gz, mpfr-2.4.1-mingw32-dll.tar.gz)
    • MINGW Runtime (mingwrt-3.16-mingw32-dev.tar.gz, mingwrt-3.16-mingw32-dll.tar.gz)
    • Windows 32 API (w32api-3.13-mingw32-dev.tar.gz)
    • GNU Make (mingw32-make-3.81-20080326-3.tar.gz)
    • MinGW Utilities (mingw-utils-0.3.tar.gz)
    • GNU Source-Level Debugger (gdb-6.8-mingw-3.tar.bz2) - optional

Alternative - TDM's experimental builds

  • The easiest way is to download the latest On demand TDM/MinGW Installer [2] and run it. This installer allows you to download and install the official MinGW command line tools 3.4.5 and the unofficial TDM's experimental GCC/MinGW32 builds (gcc 4.4.1).
  • Run the installer and press 'Create'. As installation directory I chose c:\MinGW-3.4.5 or c:\MinGW-4.4.1 depending on the gcc version I selected. To install gcc 4.4.1 choose the 'TDM-GCC Recommended, C/C++' type of install for gcc 3.4.5 choose 'MinGW stable, C/C++'. In addtion you can choose a fortran, ada, objc and objc++ language extension. After clicking 'Install' the packages will be downloaded and installed in the given directory.
  • The only thing which is not installed is the make tool. Therefore go to the file release site of MinGW and download mingw32-make-3.81-20080326-3.tar.gz and extract the content with your favorite zip tool in to the MinGW installation directory.

Setup

To configure and compile plplot with MinGW it is best to use the Windows CLI. Please follow the instructions in [setup_cli Setup CLI] to get the Windows Command Line Interface ready for development. Then open your favorite text editor and enter the following CLI commands

@echo off

rem setup MinGW compiler
set MINGWDIR=C:\MinGW-4.3.1
set PATH=%MINGWDIR%\bin;%PATH%

rem add Ada support if you installed the ada package
set CMAKE_LIBRARY_PATH=%MINGWDIR%\lib\gcc\mingw32\4.3.1\adalib;%CMAKE_LIBRARY_PATH%

rem setup PLplot library
set PLPLOTDIR=path_to_plplot
set PLPLOT_LIB=%PLPLOTDIR%\data
set PATH=%PLPLOTDIR%\dll;%PATH%

and save this to e.g. mingwvars.bat. If you installed the MinGW 3.4.5 command line tools, exchange in the script 4.3.1 with 3.4.5 (twice). Start you Windows CLI, cd into the directory where the batch file was saved and run mingwvars.bat. Run gcc --version, gfortran --version and gnat to see if everything works. Your MinGW developing environment is now ready.

Links

  1. MinGW Homepage
  2. TDM's Experimental GCC/MinGW32 Builds