Home > Mobile >  Updating R packages in anaconda but getting a clang-12 error
Updating R packages in anaconda but getting a clang-12 error

Time:09-16

I'm on a mac m1 machine. I'm using RStudio in Anaconda and I wanted to update the R packages with the update button. However, I got the same error for many of the packages when I tried to update. Here is one example:

> install.packages("askpass")
trying URL 'https://cran.rstudio.com/src/contrib/askpass_1.1.tar.gz'
Content type 'application/x-gzip' length 5730 bytes
==================================================
downloaded 5730 bytes

* installing *source* package ‘askpass’ ...
** package ‘askpass’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
x86_64-apple-darwin13.4.0-clang -I"/Users/kaili/opt/anaconda3/envs/renv/lib/R/include" -DNDEBUG   -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/kaili/opt/anaconda3/envs/renv/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/kaili/opt/anaconda3/envs/renv/include -fdebug-prefix-map=/opt/concourse/worker/volumes/live/59b7f007-fada-42cf-7435-5bbd0518eaa4/volume/r-base_1570124919999/work=/usr/local/src/conda/r-base-3.6.1 -fdebug-prefix-map=/Users/kaili/opt/anaconda3/envs/renv=/usr/local/src/conda-prefix  -c askpass.c -o askpass.o
x86_64-apple-darwin13.4.0-clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Users/kaili/opt/anaconda3/envs/renv/lib/R/lib -Wl,-dead_strip_dylibs -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/kaili/opt/anaconda3/envs/renv/lib -L/Users/kaili/opt/anaconda3/envs/renv/lib -o askpass.dylib askpass.o -L/Users/kaili/opt/anaconda3/envs/renv/lib/R/lib -lR -Wl,-framework -Wl,CoreFoundation
ld: warning: -pie being ignored. It is only used when linking a main executable
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/kaili/opt/anaconda3/envs/renv/lib/R/share/make/shlib.mk:6: askpass.dylib] Error 1
ERROR: compilation failed for package ‘askpass’
* removing ‘/Users/kaili/opt/anaconda3/envs/renv/lib/R/library/askpass’
* restoring previous ‘/Users/kaili/opt/anaconda3/envs/renv/lib/R/library/askpass’
Warning in install.packages :
  installation of package ‘askpass’ had non-zero exit status

The downloaded source packages are in/private/var/folders/18/sx26824d315c28x_q4qg2t3h0000gn/T/RtmpVpPrtm/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done

I'm new to R and Anaconda and have no idea where the problem might be. Any hint would be greatly appreciated. Thank you!

CodePudding user response:

It is simpler to avoid using install.packages() when using an R environment managed by Conda, especially when the package involves compilation. Instead, prefer using Conda for installation. In this particular case, use

conda install -n renv -c conda-forge r-askpass

from a shell session.

  • Related