HowTo: Install MSYS and MinGW for use with Eclipse CDT

From WxWiki
Jump to navigation Jump to search

Prerequisite

You will need a file archiving software capable of uncompressing lzma, gz and tar files.

One free software solution is 7-zip (windows executable) direct link.


Note on usage of gcc/g++: Please read this article on the --enable-auto-import linker option for a good understanding of why you might be getting the following (or similar) warning, and decide whether you want to --enable-auto-import by default.

Info: resolving std::cout  by linking to __imp___ZSt4cout (auto-import)
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe: warning: a
uto-importing has been activated without --enable-auto-import specified on the c
ommand line.
This should work unless it involves constant data structures referencing symbols
 from auto-imported DLLs.)

Enabling auto-import:

  • in g++, the command line option is -Wl,--enable-auto-import to pass the argument to the linker (same option to be used for Eclipse linker call!)
  • if the linker is called separately, the option should be just --enable-auto-import (not tested)

MSYS installation

  • get msysCORE, (regex) libregex, (termcap) libtermcap, coreutils, (gettext) libintl, libiconv, (openssl) libopenssl, bash, wget, make, sed, grep, findutils:

MSYS & MinGW download page

MSYS & MinGW download page (inofficial sourceforge beta)

Files:

msysCORE-1.0.14-1-msys-1.0.14-bin.tar.lzma
libregex-1.20090805-2-msys-1.0.13-dll-1.tar.lzma
libtermcap-0.20050421_1-2-msys-1.0.13-dll-0.tar.lzma
coreutils-5.97-3-msys-1.0.13-bin.tar.lzma
libintl-0.17-2-msys-dll-8.tar.lzma
libiconv-1.13.1-2-msys-1.0.13-dll-2.tar.lzma
libopenssl-1.0.0-1-msys-1.0.13-dll-100.tar.lzma
bash-3.1.17-3-msys-1.0.13-bin.tar.lzma
wget-1.12-1-msys-1.0.13-bin.tar.lzma
make-3.81-3-msys-1.0.13-bin.tar.lzma
sed-4.2.1-2-msys-1.0.13-bin.tar.lzma
grep-2.5.4-2-msys-1.0.13-bin.tar.lzma
findutils-4.4.2-2-msys-1.0.13-bin.tar.lzma

If you want to build xerces-c later:

  • get tar and gawk:

Files:

tar-1.23-1-msys-1.0.13-bin.tar.lzma
gawk-3.1.7-2-msys-1.0.13-bin.tar.lzma

Optional tools:

  • bzip2, diffutils, gzip, less, man, openssh, unzip, vim, zip

Files:

bzip2-1.0.5-2-msys-1.0.13-bin.tar.lzma
diffutils-2.8.7.20071206cvs-3-msys-1.0.13-bin.tar.lzma
gzip-1.3.12-2-msys-1.0.13-bin.tar.lzma
less-436-2-msys-1.0.13-bin.tar.lzma
man-1.6f-2-msys-1.0.13-bin.tar.lzma
openssh-5.4p1-1-msys-1.0.13-bin.tar.lzma
unzip-6.0-1-msys-1.0.13-bin.tar.lzma
vim-7.2-2-msys-1.0.13-bin.tar.lzma
zip-3.0-1-msys-1.0.14-bin.tar.lzma
  • create directory "c:\msys\1.0" and extract the contents of msys archives there using 7-zip

(need to unpack lzma, then untar, 7-zip can do both)

  • create a shortcut to "c:\msys\1.0\msys.bat" with icon "m.ico" (same directory) if you like
  • Add the "bin" folder of your msys installation (e.g. "c:\msys\1.0\bin") to your Windows environment Path variable (see Adding an Environment Variable under Windows). This is done in order to enable the MinGW make application to run from command prompt.

MinGW installation

  • get MinGW BaseSystem Files gcc-core, libgcc, gcc-c++, libstdc++:

MSYS & MinGW download page

MSYS & MinGW download page (inofficial sourceforge beta)

Files from MinGW -> BaseSystem -> GCC -> Version4

gcc-core-4.5.0-1-mingw32-bin.tar.lzma
libgcc-4.5.0-1-mingw32-dll-1.tar.lzma
gcc-c++-4.5.0-1-mingw32-bin.tar.lzma
libstdc++-4.5.0-1-mingw32-dll-6.tar.lzma
libgomp-4.5.0-1-mingw32-dll-1.tar.lzma
libssp-4.5.0-1-mingw32-dll-0.tar.lzma
  • get binutils

Files from MinGW -> BaseSystem -> GNU-Binutils

binutils-2.20.51-1-mingw32-bin.tar.lzma

WARNING: Earlier versions of binutils (ld.exe) will cause faulty executables (Exception 0xc0000005) due to non-functional auto-imports (up to MinGW automated installer 5.1.6 this problem did not occur).

If you really *must* user an older version, then make sure that ANYTHING you build will use the linker flag --enable-runtime-pseudo-reloc-v2 (Add -Wl,--enable-runtime-pseudo-reloc-v2 to g++ command line). For reference, please see this article and this one here.

  • get runtime library mingwrt and win32-api

Files from MinGW -> BaseSystem -> RuntimeLibrary -> MinGW-RT (or Win32-API respectively)

mingwrt-3.18-mingw32-dll.tar.gz
mingwrt-3.18-mingw32-dev.tar.gz
w32api-3.14-mingw32-dev.tar.gz
  • get MinGW (not MSYS!) packages make, mpc, mpfr, gmp, pthreads-w32

Files

make-3.81-20090914-mingw32-bin.tar.gz
libmpc-0.8.1-1-mingw32-dll-2.tar.lzma
mpc-0.8.1-1-mingw32-dev.tar.lzma
libmpfr-2.4.1-1-mingw32-dll-1.tar.lzma
mpfr-2.4.1-1-mingw32-dev.tar.lzma
libgmp-5.0.1-1-mingw32-dll-10.tar.lzma
gmp-5.0.1-1-mingw32-dev.tar.lzma
libpthread-2.8.0-3-mingw32-dll-2.tar.lzma
pthreads-w32-2.8.0-3-mingw32-dev.tar.lzma
  • if desired, get gdb & libexpat

File from MinGW -> BaseSystem -> GDB

gdb-7.1-2-mingw32-bin.tar.gz

File from MinGW -> expat

libexpat-2.0.1-1-mingw32-dll-1.tar.gz
  • create a directory "c:\mingw" and extract the contents of mingw archives there using 7-zip

(need to unpack gz or lzma, then untar, 7-zip can do both)

  • create the directory "c:\msys\1.0\mingw"

(leave it empty, this is the mountpoint for your mingw installation)

  • create a text file with the following two lines:
#Win32_Path		Mount_Point
c:/mingw		/mingw
  • save that text file as "c:\msys\1.0\etc\fstab" (no file extension!)

The next time you start MSYS, your mingw folder will be available as "/mingw"

  • Add the "bin" folder of your MinGW installation (e.g. "C:\mingw\bin") to your Windows environment Path variable (see Adding an Environment Variable under Windows). This is done in order to enable the MinGW make application to run from command prompt.


Setting MinGW Environment Variables

This section is deprecated as of 2010-06-14: The Eclipse CDT, MSYS & MinGW environment no longer needs these environment variables. This section has therefore NOT been updated to reflect the latest version path names.

  • create the file MinGWPathEntries.reg and copypaste the following text into it:
Windows Registry Editor Version 5.00

; MinGWPathEntries.reg
; Creates the registry entries for environment variables
;   LIBRARY_PATH
;   C_INCLUDE_PATH
;   CPLUS_INCLUDE_PATH
; for a standard MinGW installation into the folder C:\MinGW

[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment]
"LIBRARY_PATH"="C:\\MinGW\\lib"
"C_INCLUDE_PATH"="C:\\MinGW\\include"
"CPLUS_INCLUDE_PATH"="C:\\MinGW\\include\\c++\\3.4.5;C:\\MinGW\\include\\c++\\3.4.5\\backward;C:\\MinGW\\include\\c++\\3.4.5\\mingw32;C:\\MinGW\\include" 

  • execute MinGWPathEntries.reg (by doubleclicking)

When asked "Are you sure you want to add the information in <current dir>\MinGWPathEntries.reg to the registry?"

  • select "Yes"

When informed the information has been successfully added to the Registry

  • select "OK"

further steps according to original guide

  • install Java Runtime Environment (tested with jre-6u20-windows-i586.exe)
  • extract wxWidgets (unzip, untar) and move contents to c:/msys

--Lars 17:23, 1 June 2010 (UTC)