velocyto-team / velocyto.R

RNA velocity estimation in R
http://velocyto.org
177 stars 214 forks source link

Installation Error: clang: error: unsupported option '-fopenmp' #2

Open ShanSabri opened 6 years ago

ShanSabri commented 6 years ago

Installation Error:

> options(tz="America/Los_Angeles")
> library(devtools)
> install_github("velocyto-team/velocyto.R")
Downloading GitHub repo velocyto-team/velocyto.R@master
from URL https://api.github.com/repos/velocyto-team/velocyto.R/zipball/master
Installing velocyto.R
Running command /Library/Frameworks/R.framework/Resources/bin/R 
Arguments:
CMD
INSTALL
/private/var/folders/5m/jlrrrsfd719d0ks0qg48_pg80000gn/T/Rtmpv4UBqe/devtools1d0851a3bc6b/velocyto-team-velocyto.R-9741595
--library=/Library/Frameworks/R.framework/Versions/3.4/Resources/library
--install-tests

* installing *source* package ‘velocyto.R’ ...
Warning in as.POSIXlt.POSIXct(x, tz) :
  unknown timezone 'default/America/Los_Angeles'
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo/include" -I/usr/local/include  -std=c++11 -fopenmp -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
clang: error: unsupported option '-fopenmp'
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘velocyto.R’
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/velocyto.R’

Installation failed: run(bin, args = real_cmdargs, stdout_line_callback = real_callback(stdout),      stderr_line_callback = real_callback(stderr), stdout_callback = real_block_callback,      stderr_callback = real_block_callback, echo_cmd = echo, echo = show,      spinner = spinner, error_on_status = fail_on_status, timeout = timeout) : System command error
> 

Session info:

─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value                       
 version  R version 3.4.1 (2017-06-30)
 os       macOS High Sierra 10.13     
 system   x86_64, darwin15.6.0        
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       <NA>                        
 date     2017-10-24                  

─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 package     * version     date       source                            
 assertthat    0.2.0       2017-04-11 CRAN (R 3.4.0)                    
 backports     1.1.1       2017-09-25 CRAN (R 3.4.2)                    
 callr         1.0.0.9000  2017-08-23 Github (mangothecat/callr@2dffbbe)
 clisymbols    1.2.0       2017-05-21 CRAN (R 3.4.0)                    
 crayon        1.3.4       2017-09-16 CRAN (R 3.4.1)                    
 curl          3.0         2017-10-06 CRAN (R 3.4.2)                    
 debugme       1.1.0       2017-10-22 CRAN (R 3.4.2)                    
 devtools    * 1.13.3.9000 2017-08-23 Github (hadley/devtools@5517fdb)  
 digest        0.6.12      2017-01-27 CRAN (R 3.4.0)                    
 git2r         0.19.0      2017-07-19 CRAN (R 3.4.1)                    
 httr          1.3.1       2017-08-20 CRAN (R 3.4.1)                    
 memoise       1.1.0       2017-04-21 CRAN (R 3.4.0)                    
 pkgbuild      0.0.0.9000  2017-08-23 Github (r-lib/pkgbuild@6574561)   
 pkgload       0.0.0.9000  2017-08-23 Github (r-pkgs/pkgload@558aaac)   
 processx      2.0.0.1     2017-07-30 CRAN (R 3.4.1)                    
 R6            2.2.2       2017-06-17 CRAN (R 3.4.0)                    
 rlang         0.1.2.9000  2017-09-06 Github (tidyverse/rlang@6a589ec)  
 rprojroot     1.2         2017-01-16 CRAN (R 3.4.0)                    
 rstudioapi    0.7         2017-09-07 CRAN (R 3.4.1)                    
 sessioninfo   1.0.1       2017-08-23 Github (r-lib/sessioninfo@e813de4)
 usethis     * 1.0.0       2017-10-22 CRAN (R 3.4.2)                    
 withr         2.0.0       2017-07-28 CRAN (R 3.4.1)      

Any advice would be appreciated.

pkharchenko commented 6 years ago

I've made an updated to Makevars to remove explicit -fopenmp which only works on some platforms. Please try installing now.

ShanSabri commented 6 years ago

Unfortunately using the same installation protocol as above, I was returned the exact same error.

tractatus commented 6 years ago

@ShanSabri for macOS the default compiler Apple clang LLVM does not support openmp yet. R uses the Apple clang compiler by default on macOS. The solution is simply to download another clang compiler that supports openmp using homebrew.

From terminal if you do not have boost install that as well since boost is not included in macOS. This will also install hdf5 if you want to tryout with loom. Note that this will overwrite your Makevars to use clang installed by homebrew rather than apple's. In terminal:

brew install llvm
brew install boost
brew install homebrew/science/hdf5 --enable-cxx
mkdir -p ~/.R
cat <<- EOF > ~/.R/Makevars
     # The following statements are required to use the clang4 binary
     CC=/usr/local/clang4/bin/clang
     CXX=/usr/local/clang4/bin/clang++
     CXX11=/usr/local/clang4/bin/clang++
     CXX14=/usr/local/clang4/bin/clang++
     CXX17=/usr/local/clang4/bin/clang++
     CXX1X=/usr/local/clang4/bin/clang++
     LDFLAGS=-L/usr/local/clang4/lib
     # End clang4 inclusion statements
     EOF

Or you can simply just try my fork of this package that does this for you in the package configure file. From R: devtools::install_github('tractatus/velocyto.R')

ghost commented 6 years ago

I have the same issue with the python version. Is there any fix planned?

gioelelm commented 6 years ago

I solved compiler problem on Mac relying on compilers installed using conda (try both conda install gcc and llvm). I realize this solution is a bit vague, but I don't remember exactly what command solved it for me but pretty sure that the conda provided one do the job with openmp.

pkharchenko commented 6 years ago

@tractatus Thanks for providing a solution for the OS X installation! Do you think it's general enough that I should merge it into the main repo?

tractatus commented 6 years ago

@pkharchenko my solution is a hack because of Apple's LLVM. However, openmp has been compatible for clang for a long time and there is no indication Apple are going to include it anytime soon (recent Xcode 9 didn't include it). Most kosher thing to do would maybe split the C++ code into openmp dependent and non-openmp dependent but that is a bunch of work.

Personally, I think for users who do not know about build environments and "just want to get going" being able to install and get going using devtools::github_install() with a single line is the way to go. For that, the configure file will do its job. Another alternative is OS specific prerequirements installation instructions in the README.md. For windows support, you'll have to do this at some point regardless.

If the configure file is used I would maybe just ad to the shell script that it asks the user y/n if you want to proceed since the ~/.R/Makevars will be changed.

Then there will be the issue of users that have already installed the package and wants to update. It is highly annoying to wait for a bunch of shell script before having reinstalled. For those occasions maybe include a R function named update.velocyto.R() in NAMESPACE that ignores the configure file:

update.velocyto.R<-function(){
 detach('package:velocyto.R', unload=TRUE)
 remove.packages('velocyto.R')
 devtools::install_github('velocyto-team/velocyto.R', args='--no-configure')
}

This function also has the benefit of not requiring users to remove the package quit R and reinstall the package but rather they can continue with the updated package in the current session. They'll just run:

update.velocyto.R()
library(velocyto.R)

And they'll know they running the latest version from GitHub.

Puriney commented 6 years ago

Quote from R (https://cloud.r-project.org/):

Important note: R 3.4.0 El Capitan binaries are using Clang 4.0.0 and GNU Fortran 6.1 to provide OpenMP parallelization support and C++17 standard features. If you want to compile R packages from sources, please download GNU Fortran binary from the official GNU Fortran Binaries page - in particular OS X 10.11 gfortran 6.1. We are also providing Clang 4.0.0 binaries for OS X 10.11 and higher in our libs directory (note that the offical Clang 4.0.0 binaries only support macOS 10.12) and will provide an Apple Installer package here soon. For the time being you may want to either create ~/.R/Makevars such as

CC=/usr/local/clang4/bin/clang CXX=/usr/local/clang4/bin/clang++ LDFLAGS=-L/usr/local/clang4/lib

I followed the R's suggestion and no more errors:


Update Oct 16, 2018.

export PATH=/usr/local/clang4/bin:$PATH
marzamKI commented 6 years ago

Hello, I also had the same problem for OpenMP and followed instruction at this website: http://thecoatlessprofessor.com/programming/openmp-in-r-on-os-x/#bash-clang4

Now I'm faced with another error though.

Downloading GitHub repo velocyto-team/velocyto.R@master
from URL https://api.github.com/repos/velocyto-team/velocyto.R/zipball/master
Installing velocyto.R
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet  \
  CMD INSTALL  \
  '/private/var/folders/xk/7tdpfsld6g9143qcprkkh9sw0000gp/T/RtmpgkbvRB/devtools833bdb1c4f6/velocyto-team-velocyto.R-cf4c571'  \
  --library='/Library/Frameworks/R.framework/Versions/3.4/Resources/library' --install-tests 

* installing *source* package ‘velocyto.R’ ...
Warning in as.POSIXlt.POSIXct(x, tz) :
  unknown timezone 'zone/tz/2017c.1.0/zoneinfo/Europe/Stockholm'
** libs
/usr/local/clang4/bin/clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo/include" -I/usr/local/include  -std=c++11 -fopenmp -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
/usr/local/clang4/bin/clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo/include" -I/usr/local/include  -std=c++11 -fopenmp -fPIC  -Wall -g -O2  -c points_within.cpp -o points_within.o
/usr/local/clang4/bin/clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG  -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RcppArmadillo/include" -I/usr/local/include  -std=c++11 -fopenmp -fPIC  -Wall -g -O2  -c routines.cpp -o routines.o
/usr/local/clang4/bin/clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/clang4/lib -o velocyto.R.so RcppExports.o points_within.o routines.o -lboost_filesystem -lboost_system -lstdc++ -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -fopenmp -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.4/Resources/library/velocyto.R/libs
** R
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error: package or namespace load failed for ‘velocyto.R’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/Library/Frameworks/R.framework/Versions/3.4/Resources/library/velocyto.R/libs/velocyto.R.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.4/Resources/library/velocyto.R/libs/velocyto.R.so, 6): Library not loaded: libboost_filesystem.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.4/Resources/library/velocyto.R/libs/velocyto.R.so
  Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/velocyto.R’
Installation failed: Command failed (1)

I have installed boost. Actually, I've tried both brew install boost as well as

git clone --recursive https://github.com/boostorg/boost.git
cd boost
sudo ./bootstrap.sh
sudo ./b2 install

Any idea what I should be doing?

Session info:

R version 3.4.2 (2017-09-28)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.2

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] Seurat_2.1.0        Biobase_2.38.0      BiocGenerics_0.24.0 Matrix_1.2-12       cowplot_0.9.1      
[6] ggplot2_2.2.1      

loaded via a namespace (and not attached):
  [1] backports_1.1.1        Hmisc_4.0-3            VGAM_1.0-4             NMF_0.20.6            
  [5] sn_1.5-1               plyr_1.8.4             igraph_1.1.2           lazyeval_0.2.1        
  [9] splines_3.4.2          densityClust_0.3       fastICA_1.2-1          gridBase_0.4-7        
 [13] digest_0.6.12          foreach_1.4.3          htmltools_0.3.6        viridis_0.4.0         
 [17] lars_1.2               gdata_2.18.0           memoise_1.1.0          magrittr_1.5          
 [21] checkmate_1.8.5        cluster_2.0.6          doParallel_1.0.11      mixtools_1.1.0        
 [25] ROCR_1.0-7             sfsmisc_1.1-1          limma_3.34.3           recipes_0.1.1         
 [29] gower_0.1.2            dimRed_0.1.0           matrixStats_0.52.2     R.utils_2.6.0         
 [33] colorspace_1.3-2       ggrepel_0.7.0          dplyr_0.7.4            bindr_0.1             
 [37] survival_2.41-3        iterators_1.0.8        ape_5.0                glue_1.2.0            
 [41] DRR_0.0.2              registry_0.5           gtable_0.2.0           ipred_0.9-6           
 [45] kernlab_0.9-25         ddalpha_1.3.1          prabclus_2.2-6         DEoptimR_1.0-8        
 [49] scales_0.5.0           pheatmap_1.0.8         mvtnorm_1.0-6          rngtools_1.2.4        
 [53] Rcpp_0.12.14           dtw_1.18-1             viridisLite_0.2.0      xtable_1.8-2          
 [57] htmlTable_1.11.0       tclust_1.3-1           foreign_0.8-69         proxy_0.4-19          
 [61] mclust_5.4             SDMTools_1.1-221       Formula_1.2-2          tsne_0.1-3            
 [65] stats4_3.4.2           lava_1.5.1             prodlim_1.6.1          httr_1.3.1            
 [69] htmlwidgets_0.9        FNN_1.1                gplots_3.0.1           RColorBrewer_1.1-2    
 [73] fpc_2.1-10             acepack_1.4.1          modeltools_0.2-21      ica_1.0-1             
 [77] pkgconfig_2.0.1        R.methodsS3_1.7.1      flexmix_2.3-14         nnet_7.3-12           
 [81] caret_6.0-77           tidyselect_0.2.3       rlang_0.1.4            reshape2_1.4.2        
 [85] munsell_0.4.3          tools_3.4.2            ranger_0.8.0           devtools_1.13.4       
 [89] ggridges_0.4.1         broom_0.4.3            stringr_1.2.0          yaml_2.1.15           
 [93] ModelMetrics_1.1.0     knitr_1.17             robustbase_0.92-8      caTools_1.17.1        
 [97] DDRTree_0.1.5          purrr_0.2.4            RANN_2.5.1             bindrcpp_0.2          
[101] pbapply_1.3-3          nlme_3.1-131           monocle_2.6.1          slam_0.1-40           
[105] R.oo_1.21.0            RcppRoll_0.2.2         compiler_3.4.2         rstudioapi_0.7        
[109] curl_3.0               ggjoy_0.4.0            tibble_1.3.4           stringi_1.1.6         
[113] lattice_0.20-35        trimcluster_0.1-2      psych_1.7.8            HSMMSingleCell_0.112.0
[117] diffusionMap_1.1-0     combinat_0.0-8         data.table_1.10.4-3    bitops_1.0-6          
[121] irlba_2.3.2            R6_2.2.2               latticeExtra_0.6-28    KernSmooth_2.23-15    
[125] gridExtra_2.3          codetools_0.2-15       MASS_7.3-47            gtools_3.5.0          
[129] assertthat_0.2.0       CVST_0.2-1             pkgmaker_0.22          withr_2.1.0           
[133] qlcMatrix_0.9.5        mnormt_1.5-5           diptest_0.75-7         grid_3.4.2            
[137] rpart_4.1-11           timeDate_3042.101      tidyr_0.7.2            class_7.3-14          
[141] segmented_0.5-3.0      Rtsne_0.13             git2r_0.19.0           numDeriv_2016.8-1     
[145] scatterplot3d_0.3-40   lubridate_1.7.1        base64enc_0.1-3

Thanks

SamAllon commented 6 years ago

@tractatus I really appreciate your suggestion: devtools::install_github('tractatus/velocyto.R') However, at least for me, this command results in the error:

installing source package ‘velocyto.R’ ... ++ set -e ./configure: line 46: syntax error: unexpected end of file ERROR: configuration failed for package ‘velocyto.R’ removing ‘/Library/Frameworks/R.framework/Versions/3.4/Resources/library/velocyto.R’ Installation failed: Command failed (1)

tractatus commented 6 years ago

@SamAllon running homebrew as root in configure file is no longer supported for obvious safety reasons.

Just open terminal and run the part yourself (assuming you have homebrew).

brew install llvm
brew install boost
brew install homebrew/science/hdf5 --enable-cxx
mkdir -p ~/.R
cat <<- EOF > ~/.R/Makevars
     # The following statements are required to use the clang4 binary
     CC=/usr/local/clang4/bin/clang
     CXX=/usr/local/clang4/bin/clang++
     CXX11=/usr/local/clang4/bin/clang++
     CXX14=/usr/local/clang4/bin/clang++
     CXX17=/usr/local/clang4/bin/clang++
     CXX1X=/usr/local/clang4/bin/clang++
     LDFLAGS=-L/usr/local/clang4/lib
     # End clang4 inclusion statements
     EOF

Then install this repo as ordinary:

devtools::install_github('velocyto-team/velocyto.R')
SamAllon commented 6 years ago

@tractatus Thank you so much! For whatever reason, /usr/local/clang4/ did not exist on my system after your first 4 steps. But your advice totally set me on the right direction. In addition to your steps, I did the following:

  1. Download clang-4.0.0 from http://r.research.att.com/libs/
  2. tar xvzf clang-4.0.0-darwin15.6-Release.tar in my Downloads directory
  3. cd usr/local/
  4. sudo mv clang4 /usr/local/
Caleb-Huo commented 6 years ago

@tractatus In encounter the following error message by running the Makevars code. Any suggestion how could I fix that? /Users/zhuo/.R/Makevars:10: *** missing separator. Stop.

Thanks

tractatus commented 6 years ago

@Caleb-Huo this sounds like a tab as separator issue. Since no other info is provided I can only guess your problem. But copy-paste the text you want to run into your preferred text editor and make sure tabs are tabs and not spaces.

sejiro commented 6 years ago

Hi all, I tried the above solutions but I think there is some other error with my compiler configuration as I am getting the following dyld_stub_binding_helper not found error. Any help or advice would be appreciated.

Also I got the same error trying to fork from tractatus

screen shot 2018-01-22 at 1 31 57 pm screen shot 2018-01-22 at 1 33 29 pm

zhuo91 commented 6 years ago

@Caleb-Huo I had exactly the same problem. Got it work by using a text editor to open the Makevars file, and only copy and paste the following:

     CC=/usr/local/clang4/bin/clang
     CXX=/usr/local/clang4/bin/clang++
     CXX11=/usr/local/clang4/bin/clang++
     CXX14=/usr/local/clang4/bin/clang++
     CXX17=/usr/local/clang4/bin/clang++
     CXX1X=/usr/local/clang4/bin/clang++
     LDFLAGS=-L/usr/local/clang4/lib
diazdc commented 6 years ago

I was able to solve this using @SamAllon 's method. I had the exact same problem.

anjanbharadwaj commented 6 years ago

@SamAllon @tractatus Thanks so much! Was having this issue for over 3 hours, tried the Docker solution too...

pkharchenko commented 6 years ago

Does anyone know if it’s possible to make R substitute this standard variables automatically, upon install? Without that, I am not sure how to configure the package so that it would work on both OS X and other platforms. -peter.

On Jan 25, 2018, at 6:47 PM, zhuo91 notifications@github.com wrote:

@Caleb-Huo https://github.com/caleb-huo I had exactly the same problem. Got it work by using a text editor to open the Makevars file, and only copy and paste the following:

CC=/usr/local/clang4/bin/clang CXX=/usr/local/clang4/bin/clang++ CXX11=/usr/local/clang4/bin/clang++ CXX14=/usr/local/clang4/bin/clang++ CXX17=/usr/local/clang4/bin/clang++ CXX1X=/usr/local/clang4/bin/clang++ LDFLAGS=-L/usr/local/clang4/lib — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/velocyto-team/velocyto.R/issues/2#issuecomment-360639046, or mute the thread https://github.com/notifications/unsubscribe-auth/ALT78qJxpsFqZjlAoDarvBgNM5yWQ0niks5tORKtgaJpZM4QFNwF.

tractatus commented 6 years ago

@pkharchenko Given that Apple still do not support OpenMP with their clang distro I think you have two options: 1) Specify requirements for macOS for build instructions in the readme of the repo (i.e. homebrew, new compiler, then set configure). For setting configure file you can specify configure files specific for macOS that will not change anything for other *nix type OSes. 2) Set OpenMP to not build by default.

The second option was what the author, @mikldk, of this package did: https://github.com/mikldk/malan/issues/9#issuecomment-385884747

You can see the changes to their Makevars files here: https://github.com/mikldk/malan/commit/616bf587ffc272fd61ed181d41f7a07987bda078

If this is to get the R package ready for a larger audience I would suggest building static binaries of the package with OpenMP static libraries included. This way people can install quickly. Otherwise, you always run the risk of a larger audience getting stuck compiling from source and then giving up immediately.

gioelelm commented 6 years ago

My favourite option is to install the conda version of gcc that will compile openMP without problems (see this answer https://github.com/velocyto-team/velocyto.py/issues/53 https://github.com/velocyto-team/velocyto.py/issues/53, It basically narrows down to this command: conda install llvm gcc libgcc) but I like the idea to have the functions precompiled, we have this already in velocyto.py

emilyybo commented 5 years ago

@gioelelm thanks a lot for your comment. I managed to solved the clang error (clang: error: unsupported option '-fopenmp') by using this command: conda install llvm gcc libgcc.

reza627 commented 5 years ago

I got below error by running devtools::install_github('velocyto-team/velocyto.R') in R

/usr/local/clang6/bin/clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/Cellar/hdf5/1.10.4/include -I/usr/local/opt/szip/include -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c Attribute.cpp -o Attribute.o /usr/local/clang6/bin/clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/Cellar/hdf5/1.10.4/include -I/usr/local/opt/szip/include -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c Dataset.cpp -o Dataset.o /usr/local/clang6/bin/clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/Cellar/hdf5/1.10.4/include -I/usr/local/opt/szip/include -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c Dataspace.cpp -o Dataspace.o /usr/local/clang6/bin/clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/Cellar/hdf5/1.10.4/include -I/usr/local/opt/szip/include -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c File.cpp -o File.o /usr/local/clang6/bin/clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/Cellar/hdf5/1.10.4/include -I/usr/local/opt/szip/include -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c Group.cpp -o Group.o /usr/local/clang6/bin/clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/Cellar/hdf5/1.10.4/include -I/usr/local/opt/szip/include -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c Helpers.cpp -o Helpers.o /usr/local/clang6/bin/clang++ -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/Cellar/hdf5/1.10.4/include -I/usr/local/opt/szip/include -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o /usr/local/clang6/bin/clang -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/usr/local/Cellar/hdf5/1.10.4/include -I/usr/local/opt/szip/include -I"/Library/Frameworks/R.framework/Versions/3.5/Resources/library/Rcpp/include" -I/usr/local/include -fPIC -Wall -g -O2 -c h5_init.c -o h5_init.o /usr/local/clang6/bin/clang++ -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/clang6/lib -o h5.so Attribute.o Dataset.o Dataspace.o File.o Group.o Helpers.o RcppExports.o h5_init.o -L/usr/local/Cellar/hdf5/1.10.4/lib -L/usr/local/opt/szip/lib -L. -lhdf5_cpp -lhdf5 -lz -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation ld: unexpected token: !tapi-tbd-v3 file '/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd' for architecture x86_64 clang-6.0: error: unable to execute command: Segmentation fault: 11 clang-6.0: error: linker command failed due to signal (use -v to see invocation) make: *** [h5.so] Error 254 ERROR: compilation failed for package ‘h5’

I have MacOS Mojave 10.12.1 and XCode 10.1 and R version 3.5.1

tractatus commented 5 years ago

@reza627 what command line tools (CLT) version do you have? It could be as easy as it is not up to date with your XCode 10.1.

I would say it is probably that you upgraded to Mojave but haven't upgraded both XCode and CLT so they both are incompatible with eachother.

To see your CLT version just run in terminal: pkgutil --pkg-info=com.apple.pkg.CLTools_Executables

reza627 commented 5 years ago

@tractatus thanks for your response. By running "pkgutil --pkg-info=com.apple.pkg.CLTools_Executables", I got:package-id: com.apple.pkg.CLTools_Executables version: 10.1.0.0.1.1539992718 volume: / location: / install-time: 1540982867 groups: com.apple.FindSystemFiles.pkg-group

I don't know still I should update CLT or not. If so, how can I update it?

mglerner commented 5 years ago

I'm was having similar problems. Combining answers here with answers from a few other places, here's something that worked for me on OS X 10.13.6:

conda create -n velocytofresh
source activate velocytofresh
conda install numpy scipy cython numba matplotlib scikit-learn h5py click llvm gcc libgcc clang rstudio jupyter pandas llvm-openmp statsmodels
pip install pysam loompy
git clone https://github.com/velocyto-team/velocyto.py.git
cd velocyto.py
pip install -e .

I was prompted repeatedly to install Java, so I installed a JDK and JRE.

at this point, I could run velocyto.py --help from the command line and get reasonable output. I was also able to run the DentateGyrus notebook through the creation of at least the first several figures. So, hopefully the above recipe works for others (or, at least, others who are trying to install on an almost-up-to-date Mac in November 2018).

One note: when I run that notebook via jupyter notebook, things work. When I run via jupyter lab, "import loompy" fails with

ImportError: dlopen(/Users/mglerner/anaconda3/lib/python3.6/site-packages/scipy/sparse/_sparsetools.cpython-36m-darwin.so, 2): Library not loaded: @rpath/libc++abi.1.dylib
  Referenced from: /Users/mglerner/anaconda3/lib/libc++.1.dylib
  Reason: image not found

Obviously this looks like a loompy problem, not a velocyto problem, but I didn't figure out how to make it go away despite all of my googling.

brianpenghe commented 5 years ago

@SamAllon running homebrew as root in configure file is no longer supported for obvious safety reasons.

Just open terminal and run the part yourself (assuming you have homebrew).

brew install llvm
brew install boost
brew install homebrew/science/hdf5 --enable-cxx
mkdir -p ~/.R
cat <<- EOF > ~/.R/Makevars
   # The following statements are required to use the clang4 binary
   CC=/usr/local/clang4/bin/clang
   CXX=/usr/local/clang4/bin/clang++
   CXX11=/usr/local/clang4/bin/clang++
   CXX14=/usr/local/clang4/bin/clang++
   CXX17=/usr/local/clang4/bin/clang++
   CXX1X=/usr/local/clang4/bin/clang++
   LDFLAGS=-L/usr/local/clang4/lib
   # End clang4 inclusion statements
   EOF

Then install this repo as ordinary:

devtools::install_github('velocyto-team/velocyto.R')

When I was trying homebrew/science/hdf5 --enable-cxx It said Error: invalid option: --enable-cxx When I was trying homebrew/science/hdf5 It said Error: homebrew/science was deprecated. This tap is now empty as all its formulae were migrated.

EDYAC commented 5 years ago

@tractatus I tried to follow your steps, but I'm still getting the same error. Would you be able to help?

tractatus commented 5 years ago

@EDYAC the error states you havent installed or compiled binaries of clang.

If you uncertain what that means I would recommend the following instead: https://github.com/rmacoslib/r-macos-rtools

EDYAC commented 5 years ago

@tractatus Hello, I actually followed your steps, mkdir -p ~/.R cat <<- EOF > ~/.R/Makevars CC=/usr/local/clang4/bin/clang CXX=/usr/local/clang4/bin/clang++ CXX11=/usr/local/clang4/bin/clang++ CXX14=/usr/local/clang4/bin/clang++ CXX17=/usr/local/clang4/bin/clang++ CXX1X=/usr/local/clang4/bin/clang++ LDFLAGS=-L/usr/local/clang4/lib EOF Now I get a different error ** libs /Users/edouardal-chami/.R/Makevars:10: *** missing separator. Stop. ERROR: compilation failed for package ‘velocyto.R’

Do you know what is that? Thank you so much for your help

EDYAC commented 5 years ago

@tractatus when I tried to homebrew/science/hdf5 --enable-cxx I got invalid option: --enable-cxx So I just did the mkdir -p~/.R as I mentioned above.

andrevrpires commented 5 years ago

Maybe taka a look at the last item on this FAQ could help:

https://cran.r-project.org/bin/macosx/RMacOSX-FAQ.html

flyboyleo commented 5 years ago

@EDYAC

"brew install hdf5" would work fine now.

Although I still met error for "devtools::install_github('velocyto-team/velocyto.R')"

But now I can install "devtools::install_github("nolanlab/Rclusterpp")" and spade tree as what I want.

p.s.: I was redirected from https://github.com/nolanlab/spade/issues/137

RoganGrant commented 5 years ago

Perhaps not a direct answer to this question, but a solution for anyone struggling to install with gcc-8 or similar on macOS. Assuming gcc-8 and g++-8 are on your path, you will need to install the boost libraries (however you choose -- I used conda) and then copy/link them over to /usr/local/lib/gcc/8/. They are not immediately recognized during compilation, so you will also need to update your PKG_LIB variable in ~/.R/Makevars. In theory you could probably also set this to the original boost library location, but this made more sense to me at the time. Final makevars file:

CC=gcc-8
CXX=g++-8
CXX11=g++-8
CXX14=g++-8
CXX17=g++-8
CXX1X=g++-8
CXXFLAGS=-L/usr/local/lib/gcc/8/
PKG_LIBS=-L/usr/local/lib/gcc/8/

I was able to fix the -fopenmp flag issue in this case with a simple conda install: conda install -c conda-forge openmp

jstriaukas commented 4 years ago

the original solution also works for clang6, just replace clang4 -> clang6

evanbiederstedt commented 4 years ago

There's a related solution here: https://github.com/kharchenkolab/conos/wiki/Installing-Conos-for-Mac-OS