Conda 构建 R 包在 MacOS Mojave 上的 C 编译器问题上失败 [英] Conda build R package fails at C compiler issue on MacOS Mojave

查看:20
本文介绍了Conda 构建 R 包在 MacOS Mojave 上的 C 编译器问题上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 conda 安装一个名为treatSens 的 R 包,以便在 Jupyter 笔记本中使用它.我执行的命令:

I'm trying to install an R package called treatSens with conda to use it in Jupyter notebook. The commands I executed:

conda 安装 conda-buildconda 骨架 cran TreatSensconda build r-treatsensconda install -c local r-treatsens

我得到了关于 C 编译器的错误

And I got the error about C compiler

* installing *source* package ‘dbarts’ ...
** package ‘dbarts’ successfully unpacked and MD5 sums checked
checking for gcc... x86_64-apple-darwin13.4.0-clang
checking whether the C compiler works... no
configure: error: in `/Users/myusername/anaconda3/conda-bld/r-dbarts_1543961434509/myenvname':
configure: error: C compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘dbarts’

我的 clang 版本:

My clang version:

clang version 4.0.1 (tags/RELEASE_401/final)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Users/myusername/anaconda3/envs/myenvname/bin

查看我看到的 config.log 文件

Looking into the config.log file I see

configure:3570: x86_64-apple-darwin13.4.0-clang -V >&5
clang-4.0: error: argument to '-V' is missing (expected 1 value)
clang-4.0: error: no input files
configure:3581: $? = 1
configure:3570: x86_64-apple-darwin13.4.0-clang -qversion >&5
clang-4.0: error: unknown argument: '-qversion'
clang-4.0: error: no input files
configure:3581: $? = 1
configure:3601: checking whether the C compiler works
configure:3623: x86_64-apple-darwin13.4.0-clang -march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -I/Users/myusername/anaconda3/envs/work/conda-bld/r-dbarts_1543961045662/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include -fdebug-prefix-map=/Users/myusername/anaconda3/envs/work/conda-bld/r-dbarts_1543961045662/work=/usr/local/src/conda/r-dbarts-0.9_5 -fdebug-prefix-map=/Users/myusername/anaconda3/envs/work/conda-bld/r-dbarts_1543961045662/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol=/usr/local/src/conda-prefix -D_FORTIFY_SOURCE=2 -mmacosx-version-min=10.9 -I/Users/myusername/anaconda3/envs/work/conda-bld/r-dbarts_1543961045662/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/include -Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs -Wl,-rpath,/Users/myusername/anaconda3/envs/work/conda-bld/r-dbarts_1543961045662/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib -L/Users/myusername/anaconda3/envs/work/conda-bld/r-dbarts_1543961045662/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib conftest.c  >&5
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
ld: dynamic main executables must link with libSystem.dylib for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)

使用特定版本的 Apple C 编译器构建 Conda 似乎存在问题.我的猜测是我需要为 conda build 定制 C 编译器.所以我的问题变成了

It seems it's a problem about Conda build using the certain version of Apple C compiler. My guess is that I need to customize the C compiler for conda build. So my question becomes

  1. 我需要什么正确的 gcc 版本.
  2. 如何为 conda build 设置它.

推荐答案

作为一个快速而肮脏的解决方法(来自这个 comment),我能够在 RStudio 中使用以下代码在 R 中安装软件包(在 conda env 中打开)

As a quick and dirty workaround (from this comment), I was able to install packages in R using below code in RStudio (opened in conda env)

Sys.setenv(CONDA_BUILD_SYSROOT="/")

现在,您可以通过 RStudio 控制台安装任何 R 包,例如

Now, you can install any R package via RStudio Console e.g.

install.packages("tidyverse")

希望这会有所帮助.

这篇关于Conda 构建 R 包在 MacOS Mojave 上的 C 编译器问题上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆