[Insight-users] Compiling ITK4 in 32 bit mode on 64 bit linux

Andriy Fedorov fedorov at bwh.harvard.edu
Wed Feb 23 09:43:51 EST 2011


On Sat, Feb 19, 2011 at 16:47, Luis Ibanez <luis.ibanez at kitware.com> wrote:
> Hi Andriy,
>
> ------------------------------------------------------------------------------
> On Thu, Feb 17, 2011 at 2:31 PM, Andriy Fedorov <fedorov at bwh.harvard.edu> wrote:
>> 1) is there a set of specific instructions on building ITK4 on 32 bit
>> platform? (I haven't found any, and I have problems compiling it, see
>> below)
> -----------------------------------------------------------
>
>
> Note that what you are asking is not
>
>    "How to build ITK in a 32-bits platform"
>
> but
>
>    "How to cross-compile ITK for a 32-bit
>     platform target in a 64-bit platform host"
>
> which is quite different.
>

I agree.

>
> Building ITK natively in a 32-bit platform is
> trivial and can be done with the traditional:
>
>                      mkdir ITKbin
>                      cd ITKbin
>                      cmake        ~/src/ITK
>                      make
>
>
> While,
> cross-compiling it for a 32-bits target platform
> in a 64-bits host requires the following steps:
>

After "git pull", and a fresh reconfigure using the flags you
mentioned, the build process succeeded. I am not sure, maybe cmake
configuration was not refreshed correctly when I tried before.

See the results of testing on dashboard:

http://www.cdash.org/CDash/viewTest.php?onlypassed&buildid=876137

> -----------------------------------------------------
>>
>> 2) are there any 32-bit machines on ITK4 dashboard?
>>
> -----------------------------------------------------
>
> Yes:
>

Thank you, I see the tests of my interest are passing.

> ---------------------------------------------------
>> The long story is below ... All I wanted to do is to test some
>> functionality of 3D Slicer, since we found some issues on 32-bit
>> build.
>>
> ------------------------------------------------------
>
> What was the issue in Slicer ?
>
> ------------------------------------------------------

Slicer has a module that wraps N4 tool. That module has a test that
was taken from the original IJ submission. That test fails on virtual
machine 32 bit linux, but not on any other machine. The maximum
intensity difference in the regression test is 15 units, and ~32K
pixels exceed the allowed threshold of 2 units.

The current version of N4 in ITK4 uses a different set of tests. I was
gong to upgrade the tests we have in Slicer to correspond to the tests
in ITK4. Before doing that, I wanted to confirm that those tests
succeed on 32 bit linux ITK4 dashboard, which is the case. Now that we
know the problem is not in ITK, it makes sense to update testing in
Slicer.

Slicer is using ITK 3-20, but N4 included in Slicer is the latest
version from ITK4.

Thank you for your help, Luis!

>>
>> I am trying to compile current checkout of ITK4 on Ubuntu 10.04 x64 in
>> 32-bit mode.
>>
>> To do this, I installed gcc-multilib support, and specified -m32 flag
>> for CC and CXX.
>>
>> My first attempt to compile resulted in the following error:
>> /home/andrey/local/src/ITK/Code/Common/itkChainCodePath2D.cxx:18:
>> /usr/lib/gcc/x86_64-linux-gnu/4.4.3/include/emmintrin.h:32:3: error:
>> #error "SSE2 instruction set not enabled"
>>
>> Following some advice from google, I added flags -msse2 and -msse4.
>> This resulted in the following error:
>>
>> In file included from /home/andrey/local/src/ITK/Code/Common/itkMath.h:32,
>>                 from
>> /home/andrey/local/src/ITK/Testing/Code/Common/itkMathTest.cxx:22:
>> /home/andrey/local/src/ITK/Code/Common/itkMathDetail.h: In function
>> ‘itk::int64_t itk::Math::Detail::RoundHalfIntegerToEven_64(double)’:
>> /home/andrey/local/src/ITK/Code/Common/itkMathDetail.h:280: error:
>> ‘_mm_cvtsd_si64’ was not declared in this scope
>>
> -------------------------------------------------------------
>
>
> The reason why you are seeing these errors
> is that the "SSE" capabilities of the machine
> are being tests with a "TRY_COMPILE", at
> configuration time, in your case, in the first
> run of ccmake.
>
> However, to be consistent with your "32-bits"
> build, those try-compiles should be aware
> that you are building for that 32-bits platform.
>
> The way to inform CMake of that fact, is by
> setting the variable:
>
>          CMAKE_REQUIRED_FLAGS
>
> to include the "-m32" flag as well, such as in:
>
> -DCMAKE_REQUIRED_FLAGS:STRING=-m32
>
>
> In this way, the TRY_COMPILES will be made
> aware that they should evaluate the characteristics
> of the system as a 32-bits machine.
>
>
> Otherwise, the try_compiles are made "for your
> 64-bits" machine, and then the results are applied
> to you "32-bits build" obviously resulting in conflicts.
>
>
>
>     Luis
>
>
> ---------------------------------------------------
>> thanks
>>
>> --
>> Andriy Fedorov, Ph.D.
>>
>> Research Fellow
>> Brigham and Women's Hospital
>> Harvard Medical School
>> 75 Francis Street
>> Boston, MA 02115 USA
>> fedorov at bwh.harvard.edu
>> (617) 525-6258 (office)
>> _____________________________________
>


More information about the Insight-users mailing list