Rjacobucci / regsem

Regularized Structural Equation Modeling
14 stars 8 forks source link

gcc 7.3.1 not sufficient(?) for installation: undefined symbol: regsem_rcpp_fit_fun #15

Closed HenrikBengtsson closed 3 years ago

HenrikBengtsson commented 3 years ago

Just sharing in case someone else runs into this problem too. I'm on CentOS 7 with R 4.1.0 built from source. I've noticed that regsem does not install if I build R with gcc 7.3.1 (from SCL devtoolset 7), but it does if R is built with gcc 8.3.1 (from SCL devtoolset 8). It fails with:

** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘regsem’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/00LOCK-regsem/00new/regsem/libs/regsem.so':
  /c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/00LOCK-regsem/00new/regsem/libs/regsem.so: undefined symbol: regsem_rcpp_fit_fun

Details below. Not sure why - maybe due to some C++14 feature that is not implemented in gcc 7.3.1. FWIW, it installs fine with gcc 7.5.0 on my Ubuntu 18.04 machine with R 4.1.0 also built from source.

R 4.1.0 with gcc 7.3.1 (fails)

$ gcc --version
gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ R --vanilla
R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
...
> install.packages("regsem", repos = "https://cloud.r-project.org")
Installing package into ‘/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/regsem_1.6.2.tar.gz'
Content type 'application/x-gzip' length 79501 bytes (77 KB)
==================================================
downloaded 77 KB

* installing *source* package ‘regsem’ ...
** package ‘regsem’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++14 -I"/software/c4/cbi/software/R-4.1.0-gcc7/lib64/R/include" -DNDEBUG  -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/Rcpp/include' -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/RcppArmadillo/include' -I/usr/local/include   -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
gcc -I"/software/c4/cbi/software/R-4.1.0-gcc7/lib64/R/include" -DNDEBUG  -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/Rcpp/include' -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/RcppArmadillo/include' -I/usr/local/include   -fpic  -I/software/c4/cbi/software/geos-3.9.1/include -I/software/c4/cbi/software/gdal-2.4.4/include  -c regsem_init.c -o regsem_init.o
g++ -std=gnu++14 -I"/software/c4/cbi/software/R-4.1.0-gcc7/lib64/R/include" -DNDEBUG  -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/Rcpp/include' -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/RcppArmadillo/include' -I/usr/local/include   -fpic  -g -O2  -c regsem_rcpp_RAMmult.cpp -o regsem_rcpp_RAMmult.o
g++ -std=gnu++14 -I"/software/c4/cbi/software/R-4.1.0-gcc7/lib64/R/include" -DNDEBUG  -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/Rcpp/include' -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/RcppArmadillo/include' -I/usr/local/include   -fpic  -g -O2  -c regsem_rcpp_fit_fun.cpp -o regsem_rcpp_fit_fun.o
g++ -std=gnu++14 -I"/software/c4/cbi/software/R-4.1.0-gcc7/lib64/R/include" -DNDEBUG  -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/Rcpp/include' -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/RcppArmadillo/include' -I/usr/local/include   -fpic  -g -O2  -c regsem_rcpp_grad_ram.cpp -o regsem_rcpp_grad_ram.o
g++ -std=gnu++14 -I"/software/c4/cbi/software/R-4.1.0-gcc7/lib64/R/include" -DNDEBUG  -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/Rcpp/include' -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/RcppArmadillo/include' -I/usr/local/include   -fpic  -g -O2  -c regsem_rcpp_quasi_calc.cpp -o regsem_rcpp_quasi_calc.o
g++ -std=gnu++14 -shared -L/software/c4/cbi/software/R-4.1.0-gcc7/lib64/R/lib -L/software/c4/cbi/software/geos-3.9.1/lib -L/software/c4/cbi/software/gdal-2.4.4/lib -o regsem.so RcppExports.o regsem_init.o regsem_rcpp_RAMmult.o regsem_rcpp_fit_fun.o regsem_rcpp_grad_ram.o regsem_rcpp_quasi_calc.o -L/software/c4/cbi/software/R-4.1.0-gcc7/lib64/R/lib -lRlapack -L/software/c4/cbi/software/R-4.1.0-gcc7/lib64/R/lib -lRblas -lgfortran -lm -lquadmath -L/software/c4/cbi/software/R-4.1.0-gcc7/lib64/R/lib -lR
installing to /c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/00LOCK-regsem/00new/regsem/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘regsem’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/00LOCK-regsem/00new/regsem/libs/regsem.so':
  /c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/00LOCK-regsem/00new/regsem/libs/regsem.so: undefined symbol: regsem_rcpp_fit_fun
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/regsem’
* restoring previous ‘/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc7/regsem’

The downloaded source packages are in
        ‘/scratch/henrik/Rtmp2KU0W0/downloaded_packages’
Warning message:
In install.packages("regsem") :
  installation of package ‘regsem’ had non-zero exit status

R 4.1.0 with gcc 8.3.1 (works)

$ gcc --version
gcc (GCC) 8.3.1 20190311 (Red Hat 8.3.1-3)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

R version 4.1.0 (2021-05-18) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
...
> install.packages("regsem", repos = "https://cloud.r-project.org")
Installing package into ‘/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/regsem_1.6.2.tar.gz'
Content type 'application/x-gzip' length 79501 bytes (77 KB)
==================================================
downloaded 77 KB

* installing *source* package ‘regsem’ ...
** package ‘regsem’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++14 -I"/software/c4/cbi/software/R-4.1.0-gcc8/lib64/R/include" -DNDEBUG  -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/RcppArmadillo/include' -I/usr/local/include   -fpic  -g -O2  -c RcppExports.cpp -o RcppExports.o
gcc -I"/software/c4/cbi/software/R-4.1.0-gcc8/lib64/R/include" -DNDEBUG  -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/RcppArmadillo/include' -I/usr/local/include   -fpic  -g -O2  -c regsem_init.c -o regsem_init.o
g++ -std=gnu++14 -I"/software/c4/cbi/software/R-4.1.0-gcc8/lib64/R/include" -DNDEBUG  -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/RcppArmadillo/include' -I/usr/local/include   -fpic  -g -O2  -c regsem_rcpp_RAMmult.cpp -o regsem_rcpp_RAMmult.o
g++ -std=gnu++14 -I"/software/c4/cbi/software/R-4.1.0-gcc8/lib64/R/include" -DNDEBUG  -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/RcppArmadillo/include' -I/usr/local/include   -fpic  -g -O2  -c regsem_rcpp_fit_fun.cpp -o regsem_rcpp_fit_fun.o
g++ -std=gnu++14 -I"/software/c4/cbi/software/R-4.1.0-gcc8/lib64/R/include" -DNDEBUG  -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/RcppArmadillo/include' -I/usr/local/include   -fpic  -g -O2  -c regsem_rcpp_grad_ram.cpp -o regsem_rcpp_grad_ram.o
g++ -std=gnu++14 -I"/software/c4/cbi/software/R-4.1.0-gcc8/lib64/R/include" -DNDEBUG  -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/Rcpp/include' -I'/c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/RcppArmadillo/include' -I/usr/local/include   -fpic  -g -O2  -c regsem_rcpp_quasi_calc.cpp -o regsem_rcpp_quasi_calc.o

g++ -std=gnu++14 -shared -L/software/c4/cbi/software/R-4.1.0-gcc8/lib64/R/lib -L/usr/local/lib64 -o regsem.so RcppExports.o regsem_init.o regsem_rcpp_RAMmult.o regsem_rcpp_fit_fun.o regsem_rcpp_grad_ram.o regsem_rcpp_quasi_calc.o -L/software/c4/cbi/software/R-4.1.0-gcc8/lib64/R/lib -lRlapack -L/software/c4/cbi/software/R-4.1.0-gcc8/lib64/R/lib -lRblas -lgfortran -lm -lquadmath -L/software/c4/cbi/software/R-4.1.0-gcc8/lib64/R/lib -lR
installing to /c4/home/henrik/R/x86_64-pc-linux-gnu-library/4.1-CBI-gcc8/00LOCK-regsem/00new/regsem/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (regsem)

The downloaded source packages are in
        ‘/scratch/henrik/RtmpaFOoNm/downloaded_packages’
Rjacobucci commented 3 years ago

Thanks for pointing this out. I'm also not sure why this occurs. I just submitted 1.8.0 to CRAN that was built under 4.1.