eddelbuettel / rprotobuf

R Interface to Protocol Buffers
71 stars 25 forks source link

No member named ByteSizeLong #70

Closed gbrsales closed 4 years ago

gbrsales commented 4 years ago

I'm getting a build error on Ubuntu 18.04.

g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -pthread -g -O2 -fdebug-prefix-map=/build/MANUAL/r-base/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werro
r=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -pthread -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -g -O2 -fdebug-prefix-map=/build/MANUAL/r-ba
se/r-base-3.6.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c wrapper_Message.cpp -o wrapper_Message.o
wrapper_Message.cpp: In function ‘Rcpp::RawVector rprotobuf::Message__get_payload__rcpp__wrapper__(Rcpp::XPtr<google::protobuf::Message>)’:
wrapper_Message.cpp:149:30: error: ‘class google::protobuf::Message’ has no member named ‘ByteSizeLong’; did you mean ‘ByteSize’?
     R_xlen_t size = message->ByteSizeLong();
                              ^~~~~~~~~~~~
                              ByteSize
In file included from wrapper_Message.cpp:4:0:
wrapper_Message.cpp: In function ‘SEXPREC* rprotobuf::Message__bytesize(SEXP)’:
wrapper_Message.cpp:253:49: error: ‘class google::protobuf::Message’ has no member named ‘ByteSizeLong’; did you mean ‘ByteSize’?
 RPB_XP_METHOD_0(METHOD(bytesize), GPB::Message, ByteSizeLong)
                                                 ^
RcppMacros.h:123:35: note: in definition of macro ‘RPB_XP_METHOD_0’
         return ::Rcpp::wrap( ptr->__METHOD__(  ) ) ;      \
                                   ^~~~~~~~~~
/usr/lib/R/etc/Makeconf:177: recipe for target 'wrapper_Message.o' failed
make: *** [wrapper_Message.o] Error 1
ERROR: compilation failed for package ‘RProtoBuf’

R is installed from Michael Rutter's PPA (http://ppa.launchpad.net/marutter/rrutter3.5/ubuntu).

$ R --version
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"

System dependencies:

libprotobuf-dev:amd64  3.0.0-9.1ubuntu1
libprotoc-dev:amd64    3.0.0-9.1ubuntu1
protobuf-compiler      3.0.0-9.1ubuntu1
eddelbuettel commented 4 years ago

Darn. I am on 3.6.1.3-2 with Ubuntu 19.10. I'll look into a test and #ifdef.

eddelbuettel commented 4 years ago

Apparently a 3.6.0 thing: https://github.com/protocolbuffers/protobuf/blob/master/CHANGES.txt

eddelbuettel commented 4 years ago

Bugfix here if you can checkout a branch: https://github.com/eddelbuettel/rprotobuf/tree/bugfix/condition_bytesizelong

gbrsales commented 4 years ago

Builds cleanly now. Thanks!

eddelbuettel commented 4 years ago

Thanks for the confirmation (and of course the bug report). Not my proudest moment :-/

Also only now notice that I need to condition the new JSON tests by @siddharthab on actually having ProtoBuf 3 or newer. Adding that now...

eddelbuettel commented 4 years ago

I put an interim version RProtoBuf 0.4.16.1 into the GHRR Drat from where it can be installed via

install.packages("RProtoBuf", repos="https://ghrr.github.io/drat")