stephenslab / mashr

An R package for multivariate adaptive shrinkage.
https://stephenslab.github.io/mashr
Other
88 stars 19 forks source link

unable to install mashr on windows #60

Closed lzhangUT closed 3 years ago

lzhangUT commented 5 years ago
> devtools::install_github("stephenslab/mashr")
Downloading GitHub repo stephenslab/mashr@master
√  checking for file 'C:\Users\Li Zhang\AppData\Local\Temp\RtmpUdl6cj\remotes6c441822c8e\stephenslab-mashr-098fed9/DESCRIPTION' ...
-  preparing 'mashr': (1.1s)
√  checking DESCRIPTION meta-information ... 
-  cleaning src
-  checking for LF line-endings in source and make files and shell scripts (513ms)
-  checking for empty or unneeded directories
-  building 'mashr_0.2.21.tar.gz'
   Warning: file 'mashr/cleanup' did not have execute permissions: corrected
   Warning: file 'mashr/configure' did not have execute permissions: corrected
Installing package into ‘C:/Users/Li Zhang/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
* installing *source* package 'mashr' ...
** libs
Warning: this package has a non-empty 'configure.win' file,
so building only the main architecture
c:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-35~1.0/include" -DNDEBUG  -I/include -I"C:/Users/Li Zhang/Documents/R/win-library/3.5/Rcpp/include" -I"C:/Users/Li Zhang/Documents/R/win-library/3.5/RcppArmadillo/include" -I"C:/Users/Li Zhang/Documents/R/win-library/3.5/RcppGSL/include"        -O2 -Wall  -mtune=generic -c RcppExports.cpp -o RcppExports.o
In file included from C:/Users/Li Zhang/Documents/R/win-library/3.5/RcppGSL/include/RcppGSL.h:25:0,
                 from RcppExports.cpp:5:
C:/Users/Li Zhang/Documents/R/win-library/3.5/RcppGSL/include/RcppGSLForward.h:26:29: fatal error: gsl/gsl_vector.h: No such file or directory
 #include <gsl/gsl_vector.h> 
compilation terminated.
make: *** [C:/PROGRA~1/R/R-35~1.0/etc/x64/Makeconf:215: RcppExports.o] Error 1
ERROR: compilation failed for package 'mashr'
* removing 'C:/Users/Li Zhang/Documents/R/win-library/3.5/mashr'
In R CMD INSTALL
Error in i.p(...) : 
  (converted from warning) installation of package ‘C:/Users/LIZHAN~1/AppData/Local/Temp/RtmpUdl6cj/file6c478aa4fca/mashr_0.2.21.tar.gz’ had non-zero exit status

My R version:

platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          5.0                         
year           2018                        
month          04                          
day            23                          
svn rev        74626                       
language       R                           
version.string R version 3.5.0 (2018-04-23)
gaow commented 5 years ago

@lzhangUT could you make sure that gsl is installed on your mingw system before trying to install the package? Currently we do not provide official support (nor do we have sufficient knowledge) for Windows though in principle it should work if all requirements are satisfied. The only tricky one is gsl.

Down the line maybe we can create a conda-forge recipe for mashr so at least Windows users should be able to use it with conda.

pcarbo commented 5 years ago

@lzhangUT To echo what Gao said, it looks like the RcppGSL package has not been installed properly. I would take a look at the package documentation here and figure out what is going on (actually I'm not certain that a missing GSL is the issue here).

lzhangUT commented 5 years ago

I did, both gsl and RcppGSL packages, the same error messages.

gaow commented 5 years ago

From your error prompt:

C:/Users/Li Zhang/Documents/R/win-library/3.5/RcppGSL/include/RcppGSLForward.h:26:29: fatal error: gsl/gsl_vector.h: No such file or directory

It seems your system is not configured to point to the right path of GSL even though you claim it is properly installed (and I believe you!). I do not have any specific knowledge how the GSL installation behaves in mingw and how to fix this issue, but the big picture idea is that you've got to configure your environment variable to make sure the GSL header directory is in the C++ compiler's INCLUDE path (-I option for gcc), and the GSL library binary is in the compiler's LIBRARY path (-L option).

pcarbo commented 5 years ago

I think this relates to our difficulties in getting Appveyor working for mashr; I was unable to get RcppGSL to recognize the installed GSL. I'm afraid I can't offer any advice on this, but at least we have isolated the issue! Please let us know if you find a solution (it could actually be useful for us as well).

gaow commented 3 years ago

GSL installation on Linux (via apt-get) and on Mac (via homebrew) is straightforward. Here are some steps that worked on Mac without using homebrew and to verify the paths can be recognized.

First, download the desired version of gsl.tar.gz file from the source: https://www.gnu.org/software/gsl/ The latest version is gsl-2.6. (As of 05/03/2021)

Then, change directory into the location of unzipped gsl folder on your computer in terminal.

cd ~/Downloads/gsl-2.6

​ To install, run:

sudo ./configure && make && sudo make install

To verify the installation, run the following commands in terminal:

gsl-config --cflags

and

gsl-config --libs

​ If you get

-I/usr/local/include

and

-L/usr/local/lib -lgsl -lgslcblas

respectively for --cflags and --libs, gsl should has been configured successfully. If the above does not work, eg, command gsl-config is not found, then you should see in your gsl build folder a script called gsl-config. You can open it up with a text editor, read into it to find the expected -I and -L paths and double check if it exists on your computer, in particular the first 3 lines. For the example above these lines are:

prefix=/usr/local
exec_prefix=/usr/local
includedir=/usr/local/include

Next, when you install mashr in R you should find the R terminal output along the lines of:

clang++ -std=gnu++11  ... -o mashr.so RcppExports.o extreme_deconvolution.o mash.o -I/usr/local/include -L/usr/local/lib -lgsl -lgslcblas ...

that uses the flags and libraries generated. This should ensure a successful compile with GSL included and linked.

I have not tried a Windows solution but I believe the steps are similar. I'm going to close the ticket for now until we have more contributions from Windows users.