r-lib / devtools

Tools to make an R developer's life easier
https://devtools.r-lib.org
Other
2.37k stars 753 forks source link

`install.packages("devtools")` fails on Apple M1 macOs Monterey #2440

Closed aaelony-aeg closed 2 years ago

aaelony-aeg commented 2 years ago

Hello,

The devtools package fails to install on a new Mac with Apple M1 chip running Monterey (12.4). Software Update says "Your Mac is up to date -- macOS Monterey 12.4"

Please advise?

> install.packages('devtools')
Installing package into ‘/opt/homebrew/lib/R/4.2/site-library’
(as ‘lib’ is unspecified)

Selection: 71
also installing the dependencies ‘zip’, ‘gert’, ‘xml2’, ‘usethis’, ‘roxygen2’, ‘rversions’

trying URL 'https://mirror.las.iastate.edu/CRAN/src/contrib/zip_2.2.0.tar.gz'
Content type 'application/x-gzip' length 114391 bytes (111 KB)
==================================================
downloaded 111 KB

trying URL 'https://mirror.las.iastate.edu/CRAN/src/contrib/gert_1.6.0.tar.gz'
Content type 'application/x-gzip' length 117915 bytes (115 KB)
==================================================
downloaded 115 KB

trying URL 'https://mirror.las.iastate.edu/CRAN/src/contrib/xml2_1.3.3.tar.gz'
Content type 'application/x-gzip' length 283965 bytes (277 KB)
==================================================
downloaded 277 KB

trying URL 'https://mirror.las.iastate.edu/CRAN/src/contrib/usethis_2.1.6.tar.gz'
Content type 'application/x-gzip' length 342349 bytes (334 KB)
==================================================
downloaded 334 KB

trying URL 'https://mirror.las.iastate.edu/CRAN/src/contrib/roxygen2_7.2.0.tar.gz'
Content type 'application/x-gzip' length 277678 bytes (271 KB)
==================================================
downloaded 271 KB

trying URL 'https://mirror.las.iastate.edu/CRAN/src/contrib/rversions_2.1.1.tar.gz'
Content type 'application/x-gzip' length 42064 bytes (41 KB)
==================================================
downloaded 41 KB

trying URL 'https://mirror.las.iastate.edu/CRAN/src/contrib/devtools_2.4.3.tar.gz'
Content type 'application/x-gzip' length 372413 bytes (363 KB)
==================================================
downloaded 363 KB

* installing *source* package ‘zip’ ...
** package ‘zip’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -Wno-implicit-function-declaration  miniz.c zip.c unixutils.c tools/cmdzip.c -o tools/cmdzip
clang -Wno-implicit-function-declaration  miniz.c zip.c unixutils.c tools/cmdunzip.c -o tools/cmdunzip
clang -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG   "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -Wno-implicit-function-declaration  -c init.c -o init.o
clang -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG   "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -Wno-implicit-function-declaration  -c miniz.c -o miniz.o
clang -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG   "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -Wno-implicit-function-declaration  -c rzip.c -o rzip.o
clang -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG   "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -Wno-implicit-function-declaration  -c zip.c -o zip.o
clang -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG   "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -Wno-implicit-function-declaration  -c unixutils.c -o unixutils.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/homebrew/Cellar/r/4.2.1/lib/R/lib -L/opt/homebrew/opt/libxml2/lib -o zip.so init.o miniz.o rzip.o zip.o unixutils.o -L/opt/homebrew/Cellar/r/4.2.1/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
ld: library not found for -lintl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [zip.so] Error 1
ERROR: compilation failed for package ‘zip’
* removing ‘/opt/homebrew/lib/R/4.2/site-library/zip’
* installing *source* package ‘xml2’ ...
** package ‘xml2’ successfully unpacked and MD5 sums checked
** using staged installation
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/opt/homebrew/anaconda3/include/libxml2 -I/opt/homebrew/anaconda3/include
Using PKG_LIBS=-L/opt/homebrew/anaconda3/lib -lxml2 -L/opt/homebrew/anaconda3/lib -lz -L/opt/homebrew/anaconda3/lib -llzma -lpthread -L/opt/homebrew/anaconda3/lib -liconv -L/opt/homebrew/anaconda3/lib -licui18n -licuuc -licudata -lm
** libs
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG -I../inst/include -I/opt/homebrew/anaconda3/include/libxml2 -I/opt/homebrew/anaconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -g -O2  -c connection.cpp -o connection.o
clang -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG -I../inst/include -I/opt/homebrew/anaconda3/include/libxml2 -I/opt/homebrew/anaconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -Wno-implicit-function-declaration  -c init.c -o init.o
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG -I../inst/include -I/opt/homebrew/anaconda3/include/libxml2 -I/opt/homebrew/anaconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -g -O2  -c xml2_doc.cpp -o xml2_doc.o
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG -I../inst/include -I/opt/homebrew/anaconda3/include/libxml2 -I/opt/homebrew/anaconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -g -O2  -c xml2_init.cpp -o xml2_init.o
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG -I../inst/include -I/opt/homebrew/anaconda3/include/libxml2 -I/opt/homebrew/anaconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -g -O2  -c xml2_namespace.cpp -o xml2_namespace.o
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG -I../inst/include -I/opt/homebrew/anaconda3/include/libxml2 -I/opt/homebrew/anaconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -g -O2  -c xml2_node.cpp -o xml2_node.o
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG -I../inst/include -I/opt/homebrew/anaconda3/include/libxml2 -I/opt/homebrew/anaconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -g -O2  -c xml2_output.cpp -o xml2_output.o
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG -I../inst/include -I/opt/homebrew/anaconda3/include/libxml2 -I/opt/homebrew/anaconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -g -O2  -c xml2_schema.cpp -o xml2_schema.o
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG -I../inst/include -I/opt/homebrew/anaconda3/include/libxml2 -I/opt/homebrew/anaconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -g -O2  -c xml2_url.cpp -o xml2_url.o
clang++ -std=gnu++14 -I"/opt/homebrew/Cellar/r/4.2.1/lib/R/include" -DNDEBUG -I../inst/include -I/opt/homebrew/anaconda3/include/libxml2 -I/opt/homebrew/anaconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  "-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include"   -fPIC  -g -O2  -c xml2_xpath.cpp -o xml2_xpath.o
clang++ -std=gnu++14 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/opt/homebrew/Cellar/r/4.2.1/lib/R/lib -L/opt/homebrew/opt/libxml2/lib -o xml2.so connection.o init.o xml2_doc.o xml2_init.o xml2_namespace.o xml2_node.o xml2_output.o xml2_schema.o xml2_url.o xml2_xpath.o -L/opt/homebrew/anaconda3/lib -lxml2 -L/opt/homebrew/anaconda3/lib -lz -L/opt/homebrew/anaconda3/lib -llzma -lpthread -L/opt/homebrew/anaconda3/lib -liconv -L/opt/homebrew/anaconda3/lib -licui18n -licuuc -licudata -lm -L/opt/homebrew/Cellar/r/4.2.1/lib/R/lib -lR -lintl -Wl,-framework -Wl,CoreFoundation
installing to /opt/homebrew/lib/R/4.2/site-library/00LOCK-xml2/00new/xml2/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
Error : read_xml.Rd:58: unable to load shared object '/opt/homebrew/lib/R/4.2/site-library/00LOCK-xml2/00new/xml2/libs/xml2.so':
  dlopen(/opt/homebrew/lib/R/4.2/site-library/00LOCK-xml2/00new/xml2/libs/xml2.so, 0x0006): Library not loaded: @rpath/libz.1.dylib
  Referenced from: /opt/homebrew/lib/R/4.2/site-library/00LOCK-xml2/00new/xml2/libs/xml2.so
  Reason: tried: '/opt/homebrew/Cellar/r/4.2.1/lib/R/lib/libz.1.dylib' (no such file)
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/opt/homebrew/lib/R/4.2/site-library/xml2’
ERROR: dependency ‘zip’ is not available for package ‘gert’
* removing ‘/opt/homebrew/lib/R/4.2/site-library/gert’
ERROR: dependency ‘xml2’ is not available for package ‘roxygen2’
* removing ‘/opt/homebrew/lib/R/4.2/site-library/roxygen2’
ERROR: dependency ‘xml2’ is not available for package ‘rversions’
* removing ‘/opt/homebrew/lib/R/4.2/site-library/rversions’
ERROR: dependency ‘gert’ is not available for package ‘usethis’
* removing ‘/opt/homebrew/lib/R/4.2/site-library/usethis’
ERROR: dependencies ‘usethis’, ‘roxygen2’, ‘rversions’ are not available for package ‘devtools’
* removing ‘/opt/homebrew/lib/R/4.2/site-library/devtools’

The downloaded source packages are in
    ‘/private/var/folders/jc/5gc6fmf52cv6r88m6snhvvlr0000gn/T/RtmpDCK0EX/downloaded_packages’
Warning messages:
1: In install.packages("devtools") :
  installation of package ‘zip’ had non-zero exit status
2: In install.packages("devtools") :
  installation of package ‘xml2’ had non-zero exit status
3: In install.packages("devtools") :
  installation of package ‘gert’ had non-zero exit status
4: In install.packages("devtools") :
  installation of package ‘roxygen2’ had non-zero exit status
5: In install.packages("devtools") :
  installation of package ‘rversions’ had non-zero exit status
6: In install.packages("devtools") :
  installation of package ‘usethis’ had non-zero exit status
7: In install.packages("devtools") :
  installation of package ‘devtools’ had non-zero exit status
> 
> sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: aarch64-apple-darwin21.5.0 (64-bit)
Running under: macOS Monterey 12.4

Matrix products: default
BLAS:   /opt/homebrew/Cellar/openblas/0.3.20/lib/libopenblasp-r0.3.20.dylib
LAPACK: /opt/homebrew/Cellar/r/4.2.1/lib/R/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] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_4.2.1 tools_4.2.1   

% clang --version
clang version 11.1.0
Target: arm64-apple-darwin21.5.0
Thread model: posix
InstalledDir: /opt/homebrew/anaconda3/envs/py39/bin

 % gcc --version
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: arm64-apple-darwin21.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

% gfortran --version
GNU Fortran (Homebrew GCC 11.3.0_2) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
hadley commented 2 years ago

Looks like the zip package failed to install, so you might start there. Generally, using R from homebrew is going to be an up hill battle, and you're probably better off with the CRAN version which will automatically install binaries.

aaelony-aeg commented 2 years ago

Thank-you for that. It is definitely a homebrew version of R issue. I am since using the standard distribution of R without problem.