[Rprotobuf-yada] reading messages from files

Romain François francoisromain at free.fr
Fri Nov 6 16:14:47 CET 2009

On 11/06/2009 03:57 PM, Saptarshi Guha wrote:
> Excellent work. A few issues with building
> In both cases i checked out from SVN(fresh copy)
> cd rprotobuf/
> 1) On Leopard 10.5,
> it builds, but when I try to load
> library(RProtoBuf)
> Loading required package: Rcpp
> Error in dyn.load(file, DLLpath = DLLpath, ...) :
> unable to load shared library
> '/Library/Frameworks/R.framework/Resources/library/RProtoBuf/libs/i386/RProtoBuf.so':
> dlopen(/Library/Frameworks/R.framework/Resources/library/RProtoBuf/libs/i386/RProtoBuf.so,
> 6): Symbol not found: __ZN8tutorial11AddressBookC1Ev
> Referenced from:
> /Library/Frameworks/R.framework/Resources/library/RProtoBuf/libs/i386/RProtoBuf.so
> Expected in: dynamic lookup
> Error: package/namespace load failed for 'RProtoBuf'

No idea what it could be. Is this because of

addressbook.pb.cc:	../inst/proto/addressbook.proto

and the fact that macs typically build for multiple arch, so need one 
more level. I think there is something to figure out the root dir of the 
package instead of using .. but I'm not so sure what.

> 2) On RHEL5
> (uname: Linux spica 2.6.18-128.4.1.el5 #1 SMP Thu Jul 23 19:59:19 EDT
> 2009 x86_64 x86_64 x86_64 GNU/Linux)
> even though I have protobuf installed
> checking for protoc... yes
> checking for ProtoBuf headers and library... no
> Your installation does not appear to have ProtoBuf headers and libraries.
> Please make sure that you have a working and complete ProtoBuf
> installation.
> ERROR: configuration failed for package 'RProtoBuf'
> ** Removing '/ln/meraki/custom/lib64/R/library/RProtoBuf'

you need to install the libprotobuf-devel rpm. It was easy in fedora, so 
you might be able to install them through EPEL or something.

> 3) I now think that it might not be useful to merge rprotobuf (which I
> plan to rename rpbsz) with this new package.
> I saw the examples and there are really nice. Everything I did in
> rprotobuf can be done from within R via RProtoBuf(or wrappers around it)
> and my package is just a wrapper around one proto file wherea
> RProtoBuffer can handle any proto file.
> I'm thinking that it would be enough to keep the proto file i used in
> the proto directory as an example (though it is a very detailed proto
> file).

The two surely use two very different approaches, you can serialize 
"any" R data as a protobuf message using one message type, and we can 
serialize any message type. AFAICS, the bridge between the two simply 
consists of defining a bunch of setAs methods:

setAs( "integer", "protobufMessage", function(from){
    # some code that makes an appropriate message
} )

I think we need this anyway since quite likely people are going to ask 
"how can i make a message from a data frame", etc ...

> Regards
> Saptarshi
> On Nov 6, 2009, at 8:07 AM, Romain François wrote:
>> On 11/06/2009 01:49 PM, Dirk Eddelbuettel wrote:
>>> On 6 November 2009 at 13:42, Romain François wrote:
>>> | Now reading a message from a file :
>>> [...]
>>> You rock! Nice work. I am currently moving RcppList up into Rcpp so
>>> at some
>>> point I may have to make you to upgrade Rcpp from R-Forge, ok?
>> Why not. I'll request to join.
>>> Dirk

Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
|- http://tr.im/BcPw : celebrating R commit #50000
|- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc
`- http://tr.im/yw8E : New R package : sos

More information about the Rprotobuf-yada mailing list