immunogenomics / presto

Fast Wilcoxon and auROC
154 stars 34 forks source link

compilation error with brew gcc #39

Open karlensberg opened 1 month ago

karlensberg commented 1 month ago

I'm am struggling to install presto and no one else seems to be having the same issue. Here is the error message I get:

> devtools::install_github("immunogenomics/presto")
Downloading GitHub repo immunogenomics/presto@HEAD
These packages have more recent versions available.
It is recommended to update all of them.
Which would you like to update?

 1: All                                         
 2: CRAN packages only                          
 3: None                                        
 4: rlang        (1.1.3      -> 1.1.4   ) [CRAN]
 5: cli          (3.6.2      -> 3.6.3   ) [CRAN]
 6: withr        (3.0.0      -> 3.0.1   ) [CRAN]
 7: stringi      (1.8.3      -> 1.8.4   ) [CRAN]
 8: tidyselect   (1.2.0      -> 1.2.1   ) [CRAN]
 9: Rcpp         (1.0.12     -> 1.0.13  ) [CRAN]
10: RcppArmad... (0.12.8.0.0 -> 14.0.0-1) [CRAN]
11: data.table   (1.15.0     -> 1.15.4  ) [CRAN]

Enter one or more numbers, or an empty line to skip updates: 3
── R CMD build ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔  checking for file ‘/private/var/folders/4z/tmjpr0q53bl54lbpb0g7_zhm0000gs/T/Rtmpn08xig/remotes69db12ba66fa/immunogenomics-presto-7636b3d/DESCRIPTION’ (343ms)
─  preparing ‘presto’:
✔  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
─  building ‘presto_1.0.0.tar.gz’

* installing *source* package ‘presto’ ...
** using staged installation
** libs
using C++ compiler: ‘Apple clang version 14.0.0 (clang-1400.0.29.202)’
using C++11
using SDK: ‘MacOSX13.1.sdk’
clang++ -arch x86_64 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/RcppArmadillo/include' -I/opt/R/x86_64/include    -fPIC  -falign-functions=64 -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
In file included from RcppExports.cpp:4:
In file included from /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/RcppArmadillo/include/RcppArmadillo.h:29:
In file included from /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/RcppArmadillo/include/RcppArmadillo/interface/RcppArmadilloForward.h:25:
In file included from /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/Rcpp/include/RcppCommon.h:30:
In file included from /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/Rcpp/include/Rcpp/r/headers.h:62:
In file included from /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/Rcpp/include/Rcpp/platform/compiler.h:153:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/unordered_map:437:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__hash_table:16:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/algorithm:653:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/functional:500:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/__functional/function.h:22:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:974:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/cassert:20:
In file included from /usr/local/include/assert.h:5:
/usr/local/include/except.h:15:32: error: typedef redefinition with different types ('struct Except_Frame_T *' vs 'Except_Frame_T')
typedef struct Except_Frame_T *Except_Frame_T;
                               ^
/usr/local/include/except.h:15:16: note: previous definition is here
typedef struct Except_Frame_T *Except_Frame_T;
               ^
/usr/local/include/except.h:17:18: error: field has incomplete type 'Except_Frame_T'
  Except_Frame_T prev;
                 ^
/usr/local/include/except.h:16:8: note: definition of 'Except_Frame_T' is not complete until the closing '}'
struct Except_Frame_T {
       ^
2 errors generated.
make: *** [RcppExports.o] Error 1
ERROR: compilation failed for package ‘presto’
* removing ‘/Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/library/presto’
Warning message:
In i.p(...) :
  installation of package ‘/var/folders/4z/tmjpr0q53bl54lbpb0g7_zhm0000gs/T//Rtmpn08xig/file69dbbbeb0b1/presto_1.0.0.tar.gz’ had non-zero exit status

Here is the session info:

> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.7.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

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

time zone: America/New_York
tzcode source: internal

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

other attached packages:
[1] devtools_2.4.5 usethis_2.2.3 

loaded via a namespace (and not attached):
 [1] miniUI_0.1.1.1    compiler_4.3.2    promises_1.2.1    Rcpp_1.0.12       stringr_1.5.1     callr_3.7.3       later_1.3.2       fastmap_1.1.1     mime_0.12        
[10] R6_2.5.1          curl_5.2.0        htmlwidgets_1.6.4 desc_1.4.3        profvis_0.3.8     shiny_1.8.0       rlang_1.1.3       cachem_1.0.8      stringi_1.8.3    
[19] httpuv_1.6.14     fs_1.6.3          pkgload_1.3.4     memoise_2.0.1     cli_3.6.2         magrittr_2.0.3    ps_1.7.6          digest_0.6.34     processx_3.8.3   
[28] rstudioapi_0.15.0 xtable_1.8-4      remotes_2.5.0     lifecycle_1.0.4   vctrs_0.6.5       glue_1.7.0        urlchecker_1.0.1  sessioninfo_1.2.2 pkgbuild_1.4.3   
[37] purrr_1.0.2       tools_4.3.2       ellipsis_0.3.2    htmltools_0.5.7  

Any ideas of what I should try?

slowkow commented 1 month ago

I found two other similar installation issues for other packages if you search for:

/usr/local/include/except.h:15:32: error: typedef redefinition with different types

This leads me to believe that this might not be an issue with the presto code, but rather an issue with the system you're installing it on.

Have you installed R with conda or brew?

If so, could you try uninstalling and using the packages from the official R website? https://www.r-project.org/

If you find any other solution, please consider sharing it here so others may benefit in the future. Thanks!

slowkow commented 1 month ago

You might consider trying to update Rcpp and RcppArmadillo, then update the other packages, then install presto:

# Update Rcpp and RcppArmadillo
install.packages("Rcpp")
install.packages("RcppArmadillo")

# Update all other packages
update.packages(ask = FALSE)

# Try reinstalling the 'presto' package
devtools::install_github("immunogenomics/presto")

If you still run into the same issue, then there is a possibility that your R installation is using the wrong except.h file, and you have multiple except.h files on your system. You might want to try looking for environment variables or configurations that define where R will look for these files when compiling packages.

On my system, here are all the paths to the except.h file:

find / -iname 'except.h'
/System/Volumes/Data/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/plugin/include/except.h
/System/Volumes/Data/opt/gfortran/lib/gcc/x86_64-apple-darwin20.0/12.2.0/plugin/include/except.h
/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0/plugin/include/except.h
/opt/gfortran/lib/gcc/x86_64-apple-darwin20.0/12.2.0/plugin/include/except.h

Again, my best guess is that your system is setup differently due to using conda or brew. I could be mistaken. Consider sharing the output of find / -iname 'except.h' if you want to help clarify this issue.

karlensberg commented 1 month ago

To answer your earlier question, I downloaded R from the official website so I don't believe thats the issue. I also tried updating all of the packages and that didn't fix it either. I think you may be right about the except.h file stuff. I am working on a computer that others have used in the past, so I think the setup/pathing may be messed up due to that? I tried running the command, heres the list that I got back if it's any help:

/usr/local/include/except.h
/usr/local/Cellar/gcc/12.2.0/lib/gcc/current/gcc/x86_64-apple-darwin20/12/plugin/include/except.h
/System/Volumes/Data/usr/local/include/except.h
/System/Volumes/Data/usr/local/Cellar/gcc/12.2.0/lib/gcc/current/gcc/x86_64-apple-darwin20/12/plugin/include/except.h
/System/Volumes/Data/Applications/NGS_Analysis_Applications/Aligners/gmap-2017-06-20/src/except.h
/Applications/NGS_Analysis_Applications/Aligners/gmap-2017-06-20/src/except.h
/dev/fd/6/usr/local/include/except.h
/dev/fd/6/usr/local/Cellar/gcc/12.2.0/lib/gcc/current/gcc/x86_64-apple-darwin20/12/plugin/include/except.h
/dev/fd/6/System/Volumes/Data/usr/local/include/except.h
/dev/fd/6/System/Volumes/Data/usr/local/Cellar/gcc/12.2.0/lib/gcc/current/gcc/x86_64-apple-darwin20/12/plugin/include/except.h
/dev/fd/6/System/Volumes/Data/Applications/NGS_Analysis_Applications/Aligners/gmap-2017-06-20/src/except.h
/dev/fd/6/Applications/NGS_Analysis_Applications/Aligners/gmap-2017-06-20/src/except.h 
slowkow commented 1 month ago

Since you have a Cellar directory, that means brew was used to install some packages.

It seems to me like the brew version of gcc is not working for you, since you are seeing the error about except.h.

When gcc was installed with brew, I think this probably created /usr/local/include/except.h, and now your compiler is using that new file instead of the correct file. That seems like it might be the problem here.

I am not certain about how to fix your setup, but here are some steps you might consider trying:

You might find this page helpful to figure out how to install xcode and gfortran:

If these steps did not help, then you might want to search around for other issue reports in other R packages to see how others have tried to deal with using gcc from brew when compiling R packages, and maybe you might find some steps that worked for someone else.

Please consider sharing your steps if you eventually find a solution.

I wish you the best of luck! I hope you can get your system working soon.