2014-03-07 92 views
3

因此,這裏的東西:安裝[R包的libstdC++

我試圖安裝的R包(「Zinba」)和我使用的OS X 10.9.1小牛隊和我有R CMD以下錯誤安裝:

* installing to library ‘/usr/local/Cellar/r/3.0.2/R.framework/Versions/3.0/Resources/library’ 
* installing *source* package ‘zinba’ ... 
** libs 
clang -I/usr/local/Cellar/r/3.0.2/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC -c aliType.c -o aliType.o 
clang++ -I/usr/local/Cellar/r/3.0.2/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC -g -O2 -c alignAdjust.cc -o alignAdjust.o 
clang++ -I/usr/local/Cellar/r/3.0.2/R.framework/Resources/include -DNDEBUG -I/usr/local/include -fPIC -g -O2 -c analysis.cc -o analysis.o 
In file included from analysis.cc:18: 
./analysis.h:10:10: fatal error: 'ext/slist' file not found 
#include <ext/slist> 
    ^
1 error generated. 
make: *** [analysis.o] Error 1 
ERROR: compilation failed for package ‘zinba’ 
* removing ‘/usr/local/Cellar/r/3.0.2/R.framework/Versions/3.0/Resources/library/zinba’ 

我搜索這個錯誤,它看起來像的XCode在小牛默認使用的libC++來代替的libstdC++和建議是使用編譯「-stdlib =的libstdC++」

現在,這是第三方R包。任何人都可以建議如何使用libstdC++編譯這個包。此外,我在我的機器上查找了這個庫,我找不到它。

謝謝。

回答

0

在REPL,你可以使用withr::with_makevars在安裝過程中暫時定義環境變量:

library(withr) 

with_makevars(c(CXXFLAGS = "-stdlib=libstdc++"), 
       install.packages("zinba", repos = NULL, type = "source")) 

引擎蓋下,會創建一個與您提供的代碼的臨時文件,設置環境變量R_MAKEVARS_USER指向它,然後在完成時恢復默認值。