
我嘗試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
然後再次運行安裝,它應該可以工作。