[vtk-developers] New build error in 64 bits

Sean McBride sean at rogue-research.com
Mon Jun 18 18:47:36 EDT 2007


On 6/18/07 6:19 PM, Brad King said:

>Sean McBride wrote:
>> We suspect that those vtkTypeFooArray classes are somehow autogenerated,
>> right?  If so, when does that happen?  Our guess is that it only happens
>> once, and thus the problem...
>
>That's correct.  The vtkType*Array classes are generated by
>VTK/Common/CMakeLists.txt to match the type selections in the C++ code.
> The idea is that the Tcl wrappers need to have a real class to wrap
>because they do not understand typedefs, and we want the user to be able
>to write
>
>  vtkTypeInt64Array myarray
>
>in Tcl (or similarly in Python or Java) and get an array with the proper
>scalar size.
>
>The entire design of vtkType* stuff is based on having only one
>architecture per build tree.  It even works for cross-compiling as long
>as the type sizes are configured properly in the CMake cache.  Universal
>binaries create a serious problem here if the different architectures
>can have different type sizes.

They can; and they do.  Actually, between ppc and intel all the
fundamental types are the same size, but between 32 and 64, the size of
void*, long, size_t, and others change.

>We can work around it on the compiler
>level by using the proprocessor appropriately.  Getting the Tcl wrappers
>to behave is a whole new problem.

I guess a workaround is in order.  What we did in vtkConfigure.h.in is
also a hack.  Long-term, it would be nice if VTK was written without the
assumptions that break UBs, but I digress. :)

Perhaps reversing the order of these tests:

IF(VTK_SIZEOF_LONG MATCHES "^8$")
  SET(VTK_TYPE_NATIVE_Int64 Long)
  SET(VTK_TYPE_NATIVE_UInt64 UnsignedLong)
ELSE(VTK_SIZEOF_LONG MATCHES "^8$")
  IF(VTK_SIZEOF_LONG_LONG MATCHES "^8$")
    SET(VTK_TYPE_NATIVE_Int64 LongLong)
    SET(VTK_TYPE_NATIVE_UInt64 UnsignedLongLong)
 <snip>

To first test if 'long long' is 8 bytes, and prefer that as the 64 bit type.

-- 
____________________________________________________________
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 vtk-developers mailing list