Bug 16767 - R incorrectly assumes __SUNPRO_CC == stlport in .../src/include/R_ext/Print.h
Summary: R incorrectly assumes __SUNPRO_CC == stlport in .../src/include/R_ext/Print.h
Status: UNCONFIRMED
Alias: None
Product: R
Classification: Unclassified
Component: System-specific (show other bugs)
Version: R 3.2.3
Hardware: All Solaris
: P5 normal
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2016-03-16 13:36 UTC by Rich Burridge
Modified: 2016-03-16 13:36 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rich Burridge 2016-03-16 13:36:45 UTC
In trying to install the pcaPP R package on Solaris 12 with the latest
Studio 12.5 compiler (S12 build #93, R version 3.2.3), I see the
following compilation problem:

$ /ws/cia/builds/dodona/latest/intel-S2/bin/CC '-std=c++11'
-I/usr/lib/amd64/R/include -DNDEBUG -DR_PACKAGE_FILE -m64 -KPIC -m64
'-std=c++11' -D__MATHERR_RENAME_EXCEPTION -c R_meal.cpp -o R_meal.o
"/usr/lib/amd64/R/include/R_ext/Print.h", line 31: Error: _STLP_VENDOR_CSTD
is not defined.
1 Error(s) detected.

The GNU 5.3 g++ compiles this just fine:
$ /usr/gcc/5.3/bin/g++ -I/usr/lib/amd64/R/include -DNDEBUG -DR_PACKAGE_FILE
-m64 -DPIC -c R_meal.cpp -o R_meal.o 

The failure is because of the following code in
/usr/lib/amd64/R/include/R_ext/Print.h

...
#ifdef  __cplusplus
/* If the vprintf interface is defined at all in C++ it may only be
   defined in namespace std. */
# ifdef R_USE_C99_IN_CXX
#  include <cstdarg>
#  ifdef __SUNPRO_CC
using _STLP_VENDOR_CSTD::va_list;
#  endif
# endif
extern "C" {
#else
# include <stdarg.h>
#endif
... 

This makes the assumption that __SUNPRO_CC == stlport, which is wrong
in the way we deliver R in Solaris 12.

One of our C++ compiler wonks suggested a better way to write this code:

  $ diff /usr/lib/amd64/R/include/R_ext/Print.h
  /home/fsergeev/worki/bugs/evaluation/build-R/include/R_ext/Print.h
  30c30
  < #  ifdef __SUNPRO_CC
  ---
  > #  if defined(__SUNPRO_CC) && defined(_STLP_VENDOR_CSTD) 

  And compilation now passes.