[Insight-users] Cannot build ITK for MAC OS X Tiger 64 bit
Sean McBride
sean at rogue-research.com
Thu Jul 19 16:24:28 EDT 2007
On 7/19/07 12:26 PM, Alex Lisovich said:
>It seems it's not possible to compile CableSwig in 64 bit mode on Mac
>by definition.
>The error ioccurs in ../GCC/gcc/real.h of CableSwig:
>
>"error: size of array 'test_real_width' is negative"
>
>The source of the error is in the file ../GCC/gcc/auto-host.h in
>CableSwig build directory which is generated automatically by CMake.
>There is a definition in this file for the size of a long type:
>
>/* The number of bytes in type long */
>#define SIZEOF_LONG 4
>
>which naturally leads to the compilation failure above for 64 bits.
>When I changed the SIZEOF_LONG to 8, CableSwig compiled fine. The
>problem is, this file is generated at the very beginning of ccmake
>session (after your hit "configure" the first time), when there is no
>means to specify the architecture! This looks like a serious Mac
>specific problem to me (Windows is OK because of using long longs),
>which will persist for any future version of OS X unless fixed at
>CMake logic level. Is there any way to easily fix it now without
>manual editing of auto-host.h?
This is a separate problem right? Not related the the link errors we
were discussing?
This kind of thing (detecting the size of primitive types) is
problematic, especially for Universal Binaries and cross compilation in
general. Hopefully, CMake will one day have better support for cross
compilation. I don't know what CableSwig is, but in VTK we have done
hacks like this:
/* Size of fundamental data types. */
/* Mac OS X uses two data models, ILP32 (in which integers, long integers,
and pointers are 32-bit quantities) and LP64 (in which integers are 32-bit
quantities and long integers and pointers are 64-bit quantities). In order
to support Universal Binaries on Mac OS X, we rely on this knowledge
instead of testing the sizes of the building machine.
On other platforms we use the result of the TRY_RUN. */
#if !defined(__APPLE__)
# define VTK_SIZEOF_CHAR @VTK_SIZEOF_CHAR@
# define VTK_SIZEOF_SHORT @VTK_SIZEOF_SHORT@
# define VTK_SIZEOF_INT @VTK_SIZEOF_INT@
# define VTK_SIZEOF_LONG @VTK_SIZEOF_LONG@
# define VTK_SIZEOF_FLOAT @VTK_SIZEOF_FLOAT@
# define VTK_SIZEOF_DOUBLE @VTK_SIZEOF_DOUBLE@
#else
# define VTK_SIZEOF_CHAR 1
# define VTK_SIZEOF_SHORT 2
# define VTK_SIZEOF_INT 4
# if defined(__LP64__) && __LP64__
# define VTK_SIZEOF_LONG 8
# else
# define VTK_SIZEOF_LONG 4
# endif
# define VTK_SIZEOF_FLOAT 4
# define VTK_SIZEOF_DOUBLE 8
#endif
Maybe you can do something similar?
--
____________________________________________________________
Sean McBride, B. Eng sean at rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
More information about the Insight-users
mailing list