Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RHbase/thrift install issue

I'm trying to install RHbase onto R 3.1.1 on Mac OSX 10.10.

I've installed thrift via Homebrew, and yet, I get the following when I try to install Hbase from source through R:

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

Presumably it's missing a link to the required library?

EDIT: Looking at what pkg-config returns..

pkg-config --cflags thrift
-I/usr/local/Cellar/thrift/0.9.1/include 
like image 948
Brian O'Halloran Avatar asked Nov 06 '14 20:11

Brian O'Halloran


1 Answers

I think I figured it out. My config starts out the same as yours, and I get the same errors:

% pkg-config --cflags thrift
-I/usr/local/Cellar/thrift/0.9.2/include

I made two changes to /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

The first one just adds /thrift to the end of the includedir= line. The second adds the -std=c++11 argument to Cflags, to solve the next problem you'll hit, a namespace issue.

Then your config should look like the below, and installing rhbase should succeed, though still with a lot of warnings.

% pkg-config --cflags thrift
-std=c++11 -I/usr/local/Cellar/thrift/0.9.2/include/thrift
like image 147
Ken Williams Avatar answered Nov 03 '22 20:11

Ken Williams