Revision of LibrariesAndTools from 2010, April 19 - 12:39

Printer-friendly version

Other Libraries and Tools to Use with MinGW

If you want to compile and build cross-platform Open Source programs that you might typically find in a POSIX environment (Linux, Cygwin or BSD), you'll need some of the standard libraries and tools these systems use to build applicatons. There's still no guarantee a program from another system will port to Windows unless it's been designed to, but many applications that work on POSIX systems can be built and run on Windows with some minor patching. Look for command line tools or programs built on cross-platform libraries like curses (pdcurses on Windows, ncurses on POSIX), gtk+, fltk, fox toolkit, wxwidgets, qt for your best bets on Open Source programs that will port to Windows or may already have ports. If you do get a port running, you can help the project by contributing a mingwPORT of it so others don't have to try to repeat the work you've done.

Installing Libraries

I usually install libraries in the subdirectories under Msys to prevent library files from co-mingling with compiler files and possibly over-writing needed files. According to the MinGW developers mailing list, the decision was made to put libraries built to be used with MinGW in the subdirectories under the directory MinGW is installed in instead of under Msys. This keeps a division between libraries used to create programs for a standard Windows environment and programs specifically for the Msys environment only. When you look at the MinGW downloads at Sourceforge, most libraries are labeled for MinGW or for Msys. You'll generally want to use the versions for MinGW if you're building a standard Windows application.

Most MinGW files at Sourceforge are in the tar.lzma format. LZMA based compression can help create smaller packages in most cases than other formats like tar.gz (.tgz) and tar.bz2 (.tbz). Both xz and lzma use lzma compression algorithms. I don't know why lzma was chosen over xz for packages with MinGW. According to the creators of both the lzma and xz formats, lzma is being deprecated. See http://tukaani.org/lzma/ for more information. However, you can still decompress lzma files with the xz program using the -lzma switch or use the older lzma program.

To manage libraries or extra files that need to be installed in your compiler directories, you can use a program such as spkg. That way, you don't accidentally over-write compiler files. You can tell which libraries are installed and update them quickly and easily to the next version. You can also uninstall them without having to track down all files in a package when they're no longer needed. To work with Spkg, set the ROOT environment variable to the top level directory where you want to install to (example: SET ROOT=c:\MinGW). Spkg requires names of files you install to use the standard Slackware package naming conventions. See the package how-to at http://www.linuxpackages.net. Packages are simply tarballs (a combination of using tar to archive a file and a compression algorithm like gzip or xz or lzma to compress the archived file). Slackware packages also add a few files to an install directory within the tarball to give extra information about the package. These may include a description of the program or library in a slack-desc file and a list of other programs or libraries needed to make it work in a slack-required file. These extra files are optional and aren't necessary to install a package using spkg. Spkg works well for .tgz (.tar.gz) files, but might need some tweaking and program updates for the new .txz format or to handle MinGW packages' use of .tar.lzma. Worst case scenario, you can always decompress and unarchive a package, recreate the package in .txz or .tgz format with a proper name (and even add a slack-desc for better documentation) and then install.

Some Standard GNU Tools and Libraries

Building Programs

Many programs can be compiled and built in msys using ./configure, make, make install commands. GNU has provided tools to help create and run the files that let you do this.

One of the simpler tools to work with for building applications and libraries is a make file. There's a program called make that uses the information in the make file to build the library or application. For more information, see http://www.gnu.org/software/make/. The make program provided with your latest msys installation should be fairly up-to-date.

For the configure scripts, having up-to-date versions of autoconf and automake are useful. If you don't have the latest, you can download the mingw32 versions from Sourceforge. Install in your \MinGW directory (top directory where MinGW compiler suite was installed). According to gnu.org, "autoconf is an extensible package of M4 macros that produce shell scripts to automatically configure software source code packages". See http://www.gnu.org/software/autoconf/ for details. Also from the gnu.org site, "GNU M4 is an implementation of the traditional Unix macro processor". If you want to know more about M4, see http://www.gnu.org/software/m4/m4.html. A fairly up-to-date version of M4 should have been installed with your latest msys installation. According to gnu.org, "automake is a tool for automatically generating 'Makefile.in' files compliant with the GNU Coding Standards". See http://www.gnu.org/software/automake/ for details.

According to gnu.org, "GNU libtool is a generic library support script. Libtool hides the complexity of using shared libraries behind a consistent, portable interface." See http://www.gnu.org/software/libtool/ for details. You'll find updated versions of this as well at Sourceforge in the MinGW downloads section. Check the release file for notes. There's mention of an issue with linking against the static libstdc++ runtime. If you get an error that the compiler is trying to find the dll version and there isn't one, be sure to see the note.

Internationalization

GNU also provides some standard tools and libraries for handling internationalization and language issues. These include gettext and libiconv. According to gnu.org, "the GNU 'gettext' utilities are a set of tools that provides a framework to help other GNU packages produce multi-lingual messages". See http://www.gnu.org/software/gettext/ for details. According to gnu.org, GNU libiconv is a conversion library for converting between a given text encoding and the user's encoding and for converting between internal string representation (Unicode) and external string representation (a traditional encoding) when programs do I/O. See http://www.gnu.org/software/libiconv/ for details. If you're attempting to build an Open Source application that looks for gettext or libiconv, you'll probably want to add these libraries to your system. You'll find them in the MinGW Sourceforge downloads. Check the release notes file for information on what helper files you need to download and install with these libraries. The MinGW versions (with mingw instead of msys in their file names) are for typical MinGW users and need to be installed in the \MinGW directory (top directory where MinGW compiler suite was installed) in order to work properly.

Shared Libraries

POSIX systems use shared libraries (.so) while the Windows standard is the dll. To help bridge that gap, there's a wrapper library, dlfcn. You can download it from http://code.google.com/p/dlfcn-win32/.

Threading

Threading support has been added to later versions of MinGW. Windows compilers don't normally supply POSIX style threading with a standard installation. A library for Cygwin (and MinGW) was created by Red Hat and the Cygwin developers to bridge that gap. You'll find more about POSIX threads here http://sourceware.org/pthreads-win32/. If you've installed pthreads-w32 from the MinGW Sourceforge download page, then you don't need to install the Cygwin version as well.

Screen Libraries

GTK+

GTK+ is one of the more popular cross-platform screen libraries on POSIX systems. It's used by the GNOME desktop and many applications. You can also use GTK+ on Windows. Check the GTK+ site http://www.gtk.org/download-windows.html for useful GTK+ libraries to install and use with MinGW and msys. Some of the libraries on the GTK+ Windows download page are also available in the MinGW download files section. If possible, you'll most often want to use the MinGW versions of these libraries at the MinGW Sourceforge archive. For the main GTK+ libraries such as glib, pango, atk, cairo, it's best to download straight from the source, the GTK+ site. GTK+ can be configured to give a similar look and feel to all GTK+ based applications. See programs such as stardict at Sourceforge for some tools to customize GTK+ themes on your system.

Further Information

How you can help

This is just the start for a list of some of the tools and libraries that can help with porting. The [mingwPORT] system was designed to help assist MinGW users in adding other useful libraries and tools to their system. It can also be used to build applications. However, developers first need to contribute mingwPORT scripts so that others can use them and save time on patching, porting and installation. Please help the MinGW project out by contributing mingwPORT scripts for some of the Open Source programs and libraries you've built with MinGW.

If you need an easy way to install, uninstall, update and track libraries or applications (tarball packages) on your system, take a look at spkg. It's a good way to avoid the registry for installations (which may be useful with portable apps).

You can help by adding links to other standard Open Source tools and libraries that you've found useful when building applications using MinGW and msys. You can share what versions of various tools described above or found in the MinGW downloads you prefer working with. Do you have any tips for installing or tweaking these libraries and utilities to help you build applications? Please post your favorite tips and tricks below.

Site Status

Site maintenance completed May 25th, 2012 at 12:38 UTC