Bug 985386 - GCC6: vtk fails to build
GCC6: vtk fails to build
Status: RESOLVED FIXED
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Other
Current
Other Other
: P5 - None : Normal (vote)
: ---
Assigned To: Atri Bhattacharya
E-mail List
:
Depends on:
Blocks: 984984
  Show dependency treegraph
 
Reported: 2016-06-17 09:53 UTC by Dominique Leuenberger
Modified: 2016-08-18 13:40 UTC (History)
3 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominique Leuenberger 2016-06-17 09:53:03 UTC
Since the update to GCC6, openSUSE:Factory/vtk fails to build
Comment 1 Marguerite Su 2016-06-23 11:03:57 UTC
[ 2764s] In file included from /home/abuild/rpmbuild/BUILD/VTK-7.0.0/Filters/StatisticsGnuR/vtkRInterface.cxx:50:0:
[ 2764s] /usr/lib/R/include/Rinterface.h:106:24: error: conflicting declaration 'typedef long unsigned int uintptr_t'
[ 2764s]   typedef unsigned long uintptr_t;
[ 2764s]                         ^~~~~~~~~
[ 2764s] In file included from /usr/lib/gcc/i586-suse-linux/6/include/stdint.h:9:0,
[ 2764s]                  from /usr/include/c++/6/cstdint:41,
[ 2764s]                  from /usr/include/c++/6/bits/char_traits.h:420,
[ 2764s]                  from /usr/include/c++/6/ios:40,
[ 2764s]                  from /usr/include/c++/6/ostream:38,
[ 2764s]                  from /usr/include/c++/6/iostream:39,
[ 2764s]                  from /home/abuild/rpmbuild/BUILD/VTK-7.0.0/Common/Core/vtkIOStream.h:28,
[ 2764s]                  from /home/abuild/rpmbuild/BUILD/VTK-7.0.0/Common/Core/vtkSystemIncludes.h:36,
[ 2764s]                  from /home/abuild/rpmbuild/BUILD/VTK-7.0.0/Common/Core/vtkIndent.h:25,
[ 2764s]                  from /home/abuild/rpmbuild/BUILD/VTK-7.0.0/Common/Core/vtkObjectBase.h:44,
[ 2764s]                  from /home/abuild/rpmbuild/BUILD/VTK-7.0.0/Common/Core/vtkObject.h:42,
[ 2764s]                  from /home/abuild/rpmbuild/BUILD/VTK-7.0.0/Filters/StatisticsGnuR/vtkRInterface.h:43,
[ 2764s]                  from /home/abuild/rpmbuild/BUILD/VTK-7.0.0/Filters/StatisticsGnuR/vtkRInterface.cxx:21:
[ 2764s] /usr/include/stdint.h:128:23: note: previous declaration as 'typedef unsigned int uintptr_t'
[ 2764s]  typedef unsigned int  uintptr_t;
[ 2764s]                        ^~~~~~~~~

It's not a bug of VTK but R-base.
Comment 2 Marguerite Su 2016-06-23 12:31:27 UTC
Hi, Detlef,

Can you please look at this bug?

looks to me that stdint.h from glibc-devel defined a different typedef of uintptr_t (unsigned int)
with the typedef in R/include/Rinterface.h.

In x86_64, int and long and indentical, but in ix86, there're not the same.

I think a simple patch in R-base will resolve this.

Marguerite
Comment 3 Detlef Steuer 2016-06-23 12:43:55 UTC
Thx for reporting! Have sent question to upstream.
Comment 4 Atri Bhattacharya 2016-08-08 16:59:20 UTC
(In reply to Detlef Steuer from comment #3)
> Thx for reporting! Have sent question to upstream.

Any progress? vtk still fails on Factory/i586
Comment 5 Detlef Steuer 2016-08-09 13:15:48 UTC
(In reply to Atri Bhattacharya from comment #4)
> (In reply to Detlef Steuer from comment #3)
> > Thx for reporting! Have sent question to upstream.
> 
> Any progress? vtk still fails on Factory/i586

There are two points I got from discussions:
1. The toolchain change to gcc6 is a major point for R and
   therefore happens only in R-devel. Transistion to gcc6 is not 
   complete right now. Current versions of R (3.3.1) won´t get 
   special treatment for gcc6. (-released/-patched)

2. Concerning this bug the status seems to be (from some discussion)

----------------
AFAICT it's not about R sources not compiling. Rather, SUSE has a failed build of

VTK-7.0.0/Filters/StatisticsGnuR/vtkRInterface.cxx

which is presumably an interface to R using the embedding API.

This #includes Rinterface.h, which contains

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

which conflicts with a previous typedef of uintptr_t. The !defined(uintptr_t) bit will not catch it because typedefs are not macros, so HAVE_UINTPTR_T is the only vehicle for telling the compiler about the previous definition. 

For standalone R, it looks like configure works out the setting of HAVE_UINTPTR_T, but it's not setting it for embedded R uses. Presumably that is for a reason - the embedder might not be using the same compilers, e.g.

According to R/doc/manual/R-exts.texi (= the manual "Writing R Extensions"), 
for embedded R

"
Note that @code{uintptr_t} is a C99 type for which a substitute is
defined in @R{}, so your code needs to define @code{HAVE_UINTPTR_T}
appropriately.
"

Notice "your code". In short, this seems to be is an application error that needs to be fixed downstreams.
-----------------------------------------------------------------

The last two lines for me seem relevant for the current problems in VTK.
Hope that helps a bit.
Comment 6 Atri Bhattacharya 2016-08-10 04:25:10 UTC
Thanks Detlef,
I figured as much, and managed to fix this on vtk's side by using the following patch:

Index: VTK-7.0.0/Filters/StatisticsGnuR/vtkRInterface.cxx
===================================================================
--- VTK-7.0.0.orig/Filters/StatisticsGnuR/vtkRInterface.cxx
+++ VTK-7.0.0/Filters/StatisticsGnuR/vtkRInterface.cxx
@@ -44,6 +47,11 @@ vtkStandardNewMacro(vtkRInterface);
 #ifndef WIN32
 #define CSTACK_DEFNS
 #define R_INTERFACE_PTRS
+// uintptr_t is already a defined datatype in stdint.h.
+// Rinterface.h also defines when the HAVE_UINTPTR_T macro is undefined.
+// Prevent redefinition of uintptr_t by explicitly defining HAVE_UINTPTR_T
+// before calling Rinterface.h.
+#define HAVE_UINTPTR_T
 #include "Rinterface.h"
 #endif
Comment 7 Dominique Leuenberger 2016-08-18 13:40:03 UTC
this has been fixed by sr#419080