[Insight-developers] 32/64 bits universal builds cause itk test failures.

Bill Lorensen bill.lorensen at gmail.com
Fri Dec 21 15:07:15 EST 2007


Now I see. Both builds are controlled with one cmakelists file.

I don't understand your  last comment. "However, Nrrd seems to expect that
TEEM_32BIT is set outside of its library." Where does it expect this? I
don't see it in itk proper.

Bill

On Dec 21, 2007 2:56 PM, Mathieu Coursolle <mcoursolle at rogue-research.com>
wrote:

> Hi,
>
> I may be wrong, but if this flag is set inside the CMakeList file, it
> means that it will be the same for all builds of the universal build
> (32 and 64 bits).
>
> Since the problem is that the TEEM_32BIT flag needs to be 1 in the 32 bits
> part, and 0 in the 64 bits parts, I guess that the flag needs to be set
> outside
> of the CMakeList file.
>
> A solution could be to add the following piece of code somewhere:
>
> #ifdef __APPLE__
> #  ifdef __LP64__
> #    define TEEM_32BIT 0
> #  else
> #    define TEEM_32BIT 1
> #  endif
> #else
>
> // Do the same for non Apple...
>
> #endif
>
> I tried it in NrrdIO/teem32bit.h and it solved 38 of our 42 test
> failures in 64 bits
> (currently testing the 32 bits part).
>
> However, Nrrd seems to expect that TEEM_32BIT is set outside of its
> library.
>
> Any suggestion on where we could do this code?
> In itkConfigure.h.in maybe?
>
> Thanks.
>
> Mathieu
>
> >Mathieu and Sean,
> >
> >Reviving this e-mail to try and fix bug 5904:
> >http://public.kitware.com/Bug/view.php?id=5904
> >
> >Code in Utilities should not depend on itk settings. At least that's my
> >recollection.
> >
> >How about something like this in the Utilities/NrrdIO/CMakeLists.txt:
> >
> >
> >INCLUDE (${CMAKE_ROOT}/Modules/CheckSymbolExists.cmake)
> >CHECK_SYMBOL_EXISTS("__LP64__" "" LP64Exists)
> >
> >IF(APPLE)
> > IF(LP64Exists)
> > ADD_DEFINITIONS(-DTEEM_32BIT=0)
> > ELSE(LP64Exists)
> > ADD_DEFINITIONS(-DTEEM_32BIT=1)
> > ENDIF(LP64Exists)
> >ELSE(APPLE)
> > IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
> > ADD_DEFINITIONS(-DTEEM_32BIT=0)
> > ELSE(CMAKE_SIZEOF_VOID_P MATCHES 8)
> > ADD_DEFINITIONS(-DTEEM_32BIT=1)
> > ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 8)
> >ENDIF(APPLE)
> >
> >There may be typso in the above. Can you try this (or something close to
> it)?
> >
> >Bill
> >
> >
> >
> >On Jul 10, 2007 9:57 AM, Mathieu Coursolle <mcoursolle at rogue-
> >research.com> wrote:
> >Hi ITK developpers,
> >
> >We currently have a private dashboard (OSX) which is doing a universal
> >32 and 64 bits nightly build
> >of ITK. (CMAKE_OSX_ARCHITECTURES = i386; x86_64)
> >
> >However, a lots of ITK tests related to the Nrrd library are failing
> (~40).
> >
> >Our ITK build is both 32 and 64 bits (i386 and x86_64). However, the
> >TEEM_32BIT flag
> >of the Nrrd library is defined according to the size of a void pointer
> >when cmake configures.
> >
> >In the case of a universal 32-64 bits build, that flag cannot be the
> >same for both builds,
> >and therefore needs to depend on something else.
> >
> >We could check in the itkConfigures.h.in for the __LP64__ definition
> >which tells if an apple
> >build is 64 bits:
> >
> >/* 32 or 64 bits. */
> >/* All compilers that support Mac OS X define __LP64__ if the
> architecture is
> > 64 bits. */
> >#if !defined(__APPLE__)
> >#cmakedefine CMAKE_SIZEOF_VOID_P
> >#if CMAKE_SIZEOF_VOID_P == 8
> > #define ITK_32BITS 0
> >#else
> > #define ITK_32BITS 1
> >#endif
> >#elif defined(__LP64__) && __LP64__
> >#define ITK_32BITS 0
> >#else
> >#define ITK_32BITS 1
> >#endif
> >
> >However, in the NrrdIO/CMakeList.txt file, the TEEM_32BIT flag is set
> >as follow:
> >
> >IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
> >ADD_DEFINITIONS(-DTEEM_32BIT=0)
> >ELSE(CMAKE_SIZEOF_VOID_P MATCHES 8)
> >ADD_DEFINITIONS(-DTEEM_32BIT=1)
> >ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 8)
> >
> >Is there a way to set TEEM_32BIT to the value of ITK_32BITS definition
> >at that point?
> >
> >Example:
> >
> ># Set compiler flags for 32 or 64 bit architecture (based on the size
> ># of a void pointer).
> >IF(APPLE)
> >ADD_DEFINITIONS(-DTEEM_32BIT=ITK_32BITS)
> >ELSE(APPLE)
> >IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
> > ADD_DEFINITIONS(-DTEEM_32BIT=0)
> >ELSE(CMAKE_SIZEOF_VOID_P MATCHES 8)
> > ADD_DEFINITIONS(-DTEEM_32BIT=1)
> >ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 8)
> >ENDIF(APPLE)
> >
> >It seems like it is always define as 0 if I do this.
> >
> >Any idea on how this could be solve?
> >
> >Thank you.
> >
> >Mathieu
> >
> >--
> >____________________________________________________________
> >Mathieu Coursolle mcoursolle at rogue-research.com
> >Rogue Research www.rogue-research.com
> >Montréal, Québec, Canada
> >
> >_______________________________________________
> >Insight-developers mailing list
> >Insight-developers at itk.org
> >http://www.itk.org/mailman/listinfo/insight-developers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.itk.org/mailman/private/insight-developers/attachments/20071221/435106c8/attachment.html


More information about the Insight-developers mailing list