[R-sig-Debian] Cpp Error installing CRAN version of MatrixExtra on Ubuntu 18.04

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Mon Dec 20 15:19:05 CET 2021


On 19 December 2021 at 18:14, David Winsemius wrote:
| I initially attempted installation of pkg:MatrixExtra with 
| `install.packages on my Ubuntu 18.04 LTS system from within RStudio. It 
| failed with an error attempting to compile a function named "matmul.cpp" 
| so I tried running R from a Terminal session. Same error. Finally I 

Well yes. Same system, same compiler and same R.  Can you remind me what

   gcc --version

says on Ubuntu 18.04. It could be that the g++ version may be too old for
current coding practices. You may have to expect such errors to occur more
frequently on ancient system.  Some of us have started to ship packages using
C++14 (which is actually R's default in R 4.1.0 and later unless overridden
to C++11 or lower) and even C++17. Or it could be something else. See below.

| downloaded from CRAN and this is the session result of an effort with R 
| CMD INSTALL:
| 
| (The name of my library is a historical accident, but I'm running R 
| version 4.1.2 (2021-11-01) -- "Bird Hippie" and almost all of my other

You say R 4.1.2 but we see R 3.5.1 below !!

| 1536 packages have been updated without reported errors using 
| `update.packages(checkBuilt=TRUE)`
| 
| ======================================
| 
| david using davids:/usr/lib/R$ R CMD INSTALL ~/MatrixExtra_0.1.9.tar.gz
| * installing to library ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1’

That is very suspicious.  Why R/x86_64_pc-linux-gnu-library/3.5.1 ?

That looks like an error.  There _was_ a change from R before 4.0 to 4.0.
As I recall you need to rebuild everything for R 4.0.* or R 4.1.*.

| * installing *source* package ‘MatrixExtra’ ...
| ** package ‘MatrixExtra’ successfully unpacked and MD5 sums checked
| ** using staged installation
| checking for g++... g++
| checking whether the C++ compiler works... yes
| checking for C++ compiler default output file name... a.out
| checking for suffix of executables...
| checking whether we are cross compiling... no
| checking for suffix of object files... o
| checking whether the compiler supports GNU C++... yes
| checking whether g++ accepts -g... yes
| checking for g++ option to enable C++11 features... none needed

So far it is happy with C++11.

| configure: creating ./config.status
| config.status: creating src/Makevars
| ** libs
| g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -DUSE_ROBINMAP 
| -DHAS_LD=1 -DSUPPORTS_RESTRICT=1 
| -I'/home/david/R/x86_64-pc-linux-gnu-library/3.5.1/Rcpp/include' 
| -I'/home/david/R/x86_64-pc-linux-gnu-library/3.5.1/float/include' 
| -fopenmp -fno-trapping-math -fno-math-errno -fvisibility=hidden -fpic  
| -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. 
| -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
| -D_FORTIFY_SOURCE=2 -g  -Wno-ignored-attributes -c RcppExports.cpp -o 
| RcppExports.o

And uses C++11

| g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -DUSE_ROBINMAP 
| -DHAS_LD=1 -DSUPPORTS_RESTRICT=1 
| -I'/home/david/R/x86_64-pc-linux-gnu-library/3.5.1/Rcpp/include' 
| -I'/home/david/R/x86_64-pc-linux-gnu-library/3.5.1/float/include' 
| -fopenmp -fno-trapping-math -fno-math-errno -fvisibility=hidden -fpic  
| -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. 
| -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
| -D_FORTIFY_SOURCE=2 -g  -Wno-ignored-attributes -c assignment.cpp -o 
| assignment.o
| g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -DUSE_ROBINMAP 
| -DHAS_LD=1 -DSUPPORTS_RESTRICT=1 
| -I'/home/david/R/x86_64-pc-linux-gnu-library/3.5.1/Rcpp/include' 
| -I'/home/david/R/x86_64-pc-linux-gnu-library/3.5.1/float/include' 
| -fopenmp -fno-trapping-math -fno-math-errno -fvisibility=hidden -fpic  
| -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. 
| -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
| -D_FORTIFY_SOURCE=2 -g  -Wno-ignored-attributes -c cbind.cpp -o cbind.o
| g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -DUSE_ROBINMAP 
| -DHAS_LD=1 -DSUPPORTS_RESTRICT=1 
| -I'/home/david/R/x86_64-pc-linux-gnu-library/3.5.1/Rcpp/include' 
| -I'/home/david/R/x86_64-pc-linux-gnu-library/3.5.1/float/include' 
| -fopenmp -fno-trapping-math -fno-math-errno -fvisibility=hidden -fpic  
| -g -O2 -fdebug-prefix-map=/build/r-base-J7pprH/r-base-4.1.2=. 
| -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time 
| -D_FORTIFY_SOURCE=2 -g  -Wno-ignored-attributes -c matmul.cpp -o matmul.o
| matmul.cpp: In function ‘void gemm_csr_drm_as_dcm(int, int, const int*, 
| const int*, const double*, const real_t*, size_t, real_t*, int, int)’:
| matmul.cpp:137:41: error: ‘ldc’ is predetermined ‘shared’ for ‘shared’
|               private(write_ptr, temp_arr)
|                                           ^
| /usr/lib/R/etc/Makeconf:177: recipe for target 'matmul.o' failed
| make: *** [matmul.o] Error 1
| ERROR: compilation failed for package ‘MatrixExtra’
| * removing ‘/home/david/R/x86_64-pc-linux-gnu-library/3.5.1/MatrixExtra’

I have never seen that error. No idea.

But again the '3.5.1' seems out of whack with your use of R 4.1.2.

Dirk


| =======from an R console session==============================
| 
|  > sessionInfo()
| R version 4.1.2 (2021-11-01)
| Platform: x86_64-pc-linux-gnu (64-bit)
| Running under: Ubuntu 18.04.5 LTS
| 
| Matrix products: default
| BLAS:   /usr/lib/x86_64-linux-gnu/openblas/libblas.so.3
| LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so
| 
| locale:
|   [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
|   [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
|   [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
|   [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
|   [9] LC_ADDRESS=C               LC_TELEPHONE=C
| [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
| 
| attached base packages:
| [1] stats     graphics  grDevices utils     datasets  methods base
| 
| loaded via a namespace (and not attached):
| [1] compiler_4.1.2
| 
| Thanks for any suggestions.
| 
| David Winsemius
| 
| _______________________________________________
| R-SIG-Debian mailing list
| R-SIG-Debian using r-project.org
| https://stat.ethz.ch/mailman/listinfo/r-sig-debian

-- 
https://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-SIG-Debian mailing list