Moved from, unmodified. The information are heavily outdated and need to be adjusted for MSYS2.

Cross Compiling on Linux to build Geany for Windows

Getting the files

You need the following files: First the compiler with all related tools(binutils, linker, …). Visit there are precompiled binaries for x86 Linux available and also a script to compile all by hand. I used the precompiled binaries to save time. Then download and from the same site. There is also a ReadMe file, which has more information.

To compile some code which uses the Windows API, you need the appropriate header files. These can be obtained from:

Furthermore, you need some libraries and their include files for the GTK environment. The easiest way to get them is to use the GTK Bundle available on and


And don't forget to get a newer version of libiberty. The one included in the binary archive is missing some symbols which are needed. A working version can be found here: (note that this file is also from the mingw32 project). Probably, you won't need this file if you are compile the compiler and related tools by hand.

Unpacking the files

Now, after downloading the files, they have to be extracted. Start with the precompiled binaries. Extract them somewhere to your filesystem, I recommend /usr/local/cross-tools, then you have not much work with adjusting paths. /usr/local/cross-tools is now the PREFIX and all other files should be extracted into this directory. So, proceed with the other archives and extract them into your prefix.

After that, copy the both scripts and somewhere in your path. Perhaps, it is a good idea to rename them to something shorter. On my system the scripts are called xconfigure and xmake and reside in ~/bin.

The file libiberty.a.gz has to be extracted to PREFIX/lib/.

Setting up the environment

First, go to PREFIX/lib/pkgconfig/ and edit all .pc files. They have a line prefix= which you have to edit and set it to your prefix, in my case /usr/local/cross-tools/. Do this for every .pc file. Yura Siamashka wrote a nice script to do this at once, you can download it here:

Then edit the script Add the following lines somewhere at the beginning of the file:


Don't forget to adjust your paths. The other script doesn't have to be modified.

Configuring and compiling your sources

You have done the job. If all went well, you can start compiling your sources. For configuring and compiling you should use the two scripts. can be used like the usual ./configure command. The is just a simple wrapper for the make command.

Let's say you want to compile Geany, the following should work(assuming and are in your PATH):

  $ svn co geany
  $ cd geany
  $ ./
  $ --enable-gnu-regex

After that, you should have an executable in the src directory named geany.exe. If you got some linker errors like undefined reference to `_fnmatch', you need another version of libiberty. Read again about Libiberty.

The option –enable-gnu-regex is necessary to use the bundled regular expression implementation which is necessary to be used on Windows.