r-lib / pkgbuild

Find tools needed to build R packages
https://pkgbuild.r-lib.org
Other
65 stars 33 forks source link

M1 Mac : Could not find tools necessary to compile a package #146

Closed akhst7 closed 1 year ago

akhst7 commented 1 year ago

remotes::update_packages() gives me a following error;

Error: Failed to install 'mice' from GitHub:
  Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.

pkgbuild::check_build_tools(debug = TRUE) says not build_tools installed as follows;

> pkgbuild::check_build_tools(debug = TRUE)
Error: Could not find tools necessary to compile a package

Buildtools should be up to date with a recent Xcode update;

❯ xcode-select -v                                                                                                     
xcode-select version 2396
❯ xcode-select --install                                                                                                 
xcode-select: error: command line tools are already installed

Xcode is the latest, Version 14.1 (14B47b). This issue is related to the issue #103 but a full Xcode installation as suggested, does not solve my issue both in the command line and Rstudio. Since this happened right after Xcode update, It sounds like an incompatibility between Xcode command line tool update and pkgtools ?

R version

> R.version                          
platform       aarch64-apple-darwin20      
arch           aarch64                     
os             darwin20                    
system         aarch64, darwin20           
status                                     
major          4                           
minor          2.2                         
year           2022                        
month          10                          
day            31                          
svn rev        83211                       
language       R                           
version.string R version 4.2.2 (2022-10-31)
nickname       Innocent and Trusting

Session info;

> sessionInfo()
R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.0.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-arm64/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] stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] SingleCellExperiment_1.20.0 SummarizedExperiment_1.28.0 Biobase_2.58.0              GenomicRanges_1.50.1       
 [5] GenomeInfoDb_1.34.2         rhdf5_2.40.0                DelayedArray_0.24.0         IRanges_2.32.0             
 [9] S4Vectors_0.36.0            MatrixGenerics_1.10.0       matrixStats_0.62.0          BiocGenerics_0.44.0        
[13] Matrix_1.5-3               

loaded via a namespace (and not attached):
 [1] XVector_0.38.0         zlibbioc_1.44.0        lattice_0.20-45        R6_2.5.1               tools_4.2.2           
 [6] pkgbuild_1.3.1         grid_4.2.2             cli_3.4.1              remotes_2.4.2          crayon_1.5.2          
[11] processx_3.8.0         GenomeInfoDbData_1.2.9 callr_3.7.3            Rhdf5lib_1.19.2        ps_1.7.2              
[16] rhdf5filters_1.8.0     bitops_1.0-7           RCurl_1.98-1.9         curl_4.3.3             compiler_4.2.2        
[21] prettyunits_1.1.1

OSX system info;

❯ neofetch                                                              
                    'c.
                 ,xNMM.
               .OMMMMo
               OMMM0,            akihikohoji@Akihikos-Mac-mini.local
     .;loddo:' loolloddol;.      -----------------------------------
   cKMMMMMMMMMMNWMMMMMMMMMM0:    OS: macOS 13.0.1 22A400 arm64
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.    Host: Macmini9,1
 XMMMMMMMMMMMMMMMMMMMMMMMX.      Kernel: 22.1.0
;MMMMMMMMMMMMMMMMMMMMMMMM:       Uptime: 13 hours, 30 mins
:MMMMMMMMMMMMMMMMMMMMMMMM:       Packages: 149 (brew)
.MMMMMMMMMMMMMMMMMMMMMMMMX.      Shell: zsh 5.8.1
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.    Resolution: 1920x1080
 .XMMMMMMMMMMMMMMMMMMMMMMMMMMk   DE: Aqua
  .XMMMMMMMMMMMMMMMMMMMMMMMMK.   WM: Quartz Compositor
    kMMMMMMMMMMMMMMMMMMMMMMd     WM Theme: Blue (Light)
     ;KMMMMMMMWXXWMMMMMMMk.      Terminal: iTerm2
       .cooc,.    .,coo:.        Terminal Font: MesloLGS-NF-Regular 12
                                 CPU: Apple M1
                                 GPU: Apple M1
                                 Memory: 1745MiB / 16384MiB
gaborcsardi commented 1 year ago

Is this from RStudio?

akhst7 commented 1 year ago

@gaborcsardi

Both from command line and Rstudio

gaborcsardi commented 1 year ago

Does install.packages() work to install source packages? E.g.

install.packages("filelock", type = "source")

What is the output of xcode-select -p? In general, xcode should be fine, that's what I have as well:

❯ xcode-select -p
/Applications/Xcode.app/Contents/Developer
akhst7 commented 1 year ago

@gaborcsard,

Actually, I restarted Mac and it cured it.

Thanks.