我尝试lintr
在 macOS 10.12.6 上安装(已通过 Homebrew 安装 R 3.4.3),但在名为 的子包上安装失败igraph
。错误如下:
ld: warning: directory not found for option '-L/usr/local/opt/gcc/lib/gcc/7/gcc/x86_64-apple-darwin16.7.0/7.2.0'
ld: warning: directory not found for option '-L/usr/local/opt/gcc/lib/gcc/7/gcc/x86_64-apple-darwin16.7.0/7.2.0'
ld: file not found: /usr/lib/system/libsystem_darwin.dylib for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [igraph.so] Error 1
ERROR: compilation failed for package ‘igraph’
* removing ‘/usr/local/lib/R/3.4/site-library/igraph’
我怎样才能纠正这个错误并让它正常工作?
答案1
安装此库时,我遇到了一个警告和一个错误。首先,我在系统上安装了较新版本的 gcc (7.3.0),因此我创建了一个指向已安装版本的符号链接:
ls -la /usr/local/opt/gcc/lib/gcc/7/gcc/x86_64-apple-darwin16.7.0/
我发现只安装了 7.3.0 版本,因此我执行以下操作:
ln -s /usr/local/opt/gcc/lib/gcc/7/gcc/x86_64-apple-darwin16.7.0/7.3.0 /usr/local/opt/gcc/lib/gcc/7/gcc/x86_64-apple-darwin16.7.0/7.2.0
然后我还必须修复ld: file not found: /usr/lib/system/libsystem_darwin.dylib for architecture x86_64
。为此我执行了:
sudo xcode-select -s /Library/Developer/CommandLineTools
然后再次运行安装,它就应该可以工作了。