[Insight-users] Compiling ITKv4.2.1 with support for Pythonv2.7.3 using Visual Studio 2008 win32

Matt McCormick matt.mccormick at kitware.com
Tue Oct 30 11:14:17 EDT 2012


Hi Willi,

some time ago I tried to compile ITK with the Support for Python using
> Visual Studio 2010 with Win64. I wanted to support 2,3,4 and 5 dimensions
> and all available datatypes. I committed some patches to get rid of some
> errors I've found.
>
> That time I ran into a lot of issues and discontinued.
>

With your efforts and the efforts of some other community members, the
Python wrapping on Windows is steadily improving.  Note that it might still
be some time before we will be able to do Visual Studio 2010, but VS2008
and MinGW are much improved.  We now have a contributed VS2008 nightly
dashboard build, which helps considerably.


> Now I started again compiling and wanted to use VS2008 with only win32.
> Again I added 4 and 5 dimensions to the standard 2 and 3 and I switched on
> all the available datatypes for Python support.
>

Switching on all the available datatypes is good for testing, but it does
come with compilation time and library size overhead.

We have a patch for 4 dimensions on Windows here:

  http://review.source.kitware.com/#/c/8161/


> This time I got the following compiler or linker error:
>
> itkZeroFluxNeumannPadImageFilterPython.cpp
>
> itkWrapPadImageFilterPython.cpp
>
> itkWarpImageFilterPython.cpp
>
> itkVectorResampleImageFilterPython.cpp
>
> itkTileImageFilterPython.cpp
>
> itkSliceBySliceImageFilterPython.cpp
>
> itkShrinkImageFilterPython.cpp
>
> itkResampleImageFilterPython.cpp
>
> itkRegionOfInterestImageFilterPython.cpp
>
> itkPermuteAxesImageFilterPython.cpp
>
> itkPasteImageFilterPython.cpp
>
> itkOrientImageFilterPython.cpp
>
> itkMirrorPadImageFilterPython.cpp
>
> itkInterpolateImageFilterPython.cpp
>
> itkFlipImageFilterPython.cpp
>
> itkExpandImageFilterPython.cpp
>
> itkCyclicShiftImageFilterPython.cpp
>
> itkCropImageFilterPython.cpp
>
> itkBSplineUpsampleImageFilterPython.cpp
>
> itkBSplineDownsampleImageFilterPython.cpp
>
> Code wird generiert...
>
> c:\itksrc\modules\core\common\include\itkimage.h(284) : fatal error C1128:
> Die Anzahl von Abschnitten hat das Formatierungslimit der Objektdatei
> überschritten: Kompilieren mit /bigobj.
>
>  Ergebnisse     Das Buildprotokoll wurde unter
> "file://c:\itkbin\Wrapping\Modules\ITKImageGrid\ITKImageGridPython.dir\Release\BuildLog.htm"
> gespeichert.
>
> ITKImageGridPython - 1 Fehler, 0 Warnung(en)
>
> I did the compilation of this example by hand with /bigobj as extra flag
> and voila it worked.
>

Excellent!  Good find.


> Then I wanted to add the /bigobj flag to my CMake configuration so that it
> automatically is included and I can commit a patch for review.
>
> In CMake/ITKSetStandardCompilerFlags.cmake I 've found a option that
> already made use of /bigobj whenever VS2005 is used or Win64 is enabled.
>
> Since /bigobj is allowed after VS2005 I changed:
>
> if(CMAKE_CL_64 OR CMAKE_COMPILER_2005)
>
> set(ITK_REQUIRED_CXX_FLAGS "${ITK_REQUIRED_CXX_FLAGS} /bigobj")
>
> endif()
>
> to:
>
>          if(MSVC_VERSION GREATER 1400 OR MSVC_VERSION EQUAL 1400)
>
>            set(ITK_REQUIRED_CXX_FLAGS "${ITK_REQUIRED_CXX_FLAGS} /bigobj")
>
>          endif()
>
> which might not be 100 percent correct but at least it does what I want it
> to do what I've checked with:
>
>  message("Flags are ${ITK_REQUIRED_CXX_FLAGS}")
>
> which shows me:
>
> Flags are /DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR -W3 /bigobj
>
> I assume the -W3 to be wrong and commented the generating line.
>
> My problem is now that its not appearing in the final results of
> CMAKE_CXX_FLAGS although it is in the variable at the end of CMakeLists.txt
> in C:\itksrc which I checked with a message.
>

This may or may not be a problem.

To check on what flags are actually being passed to the compiler with my
VS2008 Express Edition, I go to Tools -> Options -> Projects And Solutions
-> Build and Run -> MSBuild project build output verbosity.

Looking forward to the patch!

Thanks,
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20121030/1962e69d/attachment.htm>


More information about the Insight-users mailing list