Installing from source with the latest version of R (irrelevant) and the development version of Matrix breaks.
I'm not exactly sure what happened but there are comments in the Matrix package SVN repository about moving from "Rdefines.h" to "Rinternals.h"; the NEW_INTEGER macro is defined in Rdefines.h, and the comments in Rdefines.h say
Rdefines.h macros for an S-like interface to the above (no longer maintained)
I think Matrix used to import this but doesn't any more. A fix might be to
#define NEW_INTEGER(n) Rf_allocVector(INTSXP,n)
but I haven't tried it. (For now I reverted Matrix to the earlier [CRAN] version.)
(Alternatively could explicitly #include <Rdefines.h>, but maybe that's suboptimal since Matrix is moving away from it?)
sessionInfo():
R Under development (unstable) (2022-12-31 r83530)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Pop!_OS 22.04 LTS
Matrix products: default
BLAS: /usr/local/lib/R/lib/libRblas.so
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3; LAPACK version 3.10.0
<locale/time zone info redacted>
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] Matrix_1.5-4
loaded via a namespace (and not attached):
[1] compiler_4.3.0 bspm_0.3.10 grid_4.3.0 lattice_0.20-45
bolker@pop-os:~/R/pkgs/adcomp$ make install
make build-package
make[1]: Entering directory '/home/bolker/Documents/R/pkgs/adcomp'
R CMD build --resave-data=no TMB
Loading required package: utils
Tracing function "install.packages" in package "utils"
* checking for file ‘TMB/DESCRIPTION’ ... OK
* preparing ‘TMB’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building ‘TMB_1.9.1.tar.gz’
make[1]: Leaving directory '/home/bolker/Documents/R/pkgs/adcomp'
R CMD INSTALL --preclean TMB_1.9.1.tar.gz
Loading required package: utils
Tracing function "install.packages" in package "utils"
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘TMB’ ...
** using staged installation
** libs
using C compiler: ‘gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0’
make[1]: Entering directory '/tmp/RtmpNffoEw/R.INSTALL137d4489d8994/TMB/src'
make[1]: Leaving directory '/tmp/RtmpNffoEw/R.INSTALL137d4489d8994/TMB/src'
make[1]: Entering directory '/tmp/RtmpNffoEw/R.INSTALL137d4489d8994/TMB/src'
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Matrix/include' -I/usr/local/include -fopenmp -fpic -g -O2 -c external_metis.c -o external_metis.o
In file included from /usr/local/lib/R/site-library/Matrix/include/Matrix.h:4,
from external_metis.c:7:
external_metis.c: In function ‘have_tmb_symbolic’:
external_metis.c:104:17: warning: implicit declaration of function ‘NEW_INTEGER’; did you mean ‘NA_INTEGER’? [-Wimplicit-function-declaration]
104 | PROTECT(ans = NEW_INTEGER(1));
| ^~~~~~~~~~~
/usr/local/lib/R/include/Rinternals.h:368:36: note: in definition of macro ‘PROTECT’
368 | #define PROTECT(s) Rf_protect(s)
| ^
external_metis.c:104:15: warning: assignment to ‘SEXP’ {aka ‘struct SEXPREC *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
104 | PROTECT(ans = NEW_INTEGER(1));
| ^
/usr/local/lib/R/include/Rinternals.h:368:36: note: in definition of macro ‘PROTECT’
368 | #define PROTECT(s) Rf_protect(s)
| ^
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Matrix/include' -I/usr/local/include -fopenmp -fpic -g -O2 -c init.c -o init.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Matrix/include' -I/usr/local/include -fopenmp -fpic -g -O2 -c local_stubs.c -o local_stubs.o
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Matrix/include' -I/usr/local/include -fopenmp -fpic -g -O2 -c solve_subset.c -o solve_subset.o
solve_subset.c: In function ‘tmb_as_cholmod_factor3’:
solve_subset.c:81:23: warning: implicit declaration of function ‘GET_SLOT’ [-Wimplicit-function-declaration]
81 | int *type = INTEGER(GET_SLOT(x, install("type")));
| ^~~~~~~~
solve_subset.c:81:23: warning: passing argument 1 of ‘INTEGER’ makes pointer from integer without a cast [-Wint-conversion]
81 | int *type = INTEGER(GET_SLOT(x, install("type")));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
In file included from /usr/local/lib/R/site-library/Matrix/include/Matrix.h:4,
from solve_subset.c:53:
/usr/local/lib/R/include/Rinternals.h:272:22: note: expected ‘SEXP’ {aka ‘struct SEXPREC *’} but argument is of type ‘int’
272 | int *(INTEGER)(SEXP x);
| ~~~~~^
solve_subset.c:93:7: warning: assignment to ‘SEXP’ {aka ‘struct SEXPREC *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
93 | tmp = GET_SLOT(x, Matrix_permSym);
| ^
solve_subset.c:95:27: warning: passing argument 1 of ‘INTEGER’ makes pointer from integer without a cast [-Wint-conversion]
95 | ans->ColCount = INTEGER(GET_SLOT(x, install("colcount")));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| int
In file included from /usr/local/lib/R/site-library/Matrix/include/Matrix.h:4,
from solve_subset.c:53:
/usr/local/lib/R/include/Rinternals.h:272:22: note: expected ‘SEXP’ {aka ‘struct SEXPREC *’} but argument is of type ‘int’
272 | int *(INTEGER)(SEXP x);
| ~~~~~^
solve_subset.c:98:7: warning: assignment to ‘SEXP’ {aka ‘struct SEXPREC *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
98 | tmp = GET_SLOT(x, Matrix_xSym);
| ^
solve_subset.c:104:9: warning: assignment to ‘SEXP’ {aka ‘struct SEXPREC *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
104 | tmp = GET_SLOT(x, install("super"));
| ^
solve_subset.c:106:9: warning: assignment to ‘SEXP’ {aka ‘struct SEXPREC *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
106 | tmp = GET_SLOT(x, install("pi"));
| ^
solve_subset.c:108:9: warning: assignment to ‘SEXP’ {aka ‘struct SEXPREC *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
108 | tmp = GET_SLOT(x, install("px"));
| ^
solve_subset.c:110:9: warning: assignment to ‘SEXP’ {aka ‘struct SEXPREC *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
110 | tmp = GET_SLOT(x, install("s"));
| ^
In file included from /usr/local/lib/R/site-library/Matrix/include/Matrix.h:4,
from solve_subset.c:53:
solve_subset.c: In function ‘tmb_CHMfactor_solve’:
solve_subset.c:146:23: warning: implicit declaration of function ‘NEW_NUMERIC’ [-Wimplicit-function-declaration]
146 | SEXP x = PROTECT( NEW_NUMERIC( n ) );
| ^~~~~~~~~~~
/usr/local/lib/R/include/Rinternals.h:368:36: note: in definition of macro ‘PROTECT’
368 | #define PROTECT(s) Rf_protect(s)
| ^
solve_subset.c:146:23: warning: passing argument 1 of ‘Rf_protect’ makes pointer from integer without a cast [-Wint-conversion]
146 | SEXP x = PROTECT( NEW_NUMERIC( n ) );
| ^~~~~~~~~~~~~~~~
| |
| int
/usr/local/lib/R/include/Rinternals.h:368:36: note: in definition of macro ‘PROTECT’
368 | #define PROTECT(s) Rf_protect(s)
| ^
In file included from /usr/local/lib/R/site-library/Matrix/include/Matrix.h:4,
from solve_subset.c:53:
/usr/local/lib/R/include/Rinternals.h:1101:17: note: expected ‘SEXP’ {aka ‘struct SEXPREC *’} but argument is of type ‘int’
1101 | SEXP Rf_protect(SEXP);
| ^~~~
In file included from /usr/local/lib/R/site-library/Matrix/include/Matrix.h:4,
from solve_subset.c:53:
solve_subset.c: In function ‘match_pattern’:
solve_subset.c:334:15: warning: implicit declaration of function ‘NEW_INTEGER’; did you mean ‘NA_INTEGER’? [-Wimplicit-function-declaration]
334 | PROTECT(ans=NEW_INTEGER(A->nzmax));
| ^~~~~~~~~~~
/usr/local/lib/R/include/Rinternals.h:368:36: note: in definition of macro ‘PROTECT’
368 | #define PROTECT(s) Rf_protect(s)
| ^
solve_subset.c:334:14: warning: assignment to ‘SEXP’ {aka ‘struct SEXPREC *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
334 | PROTECT(ans=NEW_INTEGER(A->nzmax));
| ^
/usr/local/lib/R/include/Rinternals.h:368:36: note: in definition of macro ‘PROTECT’
368 | #define PROTECT(s) Rf_protect(s)
| ^
gcc -I"/usr/local/lib/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Matrix/include' -I/usr/local/include -fopenmp -fpic -g -O2 -c utils.c -o utils.o
gcc -shared -L/usr/local/lib/R/lib -L/usr/local/lib -o TMB.so external_metis.o init.o local_stubs.o solve_subset.o utils.o -llapack -L/usr/local/lib/R/lib -lRblas -lgfortran -lm -lquadmath -fopenmp -L/usr/local/lib/R/lib -lR
make[1]: Leaving directory '/tmp/RtmpNffoEw/R.INSTALL137d4489d8994/TMB/src'
installing to /usr/local/lib/R/site-library/00LOCK-TMB/00new/TMB/libs
** R
** inst
** byte-compile and prepare package for lazy loading
Loading required package: utils
Tracing function "install.packages" in package "utils"
** help
*** installing help indices
** building package indices
Loading required package: utils
Tracing function "install.packages" in package "utils"
** testing if installed package can be loaded from temporary location
Loading required package: utils
Tracing function "install.packages" in package "utils"
Error: package or namespace load failed for ‘TMB’:
.onLoad failed in loadNamespace() for 'TMB', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/usr/local/lib/R/site-library/00LOCK-TMB/00new/TMB/libs/TMB.so':
/usr/local/lib/R/site-library/00LOCK-TMB/00new/TMB/libs/TMB.so: undefined symbol: NEW_INTEGER
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/usr/local/lib/R/site-library/TMB’
* restoring previous ‘/usr/local/lib/R/site-library/TMB’
make: *** [Makefile:24: install] Error 1
Installing from source with the latest version of R (irrelevant) and the development version of Matrix breaks.
I'm not exactly sure what happened but there are comments in the Matrix package SVN repository about moving from "Rdefines.h" to "Rinternals.h"; the
NEW_INTEGER
macro is defined in Rdefines.h, and the comments inRdefines.h
sayI think Matrix used to import this but doesn't any more. A fix might be to
but I haven't tried it. (For now I reverted Matrix to the earlier [CRAN] version.) (Alternatively could explicitly
#include <Rdefines.h>
, but maybe that's suboptimal since Matrix is moving away from it?)sessionInfo()
: