[Rprotobuf-yada] reading messages from files

Dirk Eddelbuettel edd at debian.org
Fri Nov 6 17:03:09 CET 2009


On 6 November 2009 at 16:14, Romain François wrote:
| 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/
| > R CMD INSTALL pkg
| >
| > 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.

Could be related.

On the other hand that ../inst/proto/ path is fixed an _not_ different on OS X.  
Headers/libs for e.g. Rcpp live in different files.

Here the obj code for tutorial::AddressBook was not found. Maybe
addressbook.pb.cc did not get linked?  

Which is why I asked for those lines from R CMD INSTALL

| 
| > 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 ...

Yep!

Dirk

-- 
Three out of two people have difficulties with fractions.


More information about the Rprotobuf-yada mailing list