0

I'm new to Rcpp. I'm trying to install a package from github. By the instruction of README.md,

# Install release version from CRAN
install.packages("devtools")
# Install development version from GitHub
devtools::install_github("shuangj00/IntegrativeBayes")

I got warnings when running these codes:

ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: directory not found for option '-L/usr/local/gfortran/lib'
ld: library not found for -lquadmath
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [IntegrativeBayes.so] Error 1
ERROR: compilation failed for package ‘IntegrativeBayes’

I have been stuck at the very beginning (installing the package) for the whole afternoon. Anyone knows how this could be fixed?

  • 1
    Have you compiled a package from source on your macOS machine? There are many other steps you need besides installing `devtools`. – Dirk Eddelbuettel Aug 24 '22 at 00:48
  • @DirkEddelbuettel Hi Dirk, this is my first time trying to install a package from GitHub. BTW I watched your Rcpp tutorial on YouTube today, it helped a lot! – Yanghong Guo Aug 24 '22 at 01:48
  • Hi @Yanghong -- glad you liked the video. I am not a macOS user but you probably need to read up on what to do next. There is a mailing r-sig-mac for R on macOS to ask some power users. – Dirk Eddelbuettel Aug 24 '22 at 01:50

1 Answers1

1

Welcome to StackOverflow, and as I alluded to in my comment, you first need to enable compilation from source on your Mac. The tutorial here is usually current, if not some macOS experts may provide other ones.

The repo itself is fine and installs very cleanly on my Linux machine the little wrapper to remotes::install_github() that I use:

edd@rob:~$ installGithub.r shuangj00/IntegrativeBayes
Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo shuangj00/IntegrativeBayes@HEAD

Skipping 1 packages ahead of CRAN: Rcpp
✔  checking for file ‘/tmp/remotes3c654e4cdc73ce/shuangj00-IntegrativeBayes-c76cfd4/DESCRIPTION’
─  preparing ‘IntegrativeBayes’:
✔  checking DESCRIPTION meta-information
─  cleaning src
─  checking for LF line-endings in source and make files and shell scripts
─  checking for empty or unneeded directories
   Omitted ‘LazyData’ from DESCRIPTION
─  building ‘IntegrativeBayes_1.0.tar.gz’
   
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘IntegrativeBayes’ ...
** using staged installation
** libs
ccache g++-11  -std=gnu++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'   -fopenmp  -fpic  -g -O3 -Wall -pipe -pedantic -Wno-ignored-attributes  -c RcppExports.cpp -o RcppExports.o
ccache g++-11  -std=gnu++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'   -fopenmp  -fpic  -g -O3 -Wall -pipe -pedantic -Wno-ignored-attributes  -c ZINBwCOV.cpp -o ZINBwCOV.o
ccache g++-11 -std=gnu++11 -Wl,-S -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o IntegrativeBayes.so RcppExports.o ZINBwCOV.o -fopenmp -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-IntegrativeBayes/00new/IntegrativeBayes/libs
** R
** demo
** 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 (IntegrativeBayes)
edd@rob:~$ 
Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • It finally went through with the tutorial you provided. There was actually some tricks with MacOS, when installing tools like Xcode, try to avoid the latest version. Thanks, Dirk! – Yanghong Guo Aug 24 '22 at 05:20
  • Sounds good. I think the course here is to close this as a duplicate, we have been over this a few times -- see eg the linked qiestion. – Dirk Eddelbuettel Aug 24 '22 at 11:41