R fail to find GSL library while installing package - r
I am installing a package from the Supplementary materials of an academic journal (https://www.degruyter.com/document/doi/10.1515/snde-2012-0064/html?lang=en).
I've set the Windows system environment variables LIB_GSL (as "C:/R/local323") and PATHS (as "C:/rtools40/bin/", "C:/rtools/mingw64/bin", "C:/R/R-4.1.2/bin")
When I run install.packages("/cobreak_0.1.tar.gz", repos=NULL, type="source"), this happens
* installing *source* package 'cobreak' ...
** using staged installation
** libs
"C:/rtools40/mingw64/bin/"g++ -std=gnu++11 -I"C:/R/R-4.1.2/include" -DNDEBUG -I'C:/Users/Phat/Documents/R/win-library/4.1/Rcpp/include' -I'C:/Users/Phat/Documents/R/win-library/4.1/RcppArmadillo/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c cointmdl.cc -o cointmdl.o
In file included from genmdl.h:5,
from cointmdl.cc:1:
random_arma.h:4:10: fatal error: gsl/gsl_rng.h: No such file or directory
#include <gsl/gsl_rng.h>
^~~~~~~~~~~~~~~
compilation terminated.
make: *** [C:/R/R-4.1.2/etc/x64/Makeconf:243: cointmdl.o] Error 1
ERROR: compilation failed for package 'cobreak'
My guess is the issue was in the Makevars.win file. This is what the Makevars looks like
## This assume that we can call Rscript to ask Rcpp about its locations
## Use the R_HOME indirection to support installations of multiple R version
PKG_LIBS = $(shell $(R_HOME)/bin/Rscript.exe -e "Rcpp:::LdFlags()") $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
Update:
I just found a similar problem here link. However, after following the instruction, I encounter a new error. This time it's a problem with boost
** libs
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/R/R-4.1.2/include" -DNDEBUG -IC:/R/local323/include -I. -I../inst/include -I'C:/Users/Phat/Documents/R/win-library/4.1/Rcpp/include' -I'C:/Users/Phat/Documents/R/win-library/4.1/RcppArmadillo/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c cointmdl.cc -o cointmdl.o
C:/rtools40/mingw64/bin/g++ -std=gnu++11 -I"C:/R/R-4.1.2/include" -DNDEBUG -IC:/R/local323/include -I. -I../inst/include -I'C:/Users/Phat/Documents/R/win-library/4.1/Rcpp/include' -I'C:/Users/Phat/Documents/R/win-library/4.1/RcppArmadillo/include' -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c cpp_r_interface.cc -o cpp_r_interface.o
cpp_r_interface.cc:2:10: fatal error: boost/ptr_container/ptr_vector.hpp: No such file or directory
#include <boost/ptr_container/ptr_vector.hpp>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
I tried to install the "BH" package but the problem still persists.
Does anyone have any ideas on how to fix this?
So I downloaded the zip archive you referenced unpacked it. It contains an R cobreak_0.1.tar.gz which at first glance looks reasonable:
Package: cobreak
Title: Regime-switching cointegration
Description: MCMC estimation of regime-switching cointegration models
Version: 0.1
Date: 2013-12-11
Author: Markus Jochmann
Maintainer: Markus Jochmann <markus.jochmann#ncl.ac.uk>
License: GPL (>= 2)
Depends: Rcpp (>= 0.9.15), RcppArmadillo (>= 0.3.4.3)
LinkingTo: Rcpp, RcppArmadillo
Packaged: 2013-12-11 16:03:39 UTC; markus
However, when I try to install it on my Linux system it hits a wall over a function sympd() called but not defined:
edd#rob:~/Downloads/regimeswitchcoint/cobreak$ install.r .
* installing *source* package ‘cobreak’ ...
** using staged installation
** libs
ccache g++-11 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O3 -Wall -pipe -pedantic -c cointmdl.cc -o cointmdl.o
ccache g++-11 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O3 -Wall -pipe -pedantic -c cpp_r_interface.cc -o cpp_r_interface.o
ccache g++-11 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O3 -Wall -pipe -pedantic -c dist_arma.cc -o dist_arma.o
dist_arma.cc: In function ‘double logpdfmn(const vec&, const mat&)’:
dist_arma.cc:52:37: error: ‘sympd’ was not declared in this scope
52 | result -= as_scalar( x.t() * inv( sympd( Sigma ) ) * x );
| ^~~~~
dist_arma.cc: In function ‘double logpdfmn(const vec&, const vec&, const mat&)’:
dist_arma.cc:62:39: error: ‘sympd’ was not declared in this scope
62 | result -= as_scalar( xmm.t() * inv( sympd( Sigma ) ) * xmm );
| ^~~~~
make: *** [/usr/lib/R/etc/Makeconf:175: dist_arma.o] Error 1
ERROR: compilation failed for package ‘cobreak’
* removing ‘/usr/local/lib/R/site-library/cobreak’
Warning message:
In install.packages(pkgs = f, lib = lib, repos = if (isMatchingFile(f)) NULL else repos) :
installation of package ‘.’ had non-zero exit status
edd#rob:~/Downloads/regimeswitchcoint/cobreak$
Fundamentally, I do not understand why you asked this question at StackOverflow. This is published and peer-reviewed work, and you are given a name and address of an author (or if you must a journal editor). I would contact them.
Edit Turns out this is due to 'stale' package sources, a CRAN archive would have that changed. As the documentation for Armadillo shows, the inv(sympd(...)) is no longer available but inv_sympd(). Making that change on two lines allows the package to build and install. No issues for me:
edd#rob:~/Downloads/regimeswitchcoint/cobreak$ install.r .
* installing *source* package ‘cobreak’ ...
** using staged installation
** libs
ccache g++-11 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O3 -Wall -pipe -pedantic -c dist_arma.cc -o dist_arma.o
ccache g++-11 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O3 -Wall -pipe -pedantic -c ext_arma.cc -o ext_arma.o
ccache g++-11 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O3 -Wall -pipe -pedantic -c genmdl.cc -o genmdl.o
ccache g++-11 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O3 -Wall -pipe -pedantic -c markovmdl.cc -o markovmdl.o
markovmdl.cc: In member function ‘void MarkovMdl::logisdXi(const mat&, arma::vec&)’:
markovmdl.cc:218:18: warning: comparison of integer expressions of different signedness: ‘int’ and ‘const uword’ {aka ‘const unsigned int’} [-Wsign-compare]
218 | for( int l=0; l<logp.n_elem; l++ )
| ~^~~~~~~~~~~~
markovmdl.cc: In member function ‘void MarkovMdl::save_parmem(arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::imat&)’:
markovmdl.cc:521:18: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<arma::Mat<double> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
521 | for( int i=0; i<ximem.size(); i++ )
| ~^~~~~~~~~~~~~
markovmdl.cc: In member function ‘void MarkovMdl::save_parmem(arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::mat&, arma::imat&)’:
markovmdl.cc:547:18: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<arma::Mat<double> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
547 | for( int i=0; i<ximem.size(); i++ )
| ~^~~~~~~~~~~~~
ccache g++-11 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O3 -Wall -pipe -pedantic -c mvlinmdl.cc -o mvlinmdl.o
ccache g++-11 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O3 -Wall -pipe -pedantic -c random_arma.cc -o random_arma.o
ccache g++-11 -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -Wl,-z,relro -o cobreak.so cointmdl.o cpp_r_interface.o dist_arma.o ext_arma.o genmdl.o markovmdl.o mvlinmdl.o random_arma.o -llapack -lblas -lgfortran -lm -lquadmath -lgsl -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-cobreak/00new/cobreak/libs
** R
** data
** byte-compile and prepare package for lazy loading
** help
No man pages found in package ‘cobreak’
*** installing help indices
** building package indices
** 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 (cobreak)
edd#rob:~/Downloads/regimeswitchcoint/cobreak$
Edit 2: I should add that the package does in fact have undeclared dependencies, for example if wants to link with GNU GSL (i.e. the system library provided for example by the package libgsl-dev on the Ubuntu system I use (and for which I am the Debian maintainer, but that is a side detail)) as well as the one inclusion of the Boost header file you noticed. So in sum this reflects poor on the SNDE journal where editors should have enforced stricter reproducibility rules. These are more common now, thanks in part due to leadership by journals such as JStatSoft (where I help as an Associate Editor) but that was not always the case with older papers. Anyway: you can build this package, you "just" need to learn how to use the GSL on Windows which is documented in the support material for R on Windows.
Related
Installing specific R packages from source with Apple M1 chip causing repository index or -lquadmath error
I know this has been asked to death, but I'm having trouble compiling a package in R on my M1 MacBook Air. I need DESeq2, which requires both RcppArmadillo and genefilter. I downloaded an older binary of RccpArmadillo, but genefilter doesn't seem to have one. I have edited my ~/.R/Makevars file extensively, and on RStudio it throws an error related to lquadmath, but in the console it does not. I will post both errors. My ~/.R/Makevars file is as follows: CC = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk CXX = /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk CXX11 = $CXX CXX14 = $CXX CXX17 = $CXX CXX20 = $CXX CFLAGS = -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration CXXFLAGS = -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion CXX11FLAGS = $CXXFLAGS CXX14FLAGS = $CXXFLAGS CXX17FLAGS = $CXXFLAGS CXX20FLAGS = $CXXFLAGS FC = /usr/local/gfortran/bin/gfortran FLIBS = -L/usr/local/gfortran/lib/gcc/aarch64-apple-darwin20.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm The error I get when I try to install in the console is a repository index error, which most people seem to say is because of internet connection problems, but I am connected to the internet and can download other (binary and source) packages without issue. Here is that error: > BiocManager::install("genefilter") Bioconductor version 3.13 (BiocManager 1.30.15), R 4.1.0 (2021-05-18) Installing package(s) 'genefilter' Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘genefilter’ Do you want to attempt to install these from sources? (Yes/no/cancel) yes installing the source package ‘genefilter’ trying URL 'https://bioconductor.org/packages/3.13/bioc/src/contrib/genefilter_1.74.0.tar.gz' Content type 'application/x-gzip' length 805682 bytes (786 KB) ================================================== downloaded 786 KB /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -c half_range_mode.cpp -o half_range_mode.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c init.c -o init.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c nd.c -o nd.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c pAUC.c -o pAUC.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c rowPAUCs.c -o rowPAUCs.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c rowttests.c -o rowttests.o /usr/local/gfortran/bin/gfortran -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c ttest.f -o ttest.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o genefilter.so half_range_mode.o init.o nd.o pAUC.o rowPAUCs.o rowttests.o ttest.o -L/usr/local/gfortran/lib/gcc/aarch64-apple-darwin20.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation The downloaded source packages are in ‘/private/var/folders/tl/40wd6m_91rldyqsnkwqqfdg40000gn/T/RtmpqhSbBH/downloaded_packages’ Old packages: 'RcppArmadillo' Update all/some/none? [a/s/n]: n Warning messages: 1: In .inet_warning(msg) : unable to access index for repository https://bioconductor.org/packages/3.13/bioc/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/bioc/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES' 2: In .inet_warning(msg) : unable to access index for repository https://bioconductor.org/packages/3.13/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES' 3: In .inet_warning(msg) : unable to access index for repository https://bioconductor.org/packages/3.13/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES' 4: In .inet_warning(msg) : unable to access index for repository https://bioconductor.org/packages/3.13/workflows/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/workflows/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES' 5: In .inet_warning(msg) : unable to access index for repository https://bioconductor.org/packages/3.13/books/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/books/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES' 6: In .inet_warning(msg) : installation of package ‘genefilter’ had non-zero exit status Lastly, when I try to install in RStudio I get the following errors: > BiocManager::install("genefilter") 'getOption("repos")' replaces Bioconductor standard repositories, see '?repositories' for details replacement repositories: CRAN: https://cran.rstudio.com/ Bioconductor version 3.13 (BiocManager 1.30.15), R 4.1.0 (2021-05-18) Installing package(s) 'genefilter' Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘genefilter’ Do you want to attempt to install these from sources? (Yes/no/cancel) yes installing the source package ‘genefilter’ trying URL 'https://bioconductor.org/packages/3.13/bioc/src/contrib/genefilter_1.74.0.tar.gz' Content type 'application/x-gzip' length 805682 bytes (786 KB) ================================================== downloaded 786 KB * installing *source* package ‘genefilter’ ... ** using staged installation ** libs /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -c half_range_mode.cpp -o half_range_mode.o half_range_mode.cpp:21:11: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] N = end - start; ~ ~~~~^~~~~~~ half_range_mode.cpp:89:30: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32] N_double_prime = new_end - new_start; ~ ~~~~~~~~^~~~~~~~~~~ 2 warnings generated. /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c init.c -o init.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c nd.c -o nd.o nd.c:245:5: warning: implicit conversion turns floating-point number into integer: 'double' to '_Bool' [-Wfloat-conversion] if(x[i1] || x[i2]){ ^~~~~ ~~ nd.c:245:14: warning: implicit conversion turns floating-point number into integer: 'double' to '_Bool' [-Wfloat-conversion] if(x[i1] || x[i2]){ ~~ ^~~~~ nd.c:246:7: warning: implicit conversion turns floating-point number into integer: 'double' to 'RSInt' (aka 'int') [-Wfloat-conversion] ct += wval[j]; ~~~^~~~~~~~~~ nd.c:247:10: warning: implicit conversion turns floating-point number into integer: 'double' to '_Bool' [-Wfloat-conversion] if( !(x[i1] && x[i2]) ) ans += wval[j]; ^~~~~ ~~ nd.c:247:19: warning: implicit conversion turns floating-point number into integer: 'double' to '_Bool' [-Wfloat-conversion] if( !(x[i1] && x[i2]) ) ans += wval[j]; ~~ ^~~~~ nd.c:247:32: warning: implicit conversion turns floating-point number into integer: 'double' to 'RSInt' (aka 'int') [-Wfloat-conversion] if( !(x[i1] && x[i2]) ) ans += wval[j]; ~~~~^~~~~~~~~~ 6 warnings generated. /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c pAUC.c -o pAUC.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c rowPAUCs.c -o rowPAUCs.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/opt/R/arm64/include -fPIC -g -O2 -Wall -pedantic -Wconversion -Wno-sign-conversion -Wno-implicit-function-declaration -c rowttests.c -o rowttests.o rowttests.c:45:28: warning: implicit conversion turns floating-point number into integer: 'double' to 'int' [-Wfloat-conversion] n[grp][i] = s[grp][i] = ss[grp][i] = 0; ~ ~~~~~~~~~~^~~~~~~~~~~~~~~~ 1 warning generated. /usr/local/gfortran/bin/gfortran -fno-optimize-sibling-calls -fPIC -Wall -g -O2 -c ttest.f -o ttest.o ttest.f:47:12: 47 | dm=dm1-dm2 | 1 Warning: Possible change of value in conversion from REAL(8) to REAL(4) at (1) [-Wconversion] ttest.f:50:12: 50 | dm=dm1/dm2 | 1 Warning: Possible change of value in conversion from REAL(8) to REAL(4) at (1) [-Wconversion] ttest.f:59:13: 59 | tst=(dm1-dm2)/sqrt((1.d0/ng1+1.d0/ng2)*(dss1+dss2)/(ng1+ng2-2)) | 1 Warning: Possible change of value in conversion from REAL(8) to REAL(4) at (1) [-Wconversion] ttest.f:62:10: 62 | tst=(dm1-dm2)/sqrt(dss1/((ng1-1)*ng1)+dss2/((ng2-1)*ng2)) | 1 Warning: Possible change of value in conversion from REAL(8) to REAL(4) at (1) [-Wconversion] /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o genefilter.so half_range_mode.o init.o nd.o pAUC.o rowPAUCs.o rowttests.o ttest.o -L/usr/local/gfortran/lib/gcc/aarch64-apple-darwin20.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation ld: library not found for -lquadmath clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [genefilter.so] Error 1 ERROR: compilation failed for package ‘genefilter’ * removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/genefilter’ * restoring previous ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/genefilter’ The downloaded source packages are in ‘/private/var/folders/tl/40wd6m_91rldyqsnkwqqfdg40000gn/T/RtmpIiaMQO/downloaded_packages’ Old packages: 'RcppArmadillo' Update all/some/none? [a/s/n]: n Warning messages: 1: In .inet_warning(msg) : unable to access index for repository https://bioconductor.org/packages/3.13/bioc/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/bioc/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES' 2: In .inet_warning(msg) : unable to access index for repository https://bioconductor.org/packages/3.13/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES' 3: In .inet_warning(msg) : unable to access index for repository https://bioconductor.org/packages/3.13/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES' 4: In .inet_warning(msg) : unable to access index for repository https://bioconductor.org/packages/3.13/workflows/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/workflows/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES' 5: In .inet_warning(msg) : unable to access index for repository https://bioconductor.org/packages/3.13/books/bin/macosx/big-sur-arm64/contrib/4.1: cannot open URL 'https://bioconductor.org/packages/3.13/books/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES' 6: In .inet_warning(msg) : installation of package ‘genefilter’ had non-zero exit status In addition to the URL errors, I also get the ld: library not found for -lquadmath clang: error: linker command failed with exit code 1 (use -v to see invocation) error (though as far as I can tell I've correctly pointed to gfortran and gcc in my ~/.R/Makevars file). What am I doing wrong here? Why can I download other packages (I installed GOSeq, which also has dependencies that you need to compile) with no issue, but this one no? I have been working on this for hours and would really really appreciate any insight. Thank you!!
Just saw this. I was trying to install DESeq2 earlier on an M1 Mac Air. Not sure which R 4.1 you are using, a possible answer may be here: https://support.bioconductor.org/p/9137290/ They mention Bioconductor does not support R4.1 for M1 macs and recommend using R4.1 for intel based macs.
To install packages from source I prepend arch -arm64 when starting R as in: arch -arm64 R and in R everything just works as it used to on x86.
Cannot install packages kerndwd, sdwd, and flare packages in R for Caret Machine Learning Requirements
I'm trying to install these packages as a machine learning requirements for Caret, below is the snippets to try to install it: library(devtools) ==============kerndwd=========================== install.packages("kerndwd") install_url("https://cran.r-project.org/src/contrib/Archive/kerndwd/kerndwd_2.0.2.tar.gz") * installing *source* package 'kerndwd' ... ** using staged installation ** libs *** arch - i386 C:/Rtools/mingw_32/bin/gfortran -O3 -mtune=generic -c dwd.f90 -o dwd.o make: C:/Rtools/mingw_32/bin/gfortran: Command not found make: *** [C:/PROGRA~1/R/R-36~1.1/etc/i386/Makeconf:236: dwd.o] Error 127 ERROR: compilation failed for package 'kerndwd' * removing 'C:/Users/User/Documents/R/win-library/3.6/kerndwd' Error: Failed to install 'unknown package' from URL: (converted from warning) installation of package ‘C:/Users/User/AppData/Local/Temp/RtmpgnwPZl/filed8c47c72cf0/kerndwd_2.0.2.tar.gz’ had non-zero exit status ==============sdwd============================== install.packages("sdwd") install_url("https://cran.r-project.org/src/contrib/Archive/sdwd/sdwd_1.0.3.tar.gz") * installing *source* package 'sdwd' ... ** using staged installation ** libs *** arch - i386 C:/Rtools/mingw_32/bin/gfortran -O3 -mtune=generic -c auxiliary.f90 -o auxiliary.o make: C:/Rtools/mingw_32/bin/gfortran: Command not found make: *** [C:/PROGRA~1/R/R-36~1.1/etc/i386/Makeconf:236: auxiliary.o] Error 127 ERROR: compilation failed for package 'sdwd' * removing 'C:/Users/User/Documents/R/win-library/3.6/sdwd' Error: Failed to install 'unknown package' from URL: (converted from warning) installation of package ‘C:/Users/User/AppData/Local/Temp/RtmpgnwPZl/filed8c43f746c9/sdwd_1.0.3.tar.gz’ had non-zero exit status ============flare============================= install.packages("flare") install_url("https://cran.r-project.org/src/contrib/Archive/flare/flare_1.6.0.tar.gz") C:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c SFGen.c -o SFGen.o sh: C:/Rtools/mingw_32/bin/gcc: No such file or directory make: *** [C:/PROGRA~1/R/R-36~1.1/etc/i386/Makeconf:208: SFGen.o] Error 127 ERROR: compilation failed for package 'flare' * removing 'C:/Users/User/Documents/R/win-library/3.6/flare' Can anyone clarify me if the package are broken, or is there some way to install it correctly? (Edit) RTools Path Sys.which("make") make "C:\\rtools40\\usr\\bin\\make.exe" Rtools Folder (EDIT 2) It seems that I don't install Rtools completely, Reinstalled Rtools properly with Both 32 Bit and 64 Bit ready for building Packages, and then try to reinstall the packages, kerndwd and sdwd packages already successfully installed, but not with flare packages.. here is the log when I try to install the flare packages > install_url("https://cran.r-project.org/src/contrib/Archive/flare/flare_1.6.0.tar.gz") Downloading package from url: https://cran.r-project.org/src/contrib/Archive/flare/flare_1.6.0.tar.gz √ checking for file 'C:\Users\User\AppData\Local\Temp\RtmpIvesYl\remotes1978219737bd\flare/DESCRIPTION' (5.5s) - preparing 'flare': √ checking DESCRIPTION meta-information ... - cleaning src √ checking vignette meta-information - checking for LF line-endings in source and make files and shell scripts (507ms) - checking for empty or unneeded directories - looking to see if a 'data/datalist' file should be added - building 'flare_1.6.0.tar.gz' Installing package into ‘C:/Users/User/Documents/R/win-library/3.6’ (as ‘lib’ is unspecified) * installing *source* package 'flare' ... ** using staged installation ** libs *** arch - i386 C:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c SFGen.c -o SFGen.o C:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c euc_proj.c -o euc_proj.o C:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c mymath.c -o mymath.o mymath.c: In function 'max_fabs_vc': mymath.c:141:11: warning: variable 'cnt' set but not used [-Wunused-but-set-variable] int i,cnt; ^ C:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c registerDynamicSymbol.c -o registerDynamicSymbol.o C:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c slim_dantzig_ladm_scr.c -o slim_dantzig_ladm_scr.o slim_dantzig_ladm_scr.c: In function 'slim_dantzig_ladm_scr': slim_dantzig_ladm_scr.c:262:24: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,T2,rho,zero,eps,eps1,eps2,ilambda; ^ slim_dantzig_ladm_scr.c:261:15: warning: variable 'ndata' set but not used [-Wunused-but-set-variable] int j,k,m,ndata,dim,nlambda,ite1,ite2,ite,max_ite0,max_ite1,max_ite2,num_scr,num_scr1,num_scr2,num_scr1_tmp,num_scr2_tmp,flag,flag1,flag2; ^ slim_dantzig_ladm_scr.c: In function 'slim_dantzig_ladm_scr2': slim_dantzig_ladm_scr.c:411:21: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,rho,zero,eps,eps1,ilambda; ^ slim_dantzig_ladm_scr.c:410:15: warning: variable 'ndata' set but not used [-Wunused-but-set-variable] int j,k,m,ndata,dim,nlambda,ite1,ite,max_ite0,max_ite1,num_scr,num_scr1,num_scr1_tmp,flag,flag1; ^ C:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c slim_lad_ladm_scr_btr.c -o slim_lad_ladm_scr_btr.o slim_lad_ladm_scr_btr.c: In function 'slim_lad_ladm_scr_btr': slim_lad_ladm_scr_btr.c:236:24: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,T2,rho,zero,eps,eps1,eps2,ilambda,nrholamb; ^ C:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c slim_lasso_ladm_scr.c -o slim_lasso_ladm_scr.o slim_lasso_ladm_scr.c: In function 'lasso_ladm_scr': slim_lasso_ladm_scr.c:12:58: warning: variable 'epsT' set but not used [-Wunused-but-set-variable] double gap_ext,max_dif,beta_dif,threshold,tmpd,ratio,epsT; ^ slim_lasso_ladm_scr.c:12:52: warning: variable 'ratio' set but not used [-Wunused-but-set-variable] double gap_ext,max_dif,beta_dif,threshold,tmpd,ratio,epsT; ^ slim_lasso_ladm_scr.c: In function 'slim_lasso_ladm_scr': slim_lasso_ladm_scr.c:183:24: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,T2,rho,zero,eps,eps1,eps2,ilambda; ^ C:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c slim_lq_ladm_scr_btr.c -o slim_lq_ladm_scr_btr.o slim_lq_ladm_scr_btr.c: In function 'slim_lq_ladm_scr_btr': slim_lq_ladm_scr_btr.c:242:24: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,T2,rho,zero,eps,eps1,eps2,ilambda,nrholamb,qrtn; ^ C:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c slim_sqrt_ladm_scr.c -o slim_sqrt_ladm_scr.o slim_sqrt_ladm_scr.c: In function 'sqrt_ladm_scr': slim_sqrt_ladm_scr.c:12:92: warning: variable 'epsT' set but not used [-Wunused-but-set-variable] double gap_ext,max_dif,alp_dif,beta_dif,mu_dif,threshold,tmpd,alp_tild_sq,alp_th,ratio,epsT; ^ slim_sqrt_ladm_scr.c:12:86: warning: variable 'ratio' set but not used [-Wunused-but-set-variable] double gap_ext,max_dif,alp_dif,beta_dif,mu_dif,threshold,tmpd,alp_tild_sq,alp_th,ratio,epsT; ^ slim_sqrt_ladm_scr.c: In function 'slim_sqrt_ladm_scr': slim_sqrt_ladm_scr.c:285:24: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,T2,rho,zero,eps,eps1,eps2,ilambda,sqrtn,nrholamb; ^ C:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c slimh.c -o slimh.o C:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c sugm_clime_ladm_scr.c -o sugm_clime_ladm_scr.o sugm_clime_ladm_scr.c: In function 'sugm_clime_ladm_scr': sugm_clime_ladm_scr.c:11:24: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,T2,rho,zero,eps,eps1,eps2,ilambda; ^ C:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O3 -Wall -std=gnu99 -mtune=generic -c sugm_tiger_ladm_scr.c -o sugm_tiger_ladm_scr.o sugm_tiger_ladm_scr.c: In function 'tiger_lasso_ladm_scr': sugm_tiger_ladm_scr.c:12:58: warning: variable 'epsT' set but not used [-Wunused-but-set-variable] double gap_ext,max_dif,beta_dif,threshold,tmpd,ratio,epsT,tau0,tau1,tmp; ^ sugm_tiger_ladm_scr.c:12:52: warning: variable 'ratio' set but not used [-Wunused-but-set-variable] double gap_ext,max_dif,beta_dif,threshold,tmpd,ratio,epsT,tau0,tau1,tmp; ^ sugm_tiger_ladm_scr.c: In function 'sugm_tiger_ladm_scr': sugm_tiger_ladm_scr.c:205:24: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,T2,rho,zero,eps,eps1,eps2,ilambda,sqrtn,nrholamb,tau0; ^ C:/Rtools/mingw_32/bin/gcc -shared -s -static-libgcc -o flare.dll tmp.def SFGen.o euc_proj.o mymath.o registerDynamicSymbol.o slim_dantzig_ladm_scr.o slim_lad_ladm_scr_btr.o slim_lasso_ladm_scr.o slim_lq_ladm_scr_btr.o slim_sqrt_ladm_scr.o slimh.o sugm_clime_ladm_scr.o sugm_tiger_ladm_scr.o -LC:/PROGRA~1/R/R-36~1.1/bin/i386 -lR installing to C:/Users/User/Documents/R/win-library/3.6/00LOCK-flare/00new/flare/libs/i386 *** arch - x64 C:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c SFGen.c -o SFGen.o C:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c euc_proj.c -o euc_proj.o C:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c mymath.c -o mymath.o mymath.c: In function 'max_fabs_vc': mymath.c:141:11: warning: variable 'cnt' set but not used [-Wunused-but-set-variable] int i,cnt; ^ C:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c registerDynamicSymbol.c -o registerDynamicSymbol.o C:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c slim_dantzig_ladm_scr.c -o slim_dantzig_ladm_scr.o slim_dantzig_ladm_scr.c: In function 'slim_dantzig_ladm_scr': slim_dantzig_ladm_scr.c:262:24: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,T2,rho,zero,eps,eps1,eps2,ilambda; ^ slim_dantzig_ladm_scr.c:261:15: warning: variable 'ndata' set but not used [-Wunused-but-set-variable] int j,k,m,ndata,dim,nlambda,ite1,ite2,ite,max_ite0,max_ite1,max_ite2,num_scr,num_scr1,num_scr2,num_scr1_tmp,num_scr2_tmp,flag,flag1,flag2; ^ slim_dantzig_ladm_scr.c: In function 'slim_dantzig_ladm_scr2': slim_dantzig_ladm_scr.c:411:21: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,rho,zero,eps,eps1,ilambda; ^ slim_dantzig_ladm_scr.c:410:15: warning: variable 'ndata' set but not used [-Wunused-but-set-variable] int j,k,m,ndata,dim,nlambda,ite1,ite,max_ite0,max_ite1,num_scr,num_scr1,num_scr1_tmp,flag,flag1; ^ C:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c slim_lad_ladm_scr_btr.c -o slim_lad_ladm_scr_btr.o slim_lad_ladm_scr_btr.c: In function 'slim_lad_ladm_scr_btr': slim_lad_ladm_scr_btr.c:236:24: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,T2,rho,zero,eps,eps1,eps2,ilambda,nrholamb; ^ C:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c slim_lasso_ladm_scr.c -o slim_lasso_ladm_scr.o slim_lasso_ladm_scr.c: In function 'lasso_ladm_scr': slim_lasso_ladm_scr.c:12:58: warning: variable 'epsT' set but not used [-Wunused-but-set-variable] double gap_ext,max_dif,beta_dif,threshold,tmpd,ratio,epsT; ^ slim_lasso_ladm_scr.c:12:52: warning: variable 'ratio' set but not used [-Wunused-but-set-variable] double gap_ext,max_dif,beta_dif,threshold,tmpd,ratio,epsT; ^ slim_lasso_ladm_scr.c: In function 'slim_lasso_ladm_scr': slim_lasso_ladm_scr.c:183:24: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,T2,rho,zero,eps,eps1,eps2,ilambda; ^ C:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c slim_lq_ladm_scr_btr.c -o slim_lq_ladm_scr_btr.o slim_lq_ladm_scr_btr.c: In function 'slim_lq_ladm_scr_btr': slim_lq_ladm_scr_btr.c:242:24: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,T2,rho,zero,eps,eps1,eps2,ilambda,nrholamb,qrtn; ^ C:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c slim_sqrt_ladm_scr.c -o slim_sqrt_ladm_scr.o slim_sqrt_ladm_scr.c: In function 'sqrt_ladm_scr': slim_sqrt_ladm_scr.c:12:92: warning: variable 'epsT' set but not used [-Wunused-but-set-variable] double gap_ext,max_dif,alp_dif,beta_dif,mu_dif,threshold,tmpd,alp_tild_sq,alp_th,ratio,epsT; ^ slim_sqrt_ladm_scr.c:12:86: warning: variable 'ratio' set but not used [-Wunused-but-set-variable] double gap_ext,max_dif,alp_dif,beta_dif,mu_dif,threshold,tmpd,alp_tild_sq,alp_th,ratio,epsT; ^ slim_sqrt_ladm_scr.c: In function 'slim_sqrt_ladm_scr': slim_sqrt_ladm_scr.c:285:24: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,T2,rho,zero,eps,eps1,eps2,ilambda,sqrtn,nrholamb; ^ C:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c slimh.c -o slimh.o C:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c sugm_clime_ladm_scr.c -o sugm_clime_ladm_scr.o sugm_clime_ladm_scr.c: In function 'sugm_clime_ladm_scr': sugm_clime_ladm_scr.c:11:24: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,T2,rho,zero,eps,eps1,eps2,ilambda; ^ C:/Rtools/mingw_64/bin/gcc -I"C:/PROGRA~1/R/R-36~1.1/include" -DNDEBUG -O2 -Wall -std=gnu99 -mtune=generic -c sugm_tiger_ladm_scr.c -o sugm_tiger_ladm_scr.o sugm_tiger_ladm_scr.c: In function 'tiger_lasso_ladm_scr': sugm_tiger_ladm_scr.c:12:58: warning: variable 'epsT' set but not used [-Wunused-but-set-variable] double gap_ext,max_dif,beta_dif,threshold,tmpd,ratio,epsT,tau0,tau1,tmp; ^ sugm_tiger_ladm_scr.c:12:52: warning: variable 'ratio' set but not used [-Wunused-but-set-variable] double gap_ext,max_dif,beta_dif,threshold,tmpd,ratio,epsT,tau0,tau1,tmp; ^ sugm_tiger_ladm_scr.c: In function 'sugm_tiger_ladm_scr': sugm_tiger_ladm_scr.c:205:24: warning: variable 'zero' set but not used [-Wunused-but-set-variable] double T,T1,T2,rho,zero,eps,eps1,eps2,ilambda,sqrtn,nrholamb,tau0; ^ C:/Rtools/mingw_64/bin/gcc -shared -s -static-libgcc -o flare.dll tmp.def SFGen.o euc_proj.o mymath.o registerDynamicSymbol.o slim_dantzig_ladm_scr.o slim_lad_ladm_scr_btr.o slim_lasso_ladm_scr.o slim_lq_ladm_scr_btr.o slim_sqrt_ladm_scr.o slimh.o sugm_clime_ladm_scr.o sugm_tiger_ladm_scr.o -LC:/PROGRA~1/R/R-36~1.1/bin/x64 -lR installing to C:/Users/User/Documents/R/win-library/3.6/00LOCK-flare/00new/flare/libs/x64 ** R ** data ** inst ** byte-compile and prepare package for lazy loading Error: (converted from warning) package 'lattice' was built under R version 3.6.3 Execution halted ERROR: lazy loading failed for package 'flare' * removing 'C:/Users/User/Documents/R/win-library/3.6/flare' Error: Failed to install 'unknown package' from URL: (converted from warning) installation of package ‘C:/Users/User/AppData/Local/Temp/RtmpIvesYl/file1978444e5b5a/flare_1.6.0.tar.gz’ had non-zero exit status
By using publicated archived binaries in https://mran.microsoft.com/timemachine, if there contains old package in the time machine, even package flare can be installed using renv installer with format package#version install.packages("renv") renv::install("flare#1.6.0")
RcppArmadillo: failing to install on Ubuntu16.04
I am trying to install Rcpp on Ubuntu. Here are some environment details: R version:3.4.0 g++ --version: Ubuntu 5.4.0-6ubuntu1~16.04.4 If I have a blank Makevars file, RcppArmadillo can be installed but with some warnings about OpenMp g++ -I/usr/share/R/include -DNDEBUG -I"/home/march/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I../inst/include -fopenmp -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppArmadillo.cpp -o RcppArmadillo.o In file included from ../inst/include/armadillo:52:0, from ../inst/include/RcppArmadilloForward.h:46, from ../inst/include/RcppArmadillo.h:31, from RcppArmadillo.cpp:22: ../inst/include/armadillo_bits/compiler_setup.hpp:487:118: note: #pragma message: WARNING: support for OpenMP requires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags #pragma message ("WARNING: support for OpenMP requires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags") ^ g++ -I/usr/share/R/include -DNDEBUG -I"/home/march/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I../inst/include -fopenmp -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o In file included from ../inst/include/armadillo:52:0, from ../inst/include/RcppArmadilloForward.h:46, from ../inst/include/RcppArmadillo.h:31, from RcppExports.cpp:4: ../inst/include/armadillo_bits/compiler_setup.hpp:487:118: note: #pragma message: WARNING: support for OpenMP requires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags #pragma message ("WARNING: support for OpenMP requires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags") ^ g++ -I/usr/share/R/include -DNDEBUG -I"/home/march/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -I../inst/include -fopenmp -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c fastLm.cpp -o fastLm.o In file included from ../inst/include/armadillo:52:0, from ../inst/include/RcppArmadilloForward.h:46, from ../inst/include/RcppArmadillo.h:31, from fastLm.cpp:22: ../inst/include/armadillo_bits/compiler_setup.hpp:487:118: note: #pragma message: WARNING: support for OpenMP requires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags #pragma message ("WARNING: support for OpenMP requires C++11/C++14; add -std=c++11 or -std=c++14 to compiler flags") ^ g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RcppArmadillo.so RcppArmadillo.o RcppExports.o fastLm.o -fopenmp -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR installing to /home/march/R/x86_64-pc-linux-gnu-library/3.4/RcppArmadillo/libs ** R ** inst ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** installing vignettes ** testing if installed package can be loaded * DONE (RcppArmadillo) After I added PKG_CXXFLAGS=-std=c++11 to Makevars, I got a error message as following: g++ -I/usr/share/R/include -DNDEBUG -I"/home/march/R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" -std=c++11 -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c RcppArmadillo.cpp -o RcppArmadillo.o RcppArmadillo.cpp:22:27: fatal error: RcppArmadillo.h: No such file or directory compilation terminated. /usr/lib/R/etc/Makeconf:168: recipe for target 'RcppArmadillo.o' failed make: *** [RcppArmadillo.o] Error 1 ERROR: compilation failed for package ‘RcppArmadillo’ * removing ‘/home/march/R/x86_64-pc-linux-gnu-library/3.4/RcppArmadillo’ * restoring previous ‘/home/march/R/x86_64-pc-linux-gnu-library/3.4/RcppArmadillo’ Warning in install.packages : installation of package ‘RcppArmadillo’ had non-zero exit status The wield thing is that when I tried to re-install RcppArmadillo on my mac(10.11), the same problem occurred. Could anybody enlighten me?
This is 16.10 which I have here at hone, if you wish I can repeat it at work tomorrow with 16.04: edd#bud:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.10 Release: 16.10 Codename: yakkety edd#bud:~$ Rscript -e 'install.packages("RcppArmadillo")' Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/src/contrib/RcppArmadillo_0.7.960.1.1.tar.gz' Content type 'application/x-gzip' length 1115539 bytes (1.1 MB) ================================================== downloaded 1.1 MB * installing *source* package ‘RcppArmadillo’ ... ** package ‘RcppArmadillo’ successfully unpacked and MD5 sums checked 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 we are using the GNU C++ compiler... yes checking whether ccache g++ accepts -g... yes checking how to run the C++ preprocessor... ccache g++ -E checking whether we are using the GNU C++ compiler... (cached) yes checking whether ccache g++ accepts -g... (cached) yes checking whether g++ version is sufficient... (6.2.0) yes checking LAPACK_LIBS... system LAPACK found checking for OpenMP... found configure: creating ./config.status config.status: creating inst/include/RcppArmadilloLapack.h ** libs ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I../inst/include -fopenmp -fpic -g -O3 -Wall -pipe -Wno-unused -pedantic -Werror -march=native -c RcppArmadillo.cpp -o RcppArmadillo.o ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I../inst/include -fopenmp -fpic -g -O3 -Wall -pipe -Wno-unused -pedantic -Werror -march=native -c RcppExports.cpp -o RcppExports.o ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I../inst/include -fopenmp -fpic -g -O3 -Wall -pipe -Wno-unused -pedantic -Werror -march=native -c fastLm.cpp -o fastLm.o ccache g++ -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RcppArmadillo.so RcppArmadillo.o RcppExports.o fastLm.o -fopenmp -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR installing to /usr/local/lib/R/site-library/RcppArmadillo/libs ** R ** inst ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** installing vignettes ** testing if installed package can be loaded * DONE (RcppArmadillo) The downloaded source packages are in ‘/tmp/Rtmp2hQNrn/downloaded_packages’ edd#bud:~$ That I usee ccache is not material. This. Just. Works.
What does `LinkingTo` do in an R package? [duplicate]
This question already has an answer here: Do I need to import RccpEigen in the DESCRIPTION file for an R package using it, or is "LinkingTo" enough? (1 answer) Closed 5 years ago. I am building an R package whose description contains: LinkingTo: Rcpp The package has a fairly deep makefile structure. I know using R CMD build . creates and modifies variables such as CXX11FLAGS which must be passed down through subsequent layers of makefiles. I suspect that LinkingTo also produces such a variable, which I must be aware of and pass along. I suspect this because, several layers down, I hit the error: mycode.hpp:5:10: fatal error: Rcpp.h: No such file or directory #include <Rcpp.h> I'm not sure how to inform this file's makefile as to where Rcpp is. I suspect the hypothesized variable could be used, but I do not know that variable's name. Can anyone clarify?
Here is LinkingTo: from a smaller in-progress package of mine: LinkingTo: Rcpp, RcppArmadillo When compiling, these two packages are both uses via -I... switches: edd#bud:~/git/rcppkalman(master)$ ./cleanup edd#bud:~/git/rcppkalman(master)$ R CMD INSTALL . * installing to library ‘/usr/local/lib/R/site-library’ * installing *source* package ‘RcppKalman’ ... ** libs ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppArmadillo/include" -fpic -g -O3 -Wall -pipe -Wno-unused -pedantic -Werror -march=native -c RcppExports.cpp -o RcppExports.o ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppArmadillo/include" -fpic -g -O3 -Wall -pipe -Wno-unused -pedantic -Werror -march=native -c expmMat.cpp -o expmMat.o ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppArmadillo/include" -fpic -g -O3 -Wall -pipe -Wno-unused -pedantic -Werror -march=native -c kfpredict.cpp -o kfpredict.o ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppArmadillo/include" -fpic -g -O3 -Wall -pipe -Wno-unused -pedantic -Werror -march=native -c kfupdate.cpp -o kfupdate.o ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppArmadillo/include" -fpic -g -O3 -Wall -pipe -Wno-unused -pedantic -Werror -march=native -c ltidisc.cpp -o ltidisc.o ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppArmadillo/include" -fpic -g -O3 -Wall -pipe -Wno-unused -pedantic -Werror -march=native -c rtssmooth.cpp -o rtssmooth.o ccache g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppArmadillo/include" -fpic -g -O3 -Wall -pipe -Wno-unused -pedantic -Werror -march=native -c tfsmooth.cpp -o tfsmooth.o g++ -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RcppKalman.so RcppExports.o expmMat.o kfpredict.o kfupdate.o ltidisc.o rtssmooth.o tfsmooth.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR installing to /usr/local/lib/R/site-library/RcppKalman/libs ** R ** demo ** inst ** preparing package for lazy loading ** help *** installing help indices ** building package indices ** testing if installed package can be loaded * DONE (RcppKalman) edd#bud:~/git/rcppkalman(master)$ There is nothing else needed. Writing R Extensions says: A package that wishes to make use of header files in other packages needs to declare them as a comma-separated list in the field 'LinkingTo' in the 'DESCRIPTION' file. For example LinkingTo: link1, link2 The 'LinkingTo' field can have a version requirement which is checked at installation. Specifying a package in 'LinkingTo' suffices if these are C++ headers containing source code or static linking is done at installation: the packages do not need to be (and usually should not be) listed in the 'Depends' or 'Imports' fields. This includes CRAN package BH (https://CRAN.R-project.org/package=BH) and almost all users of RcppArmadillo (https://CRAN.R-project.org/package=RcppArmadillo) and RcppEigen (https://CRAN.R-project.org/package=RcppEigen). For another use of 'LinkingTo' see *note Linking to native routines in other packages::. and that is on point as can be seen from the (essentially empty) src/Makevars: PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) which is the standard uses by RcppArmadillo to support the external linking for LAPACK and BLAS. Note that my package is a little behind as RcppArmadillo in its most recent release now uses this inst/skeleton/Makevars passes into every package created via RcppArmadillo.package.skeleton(): ## optional #CXX_STD = CXX11 PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) PKG_LIBS = $(SHLIB_OPENMP_CFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) to also support OpenMP where available. That is the current recommended form.
I edited my Makefile to include the following dark magic: VARS_OLD := $(.VARIABLES) $(foreach v, \ $(filter-out $(VARS_OLD) VARS_OLD,$(.VARIABLES)), \ $(info $(v) = $($(v)))) This prints out all of the environmental variables passed to the make process by R when you run R CMD build .. Digging in this revealed some very interesting variables: ALL_CPPFLAGS = -I/usr/share/R/include -DNDEBUG -I"/home/myuser/.R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" CLINK_CPPFLAGS = -I"/home/myuser/.R/x86_64-pc-linux-gnu-library/3.4/Rcpp/include" R_INCLUDE_DIR = /usr/share/R/include Note that these variables contain the -I flag and, thus, must be communicated to any part of the build process that relies on those. By passing these between makefiles I was able to achieve compilation.
R install package Rcplex
I already follow INSTALL STEP at INSTALL but something wrong happen when I install the package c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG -I"C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1263/cplex/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -Wall -std=gnu99 -mtune=core2 -c Rcplex.c -o Rcplex.o c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG -I"C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1263/cplex/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -Wall -std=gnu99 -mtune=core2 -c Rcplex_QCP.c -o Rcplex_QCP.o Rcplex_QCP.c: In function 'Rcplex_QCP': Rcplex_QCP.c:37:7: warning: unused variable 'trace' [-Wunused-variable] int trace = INTEGER(getListElement(control,"trace"))[0]; ^ c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG -I"C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1263/cplex/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -Wall -std=gnu99 -mtune=core2 -c Rcplex_params.c -o Rcplex_params.o c:/Rtools/mingw_32/bin/gcc -I"C:/PROGRA~1/R/R-33~1.1/include" -DNDEBUG -I"C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1263/cplex/include" -I"d:/Compiler/gcc-4.9.3/local330/include" -O3 -Wall -std=gnu99 -mtune=core2 -c Rcplex_utils.c -o Rcplex_utils.o C:/Rtools/mingw_32/bin/../lib/gcc/i686-w64-mingw32/4.9.3/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lcplex1263 collect2.exe: error: ld returned 1 exit status no DLL was created ERROR: compilation failed for package 'Rcplex'
When you go to the package documentation at: https://cran.r-project.org/web/packages/Rcplex/index.html ... You make no mention of satisfying the system requirements: SystemRequirements: IBM ILOG CPLEX libraries and headers
The linker that gcc uses, ld, cannot find the shared library for CPLEX. According to the INSTALL document, you need to verify that CPLEX_LIB_PATH is defined to point to the path where the CPLEX dll's are located. From your output, I'd venture set CPLEX_LIB_PATH="C:/Program Files/IBM/ILOG/CPLEX_Studio_Community1263/cplex/lib" is what you need.