This is just another version of my previous post on Cygwin with focus on MinGW64. I hope this guide will more or less make it easy to install MinGW on Windows. After following this guide, you'll be ready to develop genuine Windows applications. Just download and run setup.exe from the Cygwin website and choose the following packages.
- bison
- gettext-devel
- libtool
- make
- mingw64-i686-gcc-g++
- mingw64-x86_64-gcc-g++
- patch
- pkg-config
To select a package for installation, type the name of the package in the Search box, expand the category by clicking the + sign, and click on the package until its version number shows up.
When you see the Resolving Dependencies window, just accept and click Next.
Mounting /mingw
If you're building 32-bit applications, add the following line to /etc/fstab
so that /mingw is properly set up.
/usr/i686-w64-mingw32/sys-root/mingw /mingw none bind
If you're building 64-bit applications, add the following line to /etc/fstab
instead.
/usr/x86_64-w64-mingw32/sys-root/mingw /mingw none bind
Creating Symbolic Links
Start the Cygwin terminal and create symbolic links to gcc and g++ in this manner.
ln -s /usr/bin/i686-w64-mingw32-gcc.exe /usr/i686-w64-mingw32/bin/gcc.exe
ln -s /usr/bin/i686-w64-mingw32-g++.exe /usr/i686-w64-mingw32/bin/g++.exe
ln -s /usr/bin/x86_64-w64-mingw32-gcc.exe /usr/x86_64-w64-mingw32/bin/gcc.exe
ln -s /usr/bin/x86_64-w64-mingw32-g++.exe /usr/x86_64-w64-mingw32/bin/g++.exe
Setting up environment variables
If you're building 32-bit applications, type the following commands or put them in ~/.profile:
export CC=/usr/bin/i686-w64-mingw32-gcc.exe
export CFLAGS="-mtune=pentium2 -mthreads -mms-bitfields -O2"
export CXXFLAGS="-mtune=pentium2 -mthreads -mms-bitfields -O2"
export CPPFLAGS="-I/mingw/include"
export LDFLAGS="-L/mingw/lib -Wl,--enable-auto-image-base -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
export PATH=/mingw/bin:/usr/i686-w64-mingw32/bin:/usr/local/bin:/usr/bin
export PKG_CONFIG_PATH=/mingw/lib/pkgconfig
If you're building 64-bit applications, type the following or put in ~/.profile:
export CC=/usr/bin/x86_64-w64-mingw32-gcc.exe
export CFLAGS="-mtune=core2 -mthreads -mms-bitfields -O2"
export CXXFLAGS="-mtune=core2 -mthreads -mms-bitfields -O2"
export CPPFLAGS="-I/mingw/include"
export LDFLAGS="-L/mingw/lib -Wl,--enable-auto-image-base -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
export PATH=/mingw/bin:/usr/x86_64-w64-mingw32/bin:/usr/local/bin:/usr/bin
export PKG_CONFIG_PATH=/mingw/lib/pkgconfig
For more information on possible -mtune values, look here.
No comments:
Post a Comment