RcppCore/RcppParallel

Cannot install RccpParallel

ytakemon opened this issue · 9 comments

Hello,

I've tried to install your package from github using devtools::install_github("RcppCore/RcppParallel") and from CRAN, but neither method has worked for me. Do you have any suggestions for how I could troubleshoot this?
I've listed my R version and machine used as well as the error message below.

Thank you in advance!
Yuka

R version/ Machine used:
R version 4.0.2 (2020-06-22)
Platform: x86_64-centos7-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Error message:

> devtools::install_github("RcppCore/RcppParallel")
Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo RcppCore/RcppParallel@HEAD
✔  checking for file ‘/tmp/RtmpkUICWI/remotes24eff3242c46e/RcppCore-RcppParallel-878b6e7/DESCRIPTION’ (508ms)
─  preparing ‘RcppParallel’:
✔  checking DESCRIPTION meta-information ...
─  cleaning src
─  running ‘cleanup’
─  checking for LF line-endings in source and make files and shell scripts (549ms)
─  checking for empty or unneeded directories
─  building ‘RcppParallel_5.1.5.tar.gz’

Installing package into ‘/home/ytakemon/R/x86_64-centos7-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
* installing *source* package ‘RcppParallel’ ...
** using staged installation
** preparing to configure package 'RcppParallel' ...
*** configured file: 'src/Makevars.in' => 'src/Makevars'
** finished configure for package 'RcppParallel'
** libs
(tbb) Building TBB using bundled sources ...
make[1]: Entering directory `/tmp/RtmpN2WSXT/R.INSTALL250a73a2216f7/RcppParallel/src/tbb/src'
OS: linux
arch=intel64
compiler=gcc
runtime=cc4.8.5_libc2.17_kernel3.10.0
tbb_build_prefix=linux_intel64_gcc_cc4.8.5_libc2.17_kernel3.10.0
work_dir=/tmp/RtmpN2WSXT/R.INSTALL250a73a2216f7/RcppParallel/src/build/linux_intel64_gcc_cc4.8.5_libc2.17_kernel3.10.0_release
make[1]: Leaving directory `/tmp/RtmpN2WSXT/R.INSTALL250a73a2216f7/RcppParallel/src/tbb/src'
make[1]: Entering directory `/tmp/RtmpN2WSXT/R.INSTALL250a73a2216f7/RcppParallel/src/tbb/src'
Created ../build/lib_release directory
make -C "../build/lib_release"  -r -f ../../build/Makefile.tbb cfg=release
make[2]: Entering directory `/tmp/RtmpN2WSXT/R.INSTALL250a73a2216f7/RcppParallel/src/tbb/build/lib_release'
../../build/Makefile.tbb:28: CONFIG: cfg=release arch=intel64 compiler=gcc target=linux runtime=cc4.8.5_libc2.17_kernel3.10.0
/usr/bin/g++ -I../inst/include  -o concurrent_hash_map.o -c -MMD -DDO_ITT_NOTIFY -O2 -DUSE_PTHREAD -m64 -mrtm  -fpic -flifetime-dse=1 -D__TBB_BUILD=1 -Wall -Wextra  -L/gsc/software/linux-x86_64-centos7/gcc-7.2.0/lib64 -DTBB_NO_LEGACY=1   -I../../src -I../../src/rml/include -I../../include ../../src/tbb/concurrent_hash_map.cpp
g++: error: unrecognized command line option ‘-flifetime-dse=1’
make[2]: *** [concurrent_hash_map.o] Error 1
make[2]: Leaving directory `/tmp/RtmpN2WSXT/R.INSTALL250a73a2216f7/RcppParallel/src/tbb/build/lib_release'
make[1]: *** [tbb_release] Error 2
make[1]: Leaving directory `/tmp/RtmpN2WSXT/R.INSTALL250a73a2216f7/RcppParallel/src/tbb/src'
/gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/g++ -std=gnu++11 -I"/gsc/software/linux-x86_64-centos7/R-4.0.2/lib64/R/include" -DNDEBUG -I../inst/include  -I/usr/local/include  -std=gnu++11 -DRCPP_PARALLEL_USE_TBB=1 -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fpic  -L/gsc/software/linux-x86_64-centos7/gcc-7.2.0/lib64  -c init.cpp -o init.o
/gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/g++ -std=gnu++11 -I"/gsc/software/linux-x86_64-centos7/R-4.0.2/lib64/R/include" -DNDEBUG -I../inst/include  -I/usr/local/include  -std=gnu++11 -DRCPP_PARALLEL_USE_TBB=1 -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fpic  -L/gsc/software/linux-x86_64-centos7/gcc-7.2.0/lib64  -c options.cpp -o options.o
/gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/g++ -std=gnu++11 -shared -L/gsc/software/linux-x86_64-centos7/R-4.0.2/lib64/R/lib -L/gsc/software/linux-x86_64-centos7/gcc-7.2.0/lib64 -o RcppParallel.so init.o options.o -L/gsc/software/linux-x86_64-centos7/R-4.0.2/lib64/R/lib -lR
installing via 'install.libs.R' to /home/ytakemon/R/x86_64-centos7-linux-gnu-library/4.0/00LOCK-RcppParallel/00new/RcppParallel
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘RcppParallel’:
 .onLoad failed in loadNamespace() for 'RcppParallel', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/home/ytakemon/R/x86_64-centos7-linux-gnu-library/4.0/00LOCK-RcppParallel/00new/RcppParallel/libs/RcppParallel.so':
  /home/ytakemon/R/x86_64-centos7-linux-gnu-library/4.0/00LOCK-RcppParallel/00new/RcppParallel/libs/RcppParallel.so: undefined symbol: _ZN3tbb4task13note_affinityEt
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/ytakemon/R/x86_64-centos7-linux-gnu-library/4.0/RcppParallel’
Warning message:
In i.p(...) :
  installation of package ‘/tmp/RtmpkUICWI/file24eff72505ea4/RcppParallel_5.1.5.tar.gz’ had non-zero exit status

You need to use a less old operating system, or at least provide it with more recent compilers -- which you can do via something called devtoolset.

Thanks for your response. Could you share what the minimum version requirements are for OS and compilers? This will help me communicate with the IT department which has sudo privileges.

I think the devtoolsset for CentOS 7 gets you gcc/g++ 8.* which should be good enough. CRAN uses newer versions (10 and later). Also note that your R version is also two years behind so you may get other trouble from other packages.

For reference, the relevant error:

g++: error: unrecognized command line option ‘-flifetime-dse=1’

But that flag should only be turned on if using gcc 6 or newer:

# gcc 6.0 and later have -flifetime-dse option that controls
# elimination of stores done outside the object lifetime
ifneq (,$(shell $(CONLY) -dumpfullversion -dumpversion | egrep "^([6-9])"))
# keep pre-contruction stores for zero initialization
DSE_KEY = -flifetime-dse=1
endif

It looks like the R-related files are being compiled using gcc 7:

/gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/g++ -std=gnu++11 -I"/gsc/software/linux-x86_64-centos7/R-4.0.2/lib64/R/include" -DNDEBUG -I../inst/include -I/usr/local/include -std=gnu++11 -DRCPP_PARALLEL_USE_TBB=1 -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fpic -L/gsc/software/linux-x86_64-centos7/gcc-7.2.0/lib64 -c init.cpp -o init.o

But, for whatever reason, TBB itself is seeing (and using) the "system" gcc installation:

/usr/bin/g++ -I../inst/include -o concurrent_hash_map.o -c -MMD -DDO_ITT_NOTIFY -O2 -DUSE_PTHREAD -m64 -mrtm -fpic -flifetime-dse=1 -D__TBB_BUILD=1 -Wall -Wextra -L/gsc/software/linux-x86_64-centos7/gcc-7.2.0/lib64 -DTBB_NO_LEGACY=1 -I../../src -I../../src/rml/include -I../../include ../../src/tbb/concurrent_hash_map.cpp

Can you share the output of:

R CMD config --all

I wonder if we're somehow failing to pass along the right path to the C++ compiler to TBB here.

I wonder if we're somehow failing to pass along the right path to the C++ compiler to TBB here.

That's a very good observation. It's been a few years since I saw a devtoolset-enhance CentOS but I also recall that a) these are installed off the path and b) require sourcing a shell script to 'activate' and so c) may not be found in R's own compile time config as R may not have been recompiled.

Can you share the output of:
R CMD config --all

Below are the outputs:

CC = /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/gcc
CFLAGS = -g -O2
CPICFLAGS = -fpic
CPPFLAGS = -I/usr/local/include
CXX = /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/g++ -std=gnu++11
CXXFLAGS = -L/gsc/software/linux-x86_64-centos7/gcc-7.2.0/lib64
CXXPICFLAGS = -fpic
CXX11 = /usr/bin/g++
CXX11STD = -std=gnu++11
CXX11FLAGS = -L/gsc/software/linux-x86_64-centos7/gcc-7.2.0/lib64
CXX11PICFLAGS = -fpic
CXX14 = /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/g++
CXX14STD = -std=gnu++14
CXX14FLAGS = -L/gsc/software/linux-x86_64-centos7/gcc-7.2.0/lib64
CXX14PICFLAGS = -fpic
CXX17 = /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/g++
CXX17STD = -std=gnu++17
CXX17FLAGS = -L/gsc/software/linux-x86_64-centos7/gcc-7.2.0/lib64
CXX17PICFLAGS = -fpic
CXX20 =
CXX20STD =
CXX20FLAGS =
CXX20PICFLAGS =
DYLIB_EXT = .so
DYLIB_LD = /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/gcc
DYLIB_LDFLAGS = -shared -fopenmp
FC = /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/gfortran
FFLAGS = -g -O2
FPICFLAGS = -fpic
FLIBS = -lgfortran -lm -lquadmath
FCFLAGS = -g -O2
SAFE_FFLAGS = -g -O2 -msse2 -mfpmath=sse
OBJC =
OBJCFLAGS =
JAVA = /gsc/software/linux-x86_64-centos7/jdk1.8.0_172/jre/bin/java
JAVAC = /gsc/software/linux-x86_64-centos7/jdk1.8.0_172/jre/../bin/javac
JAVAH = /gsc/software/linux-x86_64-centos7/jdk1.8.0_172/jre/../bin/javah
JAR = /gsc/software/linux-x86_64-centos7/jdk1.8.0_172/jre/../bin/jar
JAVA_HOME = /gsc/software/linux-x86_64-centos7/jdk1.8.0_172/jre
JAVA_LIBS = -L/gsc/software/linux-x86_64-centos7/jdk1.8.0_172/jre/lib/amd64/server -ljvm
JAVA_CPPFLAGS = -I/gsc/software/linux-x86_64-centos7/jdk1.8.0_172/jre/../include -I/gsc/software/linux-x86_64-centos7/jdk1.8.0_172/jre/../include/linux
LDFLAGS = -L/gsc/software/linux-x86_64-centos7/gcc-7.2.0/lib64
SHLIB_CFLAGS =
SHLIB_CXXFLAGS =
SHLIB_CXXLD = /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/g++ -std=gnu++11
SHLIB_CXXLDFLAGS = -shared
SHLIB_CXX11LD = /usr/bin/g++ -std=gnu++11
SHLIB_CXX11LDFLAGS = -shared
SHLIB_CXX14LD = /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/g++ -std=gnu++14
SHLIB_CXX14LDFLAGS = -shared
SHLIB_CXX17LD = /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/g++ -std=gnu++17
SHLIB_CXX17LDFLAGS = -shared
SHLIB_CXX20LD =
SHLIB_CXX20LDFLAGS = -shared
SHLIB_EXT = .so
SHLIB_FFLAGS =
SHLIB_LD = /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/gcc
SHLIB_LDFLAGS = -shared
TCLTK_CPPFLAGS =
TCLTK_LIBS =
BLAS_LIBS = -L/gsc/software/linux-x86_64-centos7/R-4.0.2/lib64/R/lib -lRblas
LAPACK_LIBS = -L/gsc/software/linux-x86_64-centos7/R-4.0.2/lib64/R/lib -lRlapack
MAKE = make
LIBnn = lib64
AR = ar
RANLIB = ranlib
## The following variables are deprecated
CPP = /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/gcc -E
CXXCPP = /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/g++ -std=gnu++11 -E

I also tried installing RccpParallel using the most recent R installation we have on our system, which is R-4.1.0, and I am seeing the same errors there as well.

I think this explains it:

CXX11 = /usr/bin/g++

CXX11 wasn't updated to use the new compiler. You can try overriding this in e.g. your ~/.R/Makevars file, to point at the compiler you want to use.

I've now installed your tool successfully! I did exactly what you suggested and changed the path on ~/.R/Makevars to :

CXX11 = /gsc/software/linux-x86_64-centos7/gcc-7.2.0/bin/g++ 

Thank you both for taking the time to help me solve the problem!

Thanks to you for persevering! Turns out your IT folks did try to help and had a newer compiler, but one went astray.

One thing I find helps is to not just 'fail' at the top-level (in your case via remotes) but to try to run install.packages() directly, or, better still, unpack the source tar.gz and run R CMD INSTALL . and/or ./configure -- all in order to get closer to the actual error messages to have a better handle on what may have caused it.