# HG changeset patch # User Rich Burridge # Date 1461777123 25200 # Node ID cf951496fb3ab0786210b0c74226c0c78c870c1f # Parent 243e80c77b4aee70b3344a74af9228050ce725e7 23076632 The fix for 22976223 needs a little more work diff -r 243e80c77b4a -r cf951496fb3a components/r/Makefile --- a/components/r/Makefile Wed Apr 27 00:40:44 2016 -0700 +++ b/components/r/Makefile Wed Apr 27 10:12:03 2016 -0700 @@ -44,14 +44,6 @@ COMPONENT_PRE_CONFIGURE_ACTION = \ ($(CLONEY) $(SOURCE_DIR) $(@D)) -# Get rid of compiler path set in RUNPATH -LDFLAGS += $(studio_NORUNPATH) - -LDFLAGS += $(CC_BITS) - -LDFLAGS += $(studio_PIC) -LDFLAGS += $(LD_DEF_LIBS) - STUDIO_LIBS_PATH = $(USRLIBDIR)/studio/64 # R_LIBS_PATH is used when creating /usr/lib/64/R/etc/Makeconf # Using a resolved pathname here (rather than say $(USRLIBDIR64)/R/lib) so @@ -60,57 +52,57 @@ R_LIBS_PATH = /usr/lib/64/R/lib JAVA_LIBS_PATH = $(JAVA8_HOME)/jre/lib/$(MACH64)/server +LDFLAGS += $(CC_BITS) LDFLAGS += -L$(STUDIO_LIBS_PATH) -R$(STUDIO_LIBS_PATH) \ -lsunperf -lfsu -lmtsk -lpicl -lkstat +LDFLAGS += -L$(R_LIBS_PATH) -R$(R_LIBS_PATH) -# Augment the PATH and set CC/CXX/F95 such that the build environment doesn't +# Augment the PATH and set CC/CXX/FC/F77 such that the build environment doesn't # leak into usr/lib/64/etc/Makeconf and force consumers to have a setup like # our build environment to build R modules. -export PATH=$(SPRO_VROOT)/bin:$(USRBINDIR):$(GNUBIN) -CC = cc -CXX = CC -F95 = f95 +export PATH=$(GCC_ROOT)/bin:$(USRBINDIR):$(GNUBIN) +CC = gcc +CXX = g++ +FC = gfortran +F77 = gfortran ifeq ($(strip $(PARFAIT_BUILD)),yes) export PATH=$(PARFAIT_TOOLS):$(SPRO_VROOT)/bin:$(USRBINDIR):$(GNUBIN) endif - -CONFIGURE_ENV += F77="$(F95) $(CC_BITS)" -CONFIGURE_ENV += FC="$(F95) $(CC_BITS)" +# We can't use $(CC_PIC) here (which provides "-fPIC -DPIC" for the GNU +# compilers), because we fail at configure time with: +# configure: error: Building R requires the 'va_copy' system call +# .../make-rules/configure.mk:170: recipe for target +# '.../components/r/build/amd64/.configured' failed +R_PIC = -fPIC -# For now, R is built with a very specific set of optimization flags to match -# Oracle-provided builds. These should be re-evaluated when upgrading to -# Studio 12.5 or later or when next upgrading R. -studio_OPT= -xO3 -studio_XBITS= -studio_XREGS= -studio_IROPTS= -studio_C99MODE= $(studio_C99_ENABLE) -studio_ALIGN= -studio_MT= +# These CONFIGURE_ENV lines are here so that /usr/lib/64/R/etc/Makeconf (the +# configuration file used when building/installing the R CRAN packages), +# is in exactly the correct format to work properly with the GNU compilers for +# all the R CRAN packages containing C, C++, Fortran or Java code. +CONFIGURE_ENV += CC="$(CC) -std=gnu99 $(CC_BITS)" +CONFIGURE_ENV += CXX="$(CXX) $(CC_BITS)" +CONFIGURE_ENV += FC="$(FC) $(CC_BITS)" +CONFIGURE_ENV += F77="$(F77) $(CC_BITS)" -CFLAGS.studio += -xlibmieee -CXXFLAGS += -std=c++11 -# We (the Userland) team don't need -D__MATHERR_RENAME_EXCEPTION for the -# creation of the R packages we provide in Solaris. It would be needed by -# our customers that try to install R packages that use C++. And they would -# be using the version of the Studio compilers on their machine(s) to do this. -# Studio 12.5 will hopefully automatically provide this definition when C++ -# code is compiled with "-std=c++11". When that version of the Studio -# compilers is released, we should encourage customers to install it, but -# for those still using Studio 12.4, this definition will continue to be needed. -CXXFLAGS += -D__MATHERR_RENAME_EXCEPTION -LDFLAGS += -L$(R_LIBS_PATH) -R$(R_LIBS_PATH) +CONFIGURE_ENV += C_VISIBILITY="-fvisibility=hidden" +CONFIGURE_ENV += CFLAGS="-g -O2 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2" +CONFIGURE_ENV += CPICFLAGS="$(R_PIC)" -CONFIGURE_ENV += CPICFLAGS="$(studio_PIC)" -CONFIGURE_ENV += FPICFLAGS="$(studio_PIC)" -CONFIGURE_ENV += FFLAGS="$(studio_OPT) $(CC_BITS)" -CONFIGURE_ENV += FCFLAGS="$(studio_OPT) $(CC_BITS)" +CONFIGURE_ENV += CXXFLAGS="$(CC_BITS) -g -O2 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2" +CONFIGURE_ENV += CXXPICFLAGS="$(R_PIC)" +CONFIGURE_ENV += CXX1X="g++" +CONFIGURE_ENV += CXX1XFLAGS="$(CC_BITS) -g -O2 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2" +CONFIGURE_ENV += CXX1XPICFLAGS="$(R_PIC)" +CONFIGURE_ENV += CXX1XSTD="-std=c++11" + +CONFIGURE_ENV += FCFLAGS="-g -O2 $(CC_BITS)" +CONFIGURE_ENV += F77_VISIBILITY="-fvisibility=hidden" +CONFIGURE_ENV += FFLAGS="-g -O2 $(CC_BITS)" CONFIGURE_ENV += FCLIBS="-lsunperf -lfsu -lsunmath" -CONFIGURE_ENV += FLIBS="-lsunperf -lfsu -lsunmath" -# Needed so that R packages using C++ code can link against the standard -# C++ libraries. -CONFIGURE_ENV += SHLIB_CXXLDFLAGS="-lCrunG3" +CONFIGURE_ENV += FLIBS="-lsunperf -lfsu -lsunmath -lgfortran -lm" +CONFIGURE_ENV += FCPICFLAGS="$(R_PIC)" +CONFIGURE_ENV += FPICFLAGS="$(R_PIC)" # Set the various Java variables otherwise it auto-detects the 32-bit ones. CONFIGURE_ENV += JAVA_CPPFLAGS="-I$(JAVA8_HOME)/jre/../include -I$(JAVA8_HOME)/jre/../include/solaris" @@ -130,16 +122,6 @@ CONFIGURE_OPTIONS += --with-tcltk CONFIGURE_OPTIONS += --enable-prebuilt-html -# Supply Makeconf files for both the Studio and the GNU C, C++ and Fortran -# compilers. -COMPONENT_POST_INSTALL_ACTION += \ - $(MV) $(PROTOUSRLIBDIR64)/R/etc/Makeconf \ - $(PROTOUSRLIBDIR64)/R/etc/Makeconf.Studio ; \ - $(CP) $(PROTOUSRLIBDIR64)/R/etc/Makeconf.Studio \ - $(PROTOUSRLIBDIR64)/R/etc/Makeconf.GNU ; \ - (cd $(PROTOUSRLIBDIR64)/R/etc ; $(GPATCH) --strip=0 \ - < $(COMPONENT_DIR)/files/Makeconf-GNU.patch) ; - COMPONENT_PRE_TEST_ACTION = \ $(RM) $(BUILD_DIR_64)/tests/Examples/*.prev @@ -183,7 +165,7 @@ REQUIRED_PACKAGES += library/readline REQUIRED_PACKAGES += library/zlib REQUIRED_PACKAGES += shell/bash -REQUIRED_PACKAGES += system/library/fortran-runtime +REQUIRED_PACKAGES += system/library/gcc/gcc-c-runtime REQUIRED_PACKAGES += system/library/iconv REQUIRED_PACKAGES += system/library/math REQUIRED_PACKAGES += system/library/sunperf diff -r 243e80c77b4a -r cf951496fb3a components/r/files/Makeconf-GNU.patch --- a/components/r/files/Makeconf-GNU.patch Wed Apr 27 00:40:44 2016 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -Changes to the /usr/lib/64/R/etc/Makeconf file to use the -GNU C, C++ and Fortran compilers. These are applied to the -Makeconf file in the prototype build area as a post install -action in the Makefile. - ---- Makeconf.GNU.orig 2016-03-30 18:48:11.403166611 -0700 -+++ Makeconf.GNU 2016-03-30 18:53:12.985544279 -0700 -@@ -13,38 +13,38 @@ - ## Used by packages 'maps' and 'mapdata' - AWK = gawk - BLAS_LIBS = -lsunperf --C_VISIBILITY = --CC = cc --CFLAGS = -m64 -xO3 -xc99=all -xlibmieee $(LTO) --CPICFLAGS = -KPIC -DPIC -+C_VISIBILITY = -fvisibility=hidden -+CC = gcc -std=gnu99 -+CFLAGS = -g -O2 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 $(LTO) -+CPICFLAGS = -fpic - CPPFLAGS = -m64 --CXX = CC -+CXX = g++ - CXXCPP = $(CXX) -E --CXXFLAGS = -norunpath -m64 -xO3 -std=c++11 -D__MATHERR_RENAME_EXCEPTION $(LTO) --CXXPICFLAGS = -KPIC --CXX1X = CC --CXX1XFLAGS = -norunpath -m64 -xO3 -std=c++11 -D__MATHERR_RENAME_EXCEPTION --CXX1XPICFLAGS = -KPIC --CXX1XSTD = -+CXXFLAGS = -m64 -g -O2 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 $(LTO) -+CXXPICFLAGS = -fpic -+CXX1X = g++ -+CXX1XFLAGS = -m64 -g -O2 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -+CXX1XPICFLAGS = -fpic -+CXX1XSTD = -std=c++11 - DYLIB_EXT = .so - DYLIB_LD = $(CC) --DYLIB_LDFLAGS = -G -fopenmp# $(CFLAGS) $(CPICFLAGS) -+DYLIB_LDFLAGS = -shared -fopenmp# $(CFLAGS) $(CPICFLAGS) - DYLIB_LINK = $(DYLIB_LD) $(DYLIB_LDFLAGS) $(LDFLAGS) - ECHO = echo - ECHO_C = \c - ECHO_N = - ECHO_T = - ## NB, set FC before F77 as on Solaris make, setting FC sets F77 --FC = f95 -m64 --FCFLAGS = -xO3 -m64 $(LTO) -+FC = gfortran -m64 -+FCFLAGS = -g -O2 -m64 $(LTO) - ## additional libs needed when linking with $(FC), e.g. on Solaris - FCLIBS = -lsunperf -lfsu -lsunmath --F77 = f95 -m64 --F77_VISIBILITY = --FFLAGS = -xO3 -m64 $(LTO) --FLIBS = -lsunperf -lfsu -lsunmath --FCPICFLAGS = -PIC --FPICFLAGS = -KPIC -DPIC -+F77 = gfortran -m64 -+F77_VISIBILITY = -fvisibility=hidden -+FFLAGS = -g -O2 -m64 $(LTO) -+FLIBS = -lsunperf -lfsu -lsunmath -lgfortran -lm -lquadmath -+FCPICFLAGS = -fpic -+FPICFLAGS = -fpic - FOUNDATION_CPPFLAGS = - FOUNDATION_LIBS = - JAR = /usr/bin/jar -@@ -68,11 +68,11 @@ - ## needed by R CMD config - LIBnn = lib - LIBTOOL = $(SHELL) "$(R_HOME)/bin/libtool" --LDFLAGS = -norunpath -m64 -KPIC -DPIC -lc -L/usr/lib/studio/64 -R/usr/lib/studio/64 -lsunperf -lfsu -lmtsk -lpicl -lkstat -L/usr/lib/64/R/lib -R/usr/lib/64/R/lib -+LDFLAGS = -m64 -fpic -lc -L/usr/lib/studio/64 -R/usr/lib/studio/64 -lsunperf -lfsu -lmtsk -lpicl -lkstat -L/usr/lib/64/R/lib -R/usr/lib/64/R/lib - LTO = - ## needed to build applications linking to static libR - MAIN_LD = $(CC) --MAIN_LDFLAGS = -fopenmp -+MAIN_LDFLAGS = -Wl,--export-dynamic -fopenmp - MAIN_LINK = $(MAIN_LD) $(MAIN_LDFLAGS) $(LDFLAGS) - MKINSTALLDIRS = $(R_HOME)/bin/mkinstalldirs - OBJC = gcc -@@ -81,21 +81,21 @@ - OBJCXX = - R_ARCH = - RANLIB = ranlib --SAFE_FFLAGS = -xO3 -m64 -+SAFE_FFLAGS = -g -O2 -m64 -ffloat-store - SED = /usr/xpg4/bin/sed - SHELL = /bin/bash - SHLIB_CFLAGS = - SHLIB_CXXFLAGS = - SHLIB_CXXLD = $(CXX) --SHLIB_CXXLDFLAGS = -lCrunG3 -G -+SHLIB_CXXLDFLAGS = -shared - SHLIB_CXX1XLD = $(CXX1X) $(CXX1XSTD) --SHLIB_CXX1XLDFLAGS = -lCrunG3 -G -+SHLIB_CXX1XLDFLAGS = -shared - SHLIB_EXT = .so - SHLIB_FCLD = $(FC) --SHLIB_FCLDFLAGS = -G -+SHLIB_FCLDFLAGS = -shared - SHLIB_FFLAGS = - SHLIB_LD = $(CC) --SHLIB_LDFLAGS = -G# $(CFLAGS) $(CPICFLAGS) -+SHLIB_LDFLAGS = -shared# $(CFLAGS) $(CPICFLAGS) - SHLIB_LIBADD = - ## We want to ensure libR is picked up from $(R_HOME)/lib - ## before e.g. /usr/local/lib if a version is already installed. diff -r 243e80c77b4a -r cf951496fb3a components/r/patches/03-fix-studio-stdport.patch --- a/components/r/patches/03-fix-studio-stdport.patch Wed Apr 27 00:40:44 2016 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -The /usr/lib/64/R/include/R_ext/Print.h makes the assumption that -__SUNPRO_CC == stlport which is incorrect in the way we deliver R in -the version that's in Solaris. - -This problem has been reported upstream at: -https://bugs.r-project.org/bugzilla/show_bug.cgi?id=16767 - ---- R-3.2.3/src/include/R_ext/Print.h.orig 2016-03-16 06:31:42.210416076 -0700 -+++ R-3.2.3/src/include/R_ext/Print.h 2016-03-16 06:52:39.625133958 -0700 -@@ -27,7 +27,7 @@ - defined in namespace std. */ - # ifdef R_USE_C99_IN_CXX - # include --# ifdef __SUNPRO_CC -+# if defined(__SUNPRO_CC) && defined(_STLP_VENDOR_CSTD) - using _STLP_VENDOR_CSTD::va_list; - # endif - # endif diff -r 243e80c77b4a -r cf951496fb3a components/r/r.p5m --- a/components/r/r.p5m Wed Apr 27 00:40:44 2016 -0700 +++ b/components/r/r.p5m Wed Apr 27 10:12:03 2016 -0700 @@ -103,9 +103,7 @@ file path=usr/lib/$(MACH64)/R/doc/manual/images/fig12.png file path=usr/lib/$(MACH64)/R/doc/manual/images/hist.png file path=usr/lib/$(MACH64)/R/doc/manual/images/ice.png -link path=usr/lib/$(MACH64)/R/etc/Makeconf target=Makeconf.GNU -file path=usr/lib/$(MACH64)/R/etc/Makeconf.GNU -file path=usr/lib/$(MACH64)/R/etc/Makeconf.Studio +file path=usr/lib/$(MACH64)/R/etc/Makeconf file path=usr/lib/$(MACH64)/R/etc/Renviron file path=usr/lib/$(MACH64)/R/etc/javaconf file path=usr/lib/$(MACH64)/R/etc/ldpaths diff -r 243e80c77b4a -r cf951496fb3a components/r/test/results-all.master --- a/components/r/test/results-all.master Wed Apr 27 00:40:44 2016 -0700 +++ b/components/r/test/results-all.master Wed Apr 27 10:12:03 2016 -0700 @@ -7,7 +7,7 @@ Testing examples for package 'graphics' comparing 'graphics-Ex.Rout' to 'graphics-Ex.Rout.save' ... OK Testing examples for package 'stats' - comparing 'stats-Ex.Rout' to 'stats-Ex.Rout.save' ... + comparing 'stats-Ex.Rout' to 'stats-Ex.Rout.save' ... OK Testing examples for package 'datasets' comparing 'datasets-Ex.Rout' to 'datasets-Ex.Rout.save' ... OK Testing examples for package 'methods'