我正在尝试将 RHbase 安装到 Mac OSX 10.10 上的 R 3.1.1 上。
我已经通过 Homebrew 安装了 thrift,但是,当我尝试通过 R 从源代码安装 Hbase 时,我得到以下信息:
install.packages("~/Downloads/rhbase_1.2.1.tar.gz", repos = NULL, type = "source")
* installing *source* package ‘rhbase’ ...
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I. -g -DHAVE_UINTPTR_T -DHAVE_NETDB_H=1 -fpermissive -DHAVE_INTTYPES_H -DHAVE_NETINET_IN_H -I./gen_cpp `pkg-config --cflags thrift` -Wall -fPIC -Wall -mtune=core2 -g -O2 -c Hbase.cpp -o Hbase.o
/bin/sh: pkg-config: command not found
In file included from Hbase.cpp:7:
./Hbase.h:10:10: fatal error: 'TProcessor.h' file not found
#include <TProcessor.h>
^
1 error generated.
make: *** [Hbase.o] Error 1
ERROR: compilation failed for package ‘rhbase’
* removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rhbase’
Warning in install.packages :
installation of package ‘/Users/halloran/Downloads/rhbase_1.2.1.tar.gz’ had non-zero exit status
大概它缺少指向所需库的链接?
编辑:查看 pkg-config 返回的内容..
pkg-config --cflags thrift
-I/usr/local/Cellar/thrift/0.9.1/include
最佳答案
我想我明白了。我的配置一开始和你的一样,但我得到了同样的错误:
% pkg-config --cflags thrift
-I/usr/local/Cellar/thrift/0.9.2/include
我对 /usr/local/lib/pkgconfig/thrift.pc
做了两处修改:
% cd /usr/local/lib/pkgconfig
% perl -pi -e 's{(^includedir=.*/include$)}{$1/thrift}' thrift.pc
% perl -pi -e 's{(^Cflags:.*)}{$1 -std=c++11}' thrift.pc
第一个只是将 /thrift
添加到 includedir=
行的末尾。第二个将 -std=c++11
参数添加到 Cflags
,以解决您将遇到的下一个问题,命名空间问题。
然后你的配置应该如下所示,并且安装 rhbase
应该会成功,尽管仍然有很多警告。
% pkg-config --cflags thrift
-std=c++11 -I/usr/local/Cellar/thrift/0.9.2/include/thrift
关于RHbase/thrift 安装问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26788769/