Develoment with MITK on Windows XP
On several occasions I've enjoyed the luxury of getting machine fully set-up for my respective prioject. For my current project however, I had to set up a
Medical Imaging Interaction Toolkit (MITK) development environment and spent some days building the necessary prerequisites. Especially Qt3 on Windows gave me some headaches, so here's some hints if you need to setup something similar.
--
TobiasReichl - 09 Dec 2008
Building Qt3/Win
- Get Qtwin ("qt-win-3.3.x-8") from the SourceForge Qtwin project homepage.
- Build instructions for several compilers can be found at another SourceForge Qtwin project homepage.
- For compilation using Microsoft Visual Studio 2008 change "winable.h" in line 43 of src\kernel\qaccessible_win.cpp to "winuser.h" (see original Microsoft announcement about breaking changes in Visual C++ 2008). This change does not hurt with VS 2005, either.
- Initialise your compilation environment. Depending on your installation, the script path might look like one of the following
- "c:\Programme\Microsoft Visual Studio 8\VC\bin\vcvars32.bat"
- "c:\Program Files\Microsoft Visual Studio 8\vc\bin\vcvars32.bat"
- "c:\Program Files (x86)\Microsoft Visual Studio 9.0\vc\bin\vcvars32.bat"
- "c:\Programme\Microsoft Visual Studio 9.0\vc\bin\vcvars32.bat"
- For traditional (obsolete?) reasons I keep Qt in C:\Qt: set QTDIR=C:\Qt
- Add the Qt tools to the currently searched path: set PATH=%QTDIR%\bin;%PATH%
- set QMAKESPEC=win32-msvc2005 (works fine with VS 2008 as well)
- configure.bat -verbose -debug (see "Unresolved Issues" below!)
Getting cmake
- Download and install cmake 2.4.8 from the cmake download site.
- For me, cmake 2.6 did not work, but cmake 2.4.8 is working fine, so I did not further investigate this issue.
Building ITK
- Download the ITK 3.10 zip file from the ITK download site.
- Extract the zip file and create a "Build" directory in it.
- Start cmake, use the ITK source directory and the newly created Build directory, configure and generate.
- Switch off the examples (BUILD_EXAMPLES) if you don't want them, saves some building time.
- Open the ITK solution from the Build directory in Visual Studio and build ITK (build both both debug and release configurations).
Building VTK
- Download the VTK 5.0 zip file (MITK does not yet fully support VTK 5.2)
from the VTK download site.
- Extract the zip file and create a "Build" directory in it.
- Start cmake, use the VTK source directory and the newly created Build directory, configure and generate.
- If the %QTDIR% environment variable is set correcty, cmake finds most Qt components by itself (DESIRED_QT_VERSION = 3).
- Switch on GUI support (VTK_USE_GUISUPPORT) and QVTK (VTK_USE_QVTK), as well as vtkParallel (VTK_USE_PARALLEL).
- Open the VTK solution from the Build directory in Visual Studio and build VTK (build both both debug and release configurations).
Building MITK
- Create a container folder "MITK" and checkout MITK from the SVN repository into e.g. "mitk".
- Create a build directory, e.g. "mitkBinary".
- Start cmake, use the MITK source directory and the newly create mitkBinary directory, configure and generate.
- Check that the ITK and VTK folders (ITK_DIR resp. VTK_DIR) have been found correctly.
- Select the desired Qt version (DESIRED_QT_VERSION = 3).
- Open the MITK solution from the mitkBinary directory in Visual Studio and build MITK.
- If you run into "C1128: number of sections exceeded object file limit" (see original Microsoft reference), add "/bigobj" to CMAKE_C_FLAGS resp. CMAKE_CXX_FLAGS.
Unresolved Issues
- Qt3 can be built in either debug or release configuration, and (using VS 2008 for example) is linked against either msvcp90d.dll (debug) or msvcp90.dll (release), respectively.
- Qt3 does not yet have an option to keep both a release build and a debug build on hand (e.g. Qt4 has a 'd' suffix for debug build files, ITK and VTK have different folders etc.), unless you want to deeply dig into the makefiles.
- If you build MITK with a different configuration than Qt3, you end up with contradicting dependencies on both msvcp90d.dll and msvcp90.dll and the application fails with "This application has failed to start because MSVCP90.dll was not found." or "R6034 An application has made an attempt to load the C runtime incorrectly."