VISH  0.2
Compiling under Windows using the Minimal Gnu Windows Environment (MINGW)

Compiling Vish on Windows

The following describes how to compile the vish project on a Windows platform using free tools and libraries.

Shopping list

For the impatient ones, this will not be updated frequently! If these links fail, read on below:

  1. MinGW compiler, via an installer.exe (install to X:\mingw\, select also 'g++' and 'MinGW Make'), select full MinGW, e.g.:
  2. MSYS, POSIXs shell environment (install to X:\msys\): MSYS-1.0.10.exe, version from Mar 16, 2004
  3. Get SVN: http://subversion.tigris.org/files/documents/15/39559/svn-1.4.5-setup.exe and/or http://prdownloads.sourceforge.net/tortoisesvn/TortoiseSVN-1.4.5.10425-win32-svn-1.4.5.msi?download
  4. QT3 Library, unpack to X:\mingw\qt-3\, compile it with mingw: select qt-3.3.x-p8.7z here; in case you need 7-ZIP from here: www.7-zip.org note you need MingGW installed with MingGW G++ and MinGW make here.
  5. Get vish: you should know how to do that
  6. Optional: Get GNU Emacs for native Windows, there exists only one release, 21.3. If you already know emacs from Unix, you might like to have the same environment under Windows, if you don't know it yet, you might better stay at your favourite editor since the default settings of Emacs are awkward and require little list programming to make them more convenient.

MinGW Compiler

http://www.mingw.org/
MinGW is a port of the GNU compiler and a collection of rewritten libraries to produce native windows binaries, having removed all dependencies on any third party libraries. The download instructions at mingw.org are a bit confusing, so if you don't know what to download or how to install it: There is an installer.exe which selects the right packages and downloads them. It can be found on mingw's sourceforge file download page (MinGW sourceforge.net).

If the installer fails to make an internet connection, check the IE's http proxy settings which the installer silently is using, they might be wrong.

MinGW 5.0.2 (installer), February 12, 2006

Add g++ to the preselected 'Minimal' installation settings and also add 'MinGW Make' if you plan to compile QT-Win library yourself.

Install in a toplevel directory, choosing a name without spaces or special characters. (e.g. D:\mingw334\). Using "no spaces" really is important! A directory name containing spaces, passed as an option to a command on the command line, would very likely be misinterpreted as two or more options.

MinGW also is not a fully transparent porting environment for your software. For example, sockets are not wrapped, you have to adapt your code to do it "the Windows' way". To find out how to do this and learn about other issues when porting a *nix application to native windows, read the documents on the mingw site which also refer you to the MSDN *nix->windows porting guides.

Cygwin and MinGW

If you are using cygwin and you have found the mingw packages for it, be warned! There are many pitfalls and problems when using MinGW and Cygwin together. There is no support done by the MinGW people for this as the packages are provided by the cygwin project. Whether or not the standalone version and the cygwin packages are equivalent remains unclear to me, contradictory statements exist. It is important that the MinGW developers don't see them as equivalent.

There are reports of successful integration of the standalone version of MinGW into cygwin, as well as successful usage of the cygwin provided packages (you might want to look into the -mno-cygwin option, available in mingw supplied by cygwin). I think it might be doable but might be prone to mistakes, as you have to make sure that not a single cygwin-related library or header slips into your project, which would immediately break the independence of your project from the cygwin libraries. If you want to try, I would suggest you try to integrate an external standalone version of mingw to be called from within cygwin.

One of the main source of problems is the mixing of cygwin and non cygwin libraries and headers. Non-cygwin applications are not aware of the virutal cygwin path like /cygdrive/d/, a non-cygwin application has no idea what to do with '/cygdrive/d/' the path replacement logic is compiled in. Slash or backslash is not so much of a problem, as the Windows APIs seem to accept either (it claims to be POSIX compliant). Sometimes when using backslashes you have to insert several as \\ (2 backslashes) are translated to \ (1) and if you want one '\' (1) to arrive at the linker command line you have to start with '\\\\' (4) in the beginning.

To continue, we need a make environment and a shell; running the compliation process in CMD.exe or COMMAND.exe won't work.

MSYS - environment

http://www.mingw.org/
Minimal System is a (POSIX) environment. You get a shell (sh.exe) in a terminal window and many commands you would expect from a *nix environment like ls, ln, pwd, etc. It also provides an adapted version of gnu make.
Retrieve it from the ming.org download page, from the 'current' folder

MSYS-1.0.10.exe, Mar 16, 2004


Again choose a toplevel directory without any spaces or special characters in its name for installation (e.g. D:\msys\). Never mix the trees of msys and mingw or install them inside each other. It is important to install MinGW first. Check that the MSYS installer gives a positive feedback on the previously installed mingw and on the make command.

Possible causes of troubles: The PATH environment settings. There are Windows global settings and settings for different users, settings in MSYS and there could be a /cygwin/bin path dangling around somewhere. On my system sh.exe didn't work, a system wide file search revealed a sh.exe sitting in the c:/WINNT/ directory! Also a system wide search for all 'cygwin.dll' is enlightening.

MSYS's built in PATH translation logic accepts many different formulations of a path. The cleanest is /d/temp/ which is equivalent (means replaced by the internal path replacement logic) to d:\temp\.

Make sure all the invoked commands (sh, etc.) are really coming from msys/bin and not from a cygwin installation.

For debugging problems with command line options (especially file paths) try looking at the output of the following program to see how your options are processed.

#include <stdio.h>

int main( int argc, char **argv)
{
int i = 0;
        while( argc-- )
                printf( "argv[%d]: %s\n", i++, *argv++ );
        return 0;
}

MSYS 1.0.10 and 1.0.11 differ. Use 1.0.10 for now.

QT-3 Library - old please skip to next paragraph

http://qtwin.sourceforge.net/qt3-win32/index.php
Troll.no only released a binary version of qt3 for windows and this only integrates to MSVC. To compensate for that, the qtwin.sf.net project did a source port of the qt3-x11-free code to native windows. Get it from the project's home page and follow the instructions for compilation using MinGW.

It is best to start the compilation process over night, it takes a while. MinGW is very slow in the linker stage.

Alternatively, you can get a pre-compiled and packaged qt from here:

-linkto prebuilt qt3-mt.dll (not yet, please ask)-

I installed the qt3 into the mingw tree: /d/mingw/qt-3/ and compiled it there.

QT-3 Library - current

http://qtwin.sourceforge.net/qt3-win32/index.php Troll.no only released a binary version of qt3 for windows and this only integrates to MSVC. To compensate for that, the qtwin.sf.net project did a source port of the qt3-x11-free code to native windows. Get it from the project's home page and follow the instructions for compilation using MinGW.

It is best to start the compilation process over night, it takes a while. MinGW is very slow in the linker stage.

http://qtwin.sourceforge.net
qt-3.3.x-p8.7z
install to C:\mingw\qt-3....
open command line (start->run->cmd.exe)
change to qt dir
c:\source> set QTDIR=< qt3 source root >
c:\source> set MINGW=< MinGW installation root >
c:\source> set PATH=%QTDIR%\bin;%MINGW%\bin;%PATH%
c:\source> set QMAKESPEC=win32-g++

configure

incase of crash continue with: mingw32-make

I used qt-3.3.x-p8.7z, which I installed into the mingw tree: /d/mingw/qt-338/ and compiled it there.

Compiling vish

Checkout vish into a directory of choice. Set the environment vars and call make

export QTDIR=/d/mingw/qt3/
export MAKE_CFG=Debug
export PATH=/d/mingw/bin:/d/mingw/qt-3/bin:$PATH
export MINGW=/d/mingw/
make

October, 2006

Author:
Georg Ritter, newsgr (d o t) 2006 (a t) gamebox (d o t) net, replace 2006 with the current year