RcppCore / RcppParallel

High-level functions for parallel programming with Rcpp
http://rcppcore.github.io/RcppParallel/
171 stars 58 forks source link

tbb error during install #204

Closed AldenGriffith closed 1 year ago

AldenGriffith commented 1 year ago

I'm trying to install RcppParallel and running into an error that seems to be linked to tbb.

System info: RStudio Server 2022.07.1 Build 554 R 4.2.1 CentOS 7

It seems that I have an old version of tbb installed (4.1), and I tried to install the most recent version of onetbb but I'm not sure it's configured properly. Though I'm not sure if that's my issue at all, as it seems like the RcppParallel installer is trying to build tbb itself.

Any ideas as to why I can't get it installed?

Installing package into ‘/home/agriffit/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/RcppParallel_5.1.7.tar.gz'
Content type 'application/x-gzip' length 1629119 bytes (1.6 MB)
==================================================
downloaded 1.6 MB

* installing *source* package ‘RcppParallel’ ...
** package ‘RcppParallel’ successfully unpacked and MD5 sums checked
** using staged installation
** preparing to configure package 'RcppParallel' ...
*** configured file: 'R/tbb-autodetected.R.in' => 'R/tbb-autodetected.R'
*** configured file: 'src/Makevars.in' => 'src/Makevars'
*** configured file: 'src/install.libs.R.in' => 'src/install.libs.R'
** finished configure for package 'RcppParallel'
** libs
(tbb) Building TBB using bundled sources ...
make[1]: Entering directory `/tmp/RtmpYt401T/R.INSTALL3041fa612431/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/RtmpYt401T/R.INSTALL3041fa612431/RcppParallel/src/build/linux_intel64_gcc_cc4.8.5_libc2.17_kernel3.10.0_release
make[1]: Leaving directory `/tmp/RtmpYt401T/R.INSTALL3041fa612431/RcppParallel/src/tbb/src'
make[1]: Entering directory `/tmp/RtmpYt401T/R.INSTALL3041fa612431/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/RtmpYt401T/R.INSTALL3041fa612431/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
g++ -I../inst/include  -o concurrent_hash_map.o -c -MMD -DDO_ITT_NOTIFY -O2 -DUSE_PTHREAD -m64 -mrtm  -fpic  -D__TBB_BUILD=1 -Wall -Wextra  -g -O2 -DTBB_NO_LEGACY=1   -I../../src -I../../src/rml/include -I../../include ../../src/tbb/concurrent_hash_map.cpp
In file included from ../../include/tbb/concurrent_hash_map.h:26:0,
                 from ../../src/tbb/concurrent_hash_map.cpp:17:
../../include/tbb/compat/iterator.h:19:11: error: expected nested-name-specifier before ‘iterator_category’
     using iterator_category = Category;
           ^
../../include/tbb/compat/iterator.h:19:11: error: using-declaration for non-member at class scope
../../include/tbb/compat/iterator.h:19:29: error: expected ‘;’ before ‘=’ token
     using iterator_category = Category;
                             ^
../../include/tbb/compat/iterator.h:19:29: error: expected unqualified-id before ‘=’ token
../../include/tbb/compat/iterator.h:20:11: error: expected nested-name-specifier before ‘value_type’
     using value_type = T;
           ^
../../include/tbb/compat/iterator.h:20:11: error: using-declaration for non-member at class scope
../../include/tbb/compat/iterator.h:20:22: error: expected ‘;’ before ‘=’ token
     using value_type = T;
                      ^
../../include/tbb/compat/iterator.h:20:22: error: expected unqualified-id before ‘=’ token
../../include/tbb/compat/iterator.h:21:11: error: expected nested-name-specifier before ‘difference_type’
     using difference_type = Distance;
           ^
../../include/tbb/compat/iterator.h:21:11: error: using-declaration for non-member at class scope
../../include/tbb/compat/iterator.h:21:27: error: expected ‘;’ before ‘=’ token
     using difference_type = Distance;
                           ^
../../include/tbb/compat/iterator.h:21:27: error: expected unqualified-id before ‘=’ token
../../include/tbb/compat/iterator.h:22:11: error: expected nested-name-specifier before ‘pointer’
     using pointer = Pointer;
           ^
../../include/tbb/compat/iterator.h:22:11: error: using-declaration for non-member at class scope
../../include/tbb/compat/iterator.h:22:19: error: expected ‘;’ before ‘=’ token
     using pointer = Pointer;
                   ^
../../include/tbb/compat/iterator.h:22:19: error: expected unqualified-id before ‘=’ token
../../include/tbb/compat/iterator.h:23:11: error: expected nested-name-specifier before ‘reference’
     using reference = Reference;
           ^
../../include/tbb/compat/iterator.h:23:11: error: using-declaration for non-member at class scope
../../include/tbb/compat/iterator.h:23:21: error: expected ‘;’ before ‘=’ token
     using reference = Reference;
                     ^
../../include/tbb/compat/iterator.h:23:21: error: expected unqualified-id before ‘=’ token
make[2]: *** [concurrent_hash_map.o] Error 1
make[2]: Leaving directory `/tmp/RtmpYt401T/R.INSTALL3041fa612431/RcppParallel/src/tbb/build/lib_release'
make[1]: *** [tbb_release] Error 2
make[1]: Leaving directory `/tmp/RtmpYt401T/R.INSTALL3041fa612431/RcppParallel/src/tbb/src'
g++ -std=gnu++11 -I"/opt/R/4.2.1/lib/R/include" -DNDEBUG -I../inst/include  -I/usr/local/include  -std=gnu++11 -DRCPP_PARALLEL_USE_TBB=1 -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fpic  -g -O2  -c init.cpp -o init.o
g++ -std=gnu++11 -I"/opt/R/4.2.1/lib/R/include" -DNDEBUG -I../inst/include  -I/usr/local/include  -std=gnu++11 -DRCPP_PARALLEL_USE_TBB=1 -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fpic  -g -O2  -c options.cpp -o options.o
g++ -std=gnu++11 -shared -L/opt/R/4.2.1/lib/R/lib -L/usr/local/lib -o RcppParallel.so init.o options.o -L/opt/R/4.2.1/lib/R/lib -lR
installing via 'install.libs.R' to /home/agriffit/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-RcppParallel/00new/RcppParallel
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package ‘RcppParallel’
    finding HTML links ... done
    RcppParallel-package                    html  
    RcppParallel.package.skeleton           html  
    flags                                   html  
    setThreadOptions                        html  
    tbbLibraryPath                          html  
** 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/agriffit/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-RcppParallel/00new/RcppParallel/libs/RcppParallel.so':
  /home/agriffit/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-RcppParallel/00new/RcppParallel/libs/RcppParallel.so: undefined symbol: _ZN3tbb10interface58internal9task_base7destroyERNS_4taskE
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/agriffit/R/x86_64-pc-linux-gnu-library/4.2/RcppParallel’
Warning in install.packages :
  installation of package ‘RcppParallel’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmpn7b0ua/downloaded_packages’
eddelbuettel commented 1 year ago

CentOS 7

Please existing issues. Your compiler is insufficient on your somewhat dated OS release. There are workaround via devtoolset. I suggest we close this as a duplicate once you get a chance to look at the other issues.

AldenGriffith commented 1 year ago

Weird - I notice that during install it says I'm running gcc 4.8.5, but I had just updated to 7.3.1. When I check using "gcc --version" it returns 7.3.1. Is there a way to force it to use the newer version?

eddelbuettel commented 1 year ago

That is between you and devtoolset. IIRC there is a shell script (snippet) you need to source to prefix $PATH and friends. configure etc will then pick it up.

AldenGriffith commented 1 year ago

Thanks. I was able to install gcc 9.2.0 and the install went along further this time, with tbb being successfully compiled. I'm then running into another error: _libstdc++.so.6: version `CXXABI1.3.8' not found.

Full output is below. Arg I really need to update pretty much everything, but it's not my machine. Hoping I can still find a way to get this working. I'm ultimately trying to install the brms package, but it's getting hung up on RcppParallel.

Installing package into ‘/home/agriffit/R/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/RcppParallel_5.1.7.tar.gz'
Content type 'application/x-gzip' length 1629119 bytes (1.6 MB)
==================================================
downloaded 1.6 MB

* installing *source* package ‘RcppParallel’ ...
** package ‘RcppParallel’ successfully unpacked and MD5 sums checked
** using staged installation
** preparing to configure package 'RcppParallel' ...
*** configured file: 'R/tbb-autodetected.R.in' => 'R/tbb-autodetected.R'
*** configured file: 'src/Makevars.in' => 'src/Makevars'
*** configured file: 'src/install.libs.R.in' => 'src/install.libs.R'
** finished configure for package 'RcppParallel'
** libs
(tbb) Building TBB using bundled sources ...
make[1]: Entering directory `/tmp/Rtmpsk9sQf/R.INSTALL36a6c1754361e/RcppParallel/src/tbb/src'
OS: linux
arch=intel64
compiler=gcc
runtime=cc9.2.0_libc2.17_kernel3.10.0
tbb_build_prefix=linux_intel64_gcc_cc9.2.0_libc2.17_kernel3.10.0
work_dir=/tmp/Rtmpsk9sQf/R.INSTALL36a6c1754361e/RcppParallel/src/build/linux_intel64_gcc_cc9.2.0_libc2.17_kernel3.10.0_release
make[1]: Leaving directory `/tmp/Rtmpsk9sQf/R.INSTALL36a6c1754361e/RcppParallel/src/tbb/src'
(tbb) TBB compilation finished successfully.
g++ -std=gnu++11 -I"/opt/R/4.2.1/lib/R/include" -DNDEBUG -I../inst/include  -I/usr/local/include  -std=gnu++11 -DRCPP_PARALLEL_USE_TBB=1 -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fpic  -g -O2  -c init.cpp -o init.o
g++ -std=gnu++11 -I"/opt/R/4.2.1/lib/R/include" -DNDEBUG -I../inst/include  -I/usr/local/include  -std=gnu++11 -DRCPP_PARALLEL_USE_TBB=1 -DTBB_SUPPRESS_DEPRECATED_MESSAGES=1 -fpic  -g -O2  -c options.cpp -o options.o
g++ -std=gnu++11 -shared -L/opt/R/4.2.1/lib/R/lib -L/usr/local/lib -o RcppParallel.so init.o options.o -L/opt/R/4.2.1/lib/R/lib -lR
installing via 'install.libs.R' to /home/agriffit/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-RcppParallel/00new/RcppParallel
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
  converting help for package ‘RcppParallel’
    finding HTML links ... done
    RcppParallel-package                    html  
    RcppParallel.package.skeleton           html  
    flags                                   html  
    setThreadOptions                        html  
    tbbLibraryPath                          html  
** 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(path, local = FALSE, now = TRUE)
  error: unable to load shared object '/home/agriffit/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-RcppParallel/00new/RcppParallel/lib/libtbb.so.2':
  /lib64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /home/agriffit/R/x86_64-pc-linux-gnu-library/4.2/00LOCK-RcppParallel/00new/RcppParallel/lib/libtbb.so.2)
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/agriffit/R/x86_64-pc-linux-gnu-library/4.2/RcppParallel’
Warning in install.packages :
  installation of package ‘RcppParallel’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/Rtmpq26ciT/downloaded_packages’
eddelbuettel commented 1 year ago

That's still you I think and a RedHat forum may help you. You need the proper C++ library package; I am a Debian/Ubuntu user (and dev) and don't know which RHEL or alike package you need here.

The source package is fine and builds everywhere ducks are in a row. Looks like you are close so keep at it.

AldenGriffith commented 1 year ago

Ok, thanks so much for your help!

AldenGriffith commented 1 year ago

I finally managed to get it installed by adding a file to /etc/ld.so.conf.d/ that includes the path where the new gcc libraries are: /usr/local/lib64 (see here).

After installing the package, I couldn't successfully load it at first. Needed to restart the R session for the updated path to be available within R.

Yay! Thanks for the help and encouragement.

eddelbuettel commented 1 year ago

Ah, yes, I think I had to do that too close to a decade ago when I the distinct pleasure of having to work on a CentOS system.

Glad you are good to go. I will close this now. Feel free to reopen if something bad requires it.