Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add R 3.6.0 #20

Merged
merged 3 commits into from
Apr 29, 2019
Merged

Add R 3.6.0 #20

merged 3 commits into from
Apr 29, 2019

Conversation

glin
Copy link
Collaborator

@glin glin commented Apr 26, 2019

This was pretty straightforward, except for CentOS 6 (!!). Packages with C++11 code couldn't be installed:

+ R CMD INSTALL /test/testpkg --clean
* installing to library '/opt/R/3.6.0/lib/R/library'
* installing *source* package 'testpkg' ...
** using staged installation
** libs
Error in .shlib_internal(args) :
  C++11 standard requested but CXX11 is not defined
* removing '/opt/R/3.6.0/lib/R/library/testpkg'
Makefile:31: recipe for target 'test-3.6-centos6' failed
make: *** [test-3.6-centos6] Error 1

In previous versions of R (3.4, 3.5), this CXX11 Make variable was set to CXX11 = g++ in the $R_HOME/etc/Makeconf file. Since R 3.6.0, I think this is no longer set if the C++ compiler used to compile R doesn't support C++11.

The options selected for the C++ compiler default to the C++11 standard if supported, otherwise to the C++98 standard.
https://cran.r-project.org/doc/manuals/r-devel/NEWS.html

For the use of C++11 and later in R packages see the ‘Writing R Extensions’ manual. Currently the default C++ standard is that of the compiler used: from R 3.6.0 it will be C++11 if supported by the compiler.
https://cran.r-project.org/doc/manuals/R-admin.html#C_002b_002b-Support


We could compile R on CentOS 6 with the newer C++ compiler instead, but I think it'd be better to just add the proper configuration variables here. I've added a CentOS 6 specific Dockerfile template that sets these in the system-wide $R_HOME/etc/Makevars.site. The values were copied from the defaults on CentOS 7, and similar to what others have recommended. The tests pass now, but I think we should try building CRAN on 3.6-centos6 to truly test it later.

# CXX11 Make variables

# 3.6-centos6
$ docker run --rm rstudio/r-base:3.6-centos6 cat $(R RHOME)/etc/Makeconf | grep CXX11
CXX11 = 
CXX11FLAGS =  $(LTO)
CXX11PICFLAGS = 
CXX11STD = 
SHLIB_CXX11LD = $(CXX11) $(CXX11STD)
SHLIB_CXX11LDFLAGS = -shared

# 3.6-centos7
$ docker run --rm rstudio/r-base:3.6-centos7 cat $(R RHOME)/etc/Makeconf | grep CXX11
CXX11 = g++
CXX11FLAGS = -g -O2 $(LTO)
CXX11PICFLAGS = -fpic
CXX11STD = -std=gnu++11
SHLIB_CXX11LD = $(CXX11) $(CXX11STD)
SHLIB_CXX11LDFLAGS = -shared

References

glin added 3 commits April 26, 2019 18:25
Starting from R 3.6.0, the CXX11 Make variables aren't set if R was compiled
without a C++11 compiler. This prevents packages with C++11 code from
installing even though we've installed a C++11 compiler. Set these variables
manually in the system-wide Makevars.site.
@glin glin requested a review from jonyoder April 26, 2019 23:50
@glin glin merged commit 96c86c5 into master Apr 29, 2019
@glin glin deleted the 3.6 branch April 29, 2019 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants