[Rd] possible bug in R's configure check for C++11 features

Kasper Daniel Hansen k@@perd@n|e|h@n@en @end|ng |rom gm@||@com
Wed Sep 4 03:02:04 CEST 2019


I am trying to compile R under a new setup, and frankly, I have had a lot
of problems, but I think the stuff below points to a possible bug in R's
(custom) configure checks for C++11/14/17, but not for C++98.

This is a report about R from the R-3-6 branch, with a svn checkout from
today, revision r77135.

In my case the compiler name is x86_64-conda_cos6-linux-gnu-g++, not g++. I
denote this in my configure call, using the CC variable. A snippet of the
full configure is

../${SRCDIR}/configure SHELL='/bin/bash' \
   --prefix="${CONDA_PREFIX}/R/${R_VERSION}" \
   CC="x86_64-conda_cos6-linux-gnu-gcc" \
   CXX="x86_64-conda_cos6-linux-gnu-g++" \
   F77="x86_64-conda_cos6-linux-gnu-gfortran" \
   FC="$F77" \
   CFLAGS="-Wall -mtune=amdfam10 -g -O2 -I${CONDA_PREFIX}/include"\
   CXXFLAGS="-Wall -mtune=amdfam10 -g -O2 -I${CONDA_PREFIX}/include" \
   F77FLAGS="-Wall -g -O2 -mtune=amdfam10 -I${CONDA_PREFIX}/include" \
   CXX11="g++" \
   CXX11STD="-std=c++11" \
   CXX11FLAGS="-Wall -mtune=amdfam10 -g -O2 -I${CONDA_PREFIX}/include" \
   CXX11PICFLAGS="-fPIC" \

Where $CONDA_PREFIX is given in my script.

The output in config.log is given below. Note that in the test for c++98,
it uses the "right" CC, but in the test for c++11 it uses g++. This looks
wrong to me:

configure:28111: checking whether x86_64-conda_cos6-linux-gnu-g++  supports
C++98 features with -std=gnu++98
configure:28130: x86_64-conda_cos6-linux-gnu-g++  -std=gnu++98 -c -Wall
-mtune=amdfam10 -g -O2
-I/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-3.6/include
-fpic -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 conftest.cp
p >&5
configure:28130: $? = 0
configure:28139: result: yes
configure:28315: checking whether g++ -std=c++11 supports C++11 features
configure:28607: g++ -std=c++11 -c -Wall -mtune=amdfam10 -g -O2
-I/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-3.6/include
-fPIC -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 conftest.cpp >&5
../R-3.6-src/configure: line 2355: g++: command not found
configure:28607: $? = 127
configure: failed program was:

I have similar issues (wrong CC using when compiling the test program) with
the test for c++14, whereas the test for c++17 has empty space where the CC
variable should be?

I can fix this issue by adding a soft link in my PATH from g++ to my
compiler of choice. In this case configure finishes and reports that I have
full C++17 capabilities. Weirdly, in the output, note that the C++ compiler
is "wrong" again, despite my configure call:

  Source directory:            ../R-3.6-src
  Installation directory:
 /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-3.6/R/3.6

  C compiler:                  x86_64-conda_cos6-linux-gnu-gcc  -Wall
-mtune=amdfam10 -g -O2
-I/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-3.6/include
  Fortran fixed-form compiler:
/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-3.6/bin/x86_64-conda_cos6-linux-gnu-gfortran
-fno-optimize-sibling-calls -fopenmp -march=nocona -mtune=haswell
-ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2
-ffunction-sections -pipe

  Default C++ compiler:        g++ -std=c++11   -Wall -mtune=amdfam10 -g
-O2 -I/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-3.6/include
  C++98 compiler:              x86_64-conda_cos6-linux-gnu-g++ -std=gnu++98
 -Wall -mtune=amdfam10 -g -O2
-I/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-3.6/include
  C++11 compiler:              g++ -std=c++11   -Wall -mtune=amdfam10 -g
-O2 -I/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-3.6/include
  C++14 compiler:              g++ -std=gnu++14   -Wall -mtune=amdfam10 -g
-O2 -I/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-3.6/include
  C++17 compiler:              g++ -std=gnu++17  -Wall -mtune=amdfam10 -g
-O2 -I/jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-3.6/include
  Fortran free-form compiler:
 /jhpce/shared/jhpce/core/conda/miniconda3-4.6.14/envs/svnR-3.6/bin/x86_64-conda_cos6-linux-gnu-gfortran
-fno-optimize-sibling-calls
  Obj-C compiler:



-- 
Best,
Kasper

	[[alternative HTML version deleted]]



More information about the R-devel mailing list