[vtk-developers] uintptr_t redefinition issues when building vtkFiltersStatisticsGnuR

Atri Bhattacharya badshah400 at aim.com
Wed Aug 10 09:55:45 EDT 2016


Hi!
I am trying to build and provide VTK 7.0 packages for openSUSE [1].
Unfortunately, the builds for non-x86_64 architectures fail because of
the following reason:

The file Filters/StatisticsGnuR/vtkRInterface.cxx #includes stdint.h
for the data type uintptr_t before it includes the Rinterface.h header.
The latter also defines the uintptr_t data type (line#105):

#if !defined(HAVE_UINTPTR_T) && !defined(uintptr_t)
 typedef unsigned long uintptr_t;
#endif

Unfortunately, since nothing sets the HAVE_UINTPTR_T macro (and
uintptr_t is a data type not a macro) before compilation, Rinterface.h
ends up redefining the data type, leading to compile errors when there
is a mismatch in the redefinition (e.g., on i386, stdint.h defines
uintptr_t as unsigned int). The attached patch here defines the macro
HAVE_UINTPTR_T in the
Filters/StatisticsGnuR/vtkFiltersStatisticsGnuRConfigure.h
file, which prevents Rinterface.h from redefining the data type in the
scenario that uintptr_t symbol already exists. Please consider using
this patch to fix the problem. I am willing to make modifications to
the patch if you have any suggestions, or if you have a suggestion to
fix this in a better way, please let me know too.

Thanks a lot for your consideration and in general for VTK.

[1] https://build.opensuse.org/package/show/science/vtk
    The x86_64 build failure for openSUSE_Tumbleweed is due to a
    cmake issue that we have already fixed separately.

-- 
Atri Bhattacharya
Wed 10 Aug 15:24:57 CEST 2016

Patch follows:
Index: VTK-7.0.0/Filters/StatisticsGnuR/CMakeLists.txt
===================================================================
--- VTK-7.0.0.orig/Filters/StatisticsGnuR/CMakeLists.txt
+++ VTK-7.0.0/Filters/StatisticsGnuR/CMakeLists.txt
@@ -16,6 +16,10 @@ include_directories(${R_INCLUDE_DIR})
 
 add_definitions(-DVTK_BUILDING_FILTERS_STATISTICSGNUR)
 
+# Check for the existance of uintptr_t type and set the HAVE_UINTPTR_T macro
+include(CheckTypeSize)
+CHECK_TYPE_SIZE(uintptr_t UINTPTR_T)
+
 # Configure the module specific settings into a module configured header.
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/vtkFiltersStatisticsGnuRConfigure.h.in
   ${CMAKE_CURRENT_BINARY_DIR}/vtkFiltersStatisticsGnuRConfigure.h)
Index: VTK-7.0.0/Filters/StatisticsGnuR/vtkFiltersStatisticsGnuRConfigure.h.in
===================================================================
--- VTK-7.0.0.orig/Filters/StatisticsGnuR/vtkFiltersStatisticsGnuRConfigure.h.in
+++ VTK-7.0.0/Filters/StatisticsGnuR/vtkFiltersStatisticsGnuRConfigure.h.in
@@ -17,5 +17,6 @@
 #define vtkFiltersStatisticsGnuRConfigure_h
 
 #define VTK_R_HOME "@R_HOME@"
+#cmakedefine HAVE_UINTPTR_T
 
 #endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vtk-Rinterface-uintptr_t.patch
Type: text/x-patch
Size: 658 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160810/dda33b48/attachment-0001.bin>


More information about the vtk-developers mailing list