首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误: clang-10:错误:链接器命令失败,退出代码1而今用Python在Anaconda环境上安装R,R失败

错误: clang-10:错误:链接器命令失败,退出代码1而今用Python在Anaconda环境上安装R,R失败
EN

Stack Overflow用户
提问于 2021-03-05 09:21:13
回答 1查看 382关注 0票数 0

直到几天前,我还在Conda上完成了R的启动和运行,当时我在处理包时,不得不删除环境。现在,我正在尝试重新创造我的环境,一切都不再只是起作用了。

要知道的事情:

OS: MacOS BigSur

Conda环境包含:Python3.8和R3.6.1

代码语言:javascript
复制
> version
               _                           
platform       x86_64-apple-darwin13.4.0   
arch           x86_64                      
os             darwin13.4.0                
system         x86_64, darwin13.4.0        
status                                     
major          3                           
minor          6.1                         
year           2019                        
month          07                          
day            05                          
svn rev        76782                       
language       R                           
version.string R version 3.6.1 (2019-07-05)
nickname       Action of the Toes   

which R命令显示路径为thegeorgejoseph/anaconda/envs/protonaml/bin/R

.libPaths()显示它是thegeorgejoseph/anaconda/envs/protonaml/lib/R/library

他们为什么不一样?这可能是问题的原因吗?

当我尝试安装other时,它运行了几次失败,说tibblerlang和其他几个软件包无法安装。当我在R上运行install.packages(rlang)命令时,会得到以下跟踪。任何帮助都是值得感谢的,有什么可能出错呢?

代码语言:javascript
复制
 install.packages('rlang')
trying URL 'https://cloud.r-project.org/src/contrib/rlang_0.4.10.tar.gz'
Content type 'application/x-gzip' length 915685 bytes (894 KB)
==================================================
downloaded 894 KB

* installing *source* package ‘rlang’ ...
** package ‘rlang’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
x86_64-apple-darwin13.4.0-clang -I"/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/include" -DNDEBUG -I./lib/  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/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/thegeorgejoseph/opt/anaconda3/envs/protonaml=/usr/local/src/conda-prefix  -c capture.c -o capture.o
x86_64-apple-darwin13.4.0-clang -I"/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/include" -DNDEBUG -I./lib/  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/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/thegeorgejoseph/opt/anaconda3/envs/protonaml=/usr/local/src/conda-prefix  -c export.c -o export.o
x86_64-apple-darwin13.4.0-clang -I"/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/include" -DNDEBUG -I./lib/  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/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/thegeorgejoseph/opt/anaconda3/envs/protonaml=/usr/local/src/conda-prefix  -c internal.c -o internal.o
x86_64-apple-darwin13.4.0-clang -I"/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/include" -DNDEBUG -I./lib/  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/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/thegeorgejoseph/opt/anaconda3/envs/protonaml=/usr/local/src/conda-prefix  -c lib.c -o lib.o
x86_64-apple-darwin13.4.0-clang -I"/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/include" -DNDEBUG -I./lib/  -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9  -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/include  -fPIC  -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/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/thegeorgejoseph/opt/anaconda3/envs/protonaml=/usr/local/src/conda-prefix  -c version.c -o version.o
x86_64-apple-darwin13.4.0-clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/lib -Wl,-dead_strip_dylibs -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib -L/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib -o rlang.dylib capture.o export.o internal.o lib.o version.o -L/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/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/System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd' for architecture x86_64
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/share/make/shlib.mk:6: rlang.dylib] Error 1
ERROR: compilation failed for package ‘rlang’
* removing ‘/Users/thegeorgejoseph/opt/anaconda3/envs/protonaml/lib/R/library/rlang’

PS:我也尝试将Rstudio安装到环境中,但是使用install.packages()命令得到了同样的错误。但是,在创建一个新环境并使用Anaconda安装我需要的每个包时,安装是成功的,不会引发任何错误,但我仍然无法使用library(rattle)加载脚本中的库。

EN

回答 1

Stack Overflow用户

发布于 2021-03-05 23:40:57

which R.libPaths()没有问题--这正是它们应该做的,前者指向二进制文件,后者指向安装R包的位置。

至于错误,人们应该更喜欢使用conda install而不是R的install.packages来管理包,而不是在Conda环境中使用R。否则,动态库链接可能会出现问题。在这种情况下,尝试

代码语言:javascript
复制
conda install -n protonaml -c conda-forge r-rattle

对于非编译的R包来说,这不是什么问题,类似于在Conda环境中使用pip对于纯Python来说通常是很好的。不过,为了避免这些问题,我通常建议坚持使用conda install。注意,conda-forge通道有许多CRAN包。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66489856

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档