Reputation: 1
I'm currently developing an R package named nonprobsvy
and facing difficulties getting it to compile on CRAN's Linux virtual machines (e.g., Debian). The package uses Rcpp
and RcppArmadillo
, and while it installs without issues on my MacBook Air (M1 processor, macOS Sonoma 14.0), it fails on CRAN's Linux environments. I suspect the problem lies with my Makevars
configuration, but I'm not sure how to adjust it for compatibility.
Here is the content of my Makevars
file for now:
## Use the R_HOME indirection to support installations of multiple R version
#PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
When uncomment second line then compilation does not work on my local machine. The error then is
ld: warning: search path '/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0' not found
ld: library 'gfortran' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [nonprobsvy.so] Error 1
ERROR: compilation failed for package ‘nonprobsvy’
─ removing ‘/private/var/folders/yh/41pvj0v54_jfq6w138_b1z740000gn/T/RtmpyINTst/devtools_install_3b69498b0fdf/nonprobsvy’
And here is a screenshot of the error message generated on the CRAN Linux machines: CRAN error
I tried to add a configure file with the flag indicating whether the package is compiled on my local machine or not, like this
#!/bin/sh
# Sprawdź zmienną środowiskową
if [ "$USE_LOCAL_SETTINGS" = "1" ]; then
# Generuj Makevars dla lokalnego użytku
echo "PKG_LIBS = " > src/Makevars
else
# Generuj Makevars dla normalnego użytku
echo "PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)" > src/Makevars
fi
The package installed locally however there was still a problem on CRAN machines. By the way to check for CRAN submission I used rhub package.
I would greatly appreciate any advice on how to modify my Makevars to ensure compatibility across platforms, especially to address any potential issues with the Linux environment on CRAN's VMs. Has anyone encountered similar issues with Rcpp or RcppArmadillo in their packages? Any insights or suggestions would be immensely helpful.
Upvotes: 0
Views: 93