[vtkusers] Building VTK on 64-bit Windows using MinGW-w64

Christian Lackas lackas at invicro.com
Fri Jan 21 04:52:10 EST 2011


Hi Everybody,

yesterday I tried to build VTK on Windows-7 64-bit, using MinGW-w64[1]
and ran into a couple of issues. In case this is some help for anybody,
you can find a patch (against SVN trunk as of yesterday) here:

    http://www.invicro.com/vtk/vtk-msys-mingw64.patch

The problems I had to fix where:
1) Quite a few places where pointers are converted to integers to be
   used as ids, which on a 64-bit system failed due to loss of precision
   when casting pointers to e.g. long.
   I replaced the casts to intptr_t, which seems to be the natural
   type for this operation (and should be available on all C99/C++0X
   compatible compilers).
2) On MinGW-w64 one cannot use __int64 type together with long long,
   something that apparently was addressed in CMake/vtkTestTypes.cmake
   (according to the svn history), however, the ruleset there still did
   not work for me and I has to force VTK_TYPE_USE___INT64 to 0.
3) Two Windows symbols (GWL_WNDPROC and HWL_HINSTANCE) were not defined
   for unknown reasons. Since I don't fully understand vtk's mechanism
   of not including windows.h when building vtk itself, I just used a
   big hammer.
4) Overwriting _WIN32_WINNT caused problems, just removed that.
5) Removed an apparently obsolete typedef for 'signed char' that lead to
   a redefined error.

After applying above patch, I could successfully compile a 64-bit build
of VTK using g++ 4.4.5 (20100604) under MSYS.

[1] http://mingw-w64.sourceforge.net/

Hope this is useful to anyone,
 Christian

-- 
Dr. Christian Lackas, Managing Partner
inviCRO, LLC -- In Imaging Yours
P: +1 617 963 0263, F: +49 2203 9034722, E: lackas at invicro.com
http://www.invicro.com/  http://www.spect-ct.com/



More information about the vtkusers mailing list