1

When I tried to install Acumos package in R, I failed. It seems it is due to protobuf and most particulary common.h file. I use R version 3.5.1.

install.packages("acumos",,c("http://r.research.att.com","http://rforge.net"))
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
also installing the dependency ‘RProtoBuf’

trying URL 'http://r.research.att.com/src/contrib/RProtoBuf_0.4.12.tar.gz'
Content type 'application/x-gzip' length 1263377 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

trying URL 'http://rforge.net/src/contrib/acumos_0.2-7.tar.gz'
Content type 'application/x-gzip' length 9383 bytes
==================================================
downloaded 9383 bytes

* installing *source* package ‘RProtoBuf’ ...
** package ‘RProtoBuf’ successfully unpacked and MD5 sums checked

- checking for g++... g++
- checking whether the C++ compiler works... yes
- checking for C++ compiler default output file name... a.out
- checking for suffix of executables...
- checking whether we are cross compiling... no
- checking for suffix of object files... o
- checking whether we are using the GNU C++ compiler... yes
- checking whether g++ accepts -g... yes
- checking how to run the C++ preprocessor... g++ -E
- checking for gcc... gcc
- checking whether we are using the GNU C compiler... yes
- checking whether gcc accepts -g... yes
- checking for gcc option to accept ISO C89... none needed
- checking whether we are using the GNU C++ compiler... (cached) yes
- checking whether g++ accepts -g... (cached) yes
- checking for pkg-config... no
- checking for protoc... yes
- checking for grep that handles long lines and -e... /bin/grep
- checking for egrep... /bin/grep -E
- checking for ANSI C header files... yes
- checking for sys/types.h... yes
- checking for sys/stat.h... yes
- checking for stdlib.h... yes
- checking for string.h... yes
- checking for memory.h... yes
- checking for strings.h... yes
- checking for inttypes.h... yes
- checking for stdint.h... yes
- checking for unistd.h... yes
- checking google/protobuf/stubs/common.h usability... no
- checking google/protobuf/stubs/common.h presence... no
- checking for google/protobuf/stubs/common.h... no
- configure: WARNING: Protobuf headers not found with default CXXFLAGS and 
- CPPFLAGS, manually trying /usr/local/include
- configure: WARNING: Unsetting ac_cv_header_google_protobuf_stubs_common_h
- checking google/protobuf/stubs/common.h usability... no
- checking google/protobuf/stubs/common.h presence... no
- checking for google/protobuf/stubs/common.h... no
- configure: error: ERROR: ProtoBuf headers required; use '-Iincludedir' in 
CXXFLAGS for unusual locations.
- ERROR: configuration failed for package ‘RProtoBuf’
* removing ‘/usr/local/lib/R/site-library/RProtoBuf’
- ERROR: dependency ‘RProtoBuf’ is not available for package ‘acumos’
* removing ‘/usr/local/lib/R/site-library/acumos’

- The downloaded source packages are in 
        ‘/tmp/RtmpdARWMZ/downloaded_packages’
- Warning messages:
- 1: In install.packages("acumos", , c("http://r.research.att.com", "http://rforge.net")) :

- installation of package ‘RProtoBuf’ had non-zero exit status
- 2: In install.packages("acumos", , c("http://r.research.att.com", "http://rforge.net")) :
- installation of package ‘acumos’ had non-zero exit status
divibisan
  • 11,659
  • 11
  • 40
  • 58
Phil
  • 314
  • 1
  • 2
  • 13
  • Do you have the protocol-buffers package installed on this host? Check if you can run the command-line tool "protoc". If not, on Ubuntu do this: sudo apt-get install protobuf-compiler – chrisinmtown Sep 25 '18 at 19:59
  • Thanks for your answer Chrisinmtown. – Phil Sep 26 '18 at 12:53
  • Thanks for your answer Chrisinmtown. unfortunately your proposal doesn't work, I made also apt-get update, apt-get upgrade but error message was the same. Nevertheless I progress on the way of succes. I replaced the folder **google** located in **/usr/include** by this found in https://github.com/mingchen/protobuf-ios/tree/master/compiler/src and then now I haven't any problem with common.h but I have this new error message checking if ProtoBuf version >= 2.2.0... configure: error: Need ProtoBuf version >= 2.2.0. I'am working on it – Phil Sep 26 '18 at 13:05
  • Glad to hear of progress, please share more details about your environment, that apt-get works for me in Ubuntu 16.04. I am not confident that installing an "iOS" version of protobuf is the right thing to do here .. – chrisinmtown Sep 26 '18 at 15:37
  • I tried many things (uninstall, reinstall) but nothing works. When I type "protoc --version" the result is "libprotoc 3.6.1" then When I tried to install the pakage RProtoBuf in R "install.packages('RProtoBuf') I have always the following error message : "configure: error: Need ProtoBuf version >= 2.2.0". Baffling isn't it ? – Phil Sep 26 '18 at 15:48

2 Answers2

2

RProtoBuf maintainer here: the requirements (on a Debian/Ubuntu system) are enumerated clearly in this Dockerfile we now use for the Travis CI tests of that package:

RUN apt-get update \
        && apt-get install -y --no-install-recommends \
                r-cran-rcpp \
                r-cran-rcurl \
                r-cran-runit \
                r-cran-rmarkdown \
                r-cran-knitr \
                protobuf-compiler \
                protobuf-c-compiler \
                libprotobuf-c-dev \
                libprotobuf-dev \
                libprotoc-dev \
        && install.r pinp 

This combines the R and ProtocolBuffer requirements, so if you "just" want to build the package you need at least

protobuf-compiler protobuf-c-compiler libprotobuf-c-dev libprotobuf-dev libprotoc-dev

and you may get away without the compilers if you never want to compile .proto files.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • I'm up to date with the package you mentionned above, my previous problem has been solved by apt-get install libprotoc-dev but now I have the following error :** testing if installed package can be loaded Error: package or namespace load failed for ‘RProtoBuf’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/usr/local/lib/R/site-library/RProtoBuf/libs/RProtoBuf.so':/usr/local/lib/R/site-library/RProtoBuf/libs/RProtoBuf.so: undefined symbol: _ZN6google8protobuf2io16CodedInputStreamC1EPNS1_19ZeroCopyInputStreamE – Phil Sep 27 '18 at 12:34
  • Beats me, I have never seen this in many years we authored and maintained RProtoBuf. It also passes at CRAN. Ensure the library versions you have are correct, and maybe ensure that they contain the symbol you are after. If you can [create a MVCE](https://stackoverflow.com/help/mcve) consider filing an issue at the GitHub repo. – Dirk Eddelbuettel Sep 27 '18 at 13:37
  • Hi finally I succeed, the problem was not in the RProtoBuf but in protobuf. So first put protoc3 file in /usr/local/bin (you can find protoc3 from [link](https://gist.github.com/sofyanhadia/37787e5ed098c97919b8c593f0ec44d8) then retreive the folder "google" from [link](https://github.com/mingchen/protobuf-ios) and put it in /usr/local/. Then chmod 777 on usr/local/google, usr/local/google/protobuf and on usr/local/google/protobuf/compiler. Then install.packages('RProtoBuf') under R and installation is completed without any problem. It's dirty but it works. I'm on ubuntu 16.04.5 LTS – Phil Sep 28 '18 at 16:04
  • Glad it's working for you. I have the feeling we had support for version 3 of the `proto` files for long enough to also cover 16.04. Maybe updating to 18.04 would be a good idea. Your call. In any event, the _package_ itself is fine. – Dirk Eddelbuettel Sep 28 '18 at 16:07
1

I believe R is looking for the Google protocol-buffer header files that are in package libprotoc-dev, install that like this on Ubuntu:

sudo apt-get install libprotoc-dev

I pointed you to the command-line package previously, sorry about that.

If all else fails, use the force and download the source from https://github.com/protocolbuffers/protobuf

chrisinmtown
  • 3,571
  • 3
  • 34
  • 43
  • Hi, installation of libprotoc-dev solve the problem related to protobf version older than 2.20, thanks. I go further in the installation but now I have another problem. Error: package or namespace load failed for ‘RProtoBuf’ in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/usr/local/lib/R/site-library/RProtoBuf/libs/RProtoBuf.so': /usr/local/lib/R/site-library/RProtoBuf/libs/RProtoBuf.so I guess it rather a R issue – Phil Sep 27 '18 at 10:01