MetaboAnalystR - Installation Issues (Compilation failed in MacOS)

Hi there,

I am trying to download the MetaboAnalystR package and keep running into issues. I’m using a new (M1) Mac and have all of the required softwares installed (Xcode command line, Xquartz11), but have just run into a problem which seems to be due to the ‘Rcpp’ package. I re-installed the package, but that didn’t work, unfortunately. Any help or advice would be really appreciated! Thanks very much!

Below is the code that I am using to install MetaboAnalystR:

if (!requireNamespace("BiocManager", quietly = TRUE))
  install.packages("BiocManager")

BiocManager::install("BiocVersion", force = TRUE)

BiocManager::install(c("impute","pcaMethods","globaltest","GlobalAncova","Rgraphviz","preprocessCore",
                       "genefilter","sva","limma","KEGGgraph","siggenes","BiocParallel","MSnbase",
                       "multtest","RBGL","edgeR","fgsea", "ctc"), force = TRUE)

install.packages("devtools")
library(devtools)


## Restart r
Sys.which("make")
find_rtools()

install.packages(c("pls","Rserve","ellipse","scatterplot3d","Cairo","randomForest","caTools","e1071","som",
                   "RJSONIO","ROCR","pheatmap","pROC","fitdistrplus","lars","Hmisc","caret","crmn"))

install.packages("igraph")
library("igraph") 

devtools::install_version('mnormt', version = "1.5-7", repos="http://cran.rstudio.com")

library("quantreg") 

install.packages("Rcpp", dependencies = TRUE)

install.packages(c("impute", "pcaMethods", "globaltest","GlobalAncova", 
                   "Rgraphviz", "preprocessCore", "genefilter", "SSPA", 
                   "sva", "limma", "KEGGgraph", "siggenes","BiocParallel", 
                   "MSnbase", "multtest","RBGL","edgeR","fgsea","httr","qs",
                   "metap","entropy","rsm","Rcpp","gplots","reshape","spls"))



package_dependencies <-(c("impute","pcaMethods","globaltest","GlobalAncova","Rgraphviz","preprocessCore",
                          "genefilter","sva","limma","KEGGgraph","siggenes","BiocParallel","MSnbase",
                          "multtest","RBGL","edgeR","fgsea","httr","pls","Rserve","ellipse","scatterplot3d","Cairo","randomForest","caTools","e1071","som",
                          "RJSONIO","ROCR","pheatmap","pROC","fitdistrplus","lars","Hmisc","caret","crmn", "impute", "pcaMethods", "globaltest","GlobalAncova", 
                          "Rgraphviz", "preprocessCore", "genefilter", 
                          "sva", "limma", "KEGGgraph", "siggenes","BiocParallel", 
                          "MSnbase", "multtest","RBGL","edgeR","fgsea","httr","qs",
                          "metap","entropy","rsm","Rcpp","gplots","reshape","spls", "mnormt"))


lapply(package_dependencies, require, character.only = TRUE)

devtools::install_github("xia-lab/MetaboAnalystR", build = TRUE, build_vignettes = TRUE, build_manual =T)

And here are the error messages that I am getting:

Installing package into ‘/Users/alex.ward/Library/R/x86_64/4.1/library’
(as ‘lib’ is unspecified)
* installing *source* package ‘MetaboAnalystR’ ...
** using staged installation
** libs
rm -f fortran/decorana.o c/Internal_utils_batch.o c/util.o cpp/melt.o c/fastmatch.o c/nncgc.o c/mzROI.o c/xcms_binners.o Exports.o
gfortran -mmacosx-version-min=10.13 -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c fortran/decorana.f -o fortran/decorana.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/alex.ward/Library/R/x86_64/4.1/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c c/Internal_utils_batch.c -o c/Internal_utils_batch.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/alex.ward/Library/R/x86_64/4.1/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c c/util.c -o c/util.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/alex.ward/Library/R/x86_64/4.1/library/Rcpp/include' -I/usr/local/include    -fPIC  -Wall -g -O2  -c cpp/melt.cpp -o cpp/melt.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/alex.ward/Library/R/x86_64/4.1/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c c/fastmatch.c -o c/fastmatch.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/alex.ward/Library/R/x86_64/4.1/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c c/nncgc.c -o c/nncgc.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/alex.ward/Library/R/x86_64/4.1/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c c/mzROI.c -o c/mzROI.o
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/alex.ward/Library/R/x86_64/4.1/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c c/xcms_binners.c -o c/xcms_binners.o
c/xcms_binners.c:11:1: warning: '/*' within block comment [-Wcomment]
/*
^
c/xcms_binners.c:361:7: warning: unused variable 'idx' [-Wunused-variable]
  int idx = 0;
      ^
2 warnings generated.
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/alex.ward/Library/R/x86_64/4.1/library/Rcpp/include' -I/usr/local/include    -fPIC  -Wall -g -O2  -c Exports.cpp -o Exports.o
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o MetaboAnalystR.so fortran/decorana.o c/Internal_utils_batch.o c/util.o cpp/melt.o c/fastmatch.o c/nncgc.o c/mzROI.o c/xcms_binners.o Exports.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0'
ld: warning: ignoring file fortran/decorana.o, building for macOS-x86_64 but attempting to link with file built for unknown-arm64
ld: warning: ignoring file /usr/local/gfortran/lib/libgfortran.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /usr/local/gfortran/lib/libquadmath.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
installing to /Users/alex.ward/Library/R/x86_64/4.1/library/00LOCK-MetaboAnalystR/00new/MetaboAnalystR/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
Error: package or namespace load failed for ‘MetaboAnalystR’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Users/alex.ward/Library/R/x86_64/4.1/library/00LOCK-MetaboAnalystR/00new/MetaboAnalystR/libs/MetaboAnalystR.so':
  dlopen(/Users/alex.ward/Library/R/x86_64/4.1/library/00LOCK-MetaboAnalystR/00new/MetaboAnalystR/libs/MetaboAnalystR.so, 0x0006): symbol not found in flat namespace '_cutup_'
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Users/alex.ward/Library/R/x86_64/4.1/library/MetaboAnalystR’
Warning message:
In i.p(...) :
  installation of package ‘/var/folders/70/_g5nwm3j2734nzw774byyydw0000gn/T//RtmpWZMr2r/file3eb617da5c0d/MetaboAnalystR_3.2.0.tar.gz’ had non-zero exit status

Thanks a lot for reading through!

1 Like

Thanks for reporting this issue. This is an uncommon issue. Have you tried to reboot your PC? Can you try to upgrade R into version 4.2 or above? Have you tried to use the latest version of gcc/g++ compiler (>11)?

Try these potential solutions. If none of them works, please try other people’s Mac to see if you can reproduce the same issue, or if this is related to the lastest version of MacOS…

Bests,
Zhiqiang

Hi Zhiqiang,

Thanks very much for your response. Yes, I have a feeling that this is quite an uncommon issue. I have rebooted the mac, I’ve upgraded to R v4.2 and also made sure I’m using the latest version of gcc, and, unfortunately none of these have solved the problem. I am still getting the exact same error.

I am using two Macs, but they both have the same macOS, and it has successfully installed on my other Mac, which is great. But still very confusing as to why this happened. Could it possibly have something to do with a .Makevars file that hasn’t been found during compilation?

Best,

Alex

Hi there,

I’ve solved the issue. It was related to having the wrong R4.2.1 installed (the intel version) and wrong gfortran (8.2) installed on my mac, rather than the new version for the M1 chip/arm64 (12), from the following page: Tools - R for Mac OS X - developer's page - GNU Fortan for Xcode

Thanks again for the help!

Best,

Alex

2 Likes