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

Bill Lorensen bill.lorensen at gmail.com
Fri Dec 21 12:52:43 EST 2007


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 <http://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/2c2d3a40/attachment.htm


More information about the Insight-developers mailing list