[Rprotobuf-yada] alternative to pkg-config

Romain Francois romain.francois at dbmail.com
Wed Apr 7 15:44:59 CEST 2010


Le 07/04/10 15:28, Dirk Eddelbuettel a écrit :
>
> On 7 April 2010 at 14:30, Romain Francois wrote:
> | Hi,
> |
> | It looks like I don't have pkg-config on OSX, so I see:
> |
> | checking for pkg-config... no
>
> Uh-oh.
>
> I just noticed yesterday that Uwe et al's fftw package also uses pkg-config.

Ah. Maybe this will facilitate pkg-config being installed on the machine 
that does OSX binaries. Something to ask to Simon.

> That is news to me. So we can not assume pkg-config. Sucky.

It is not that hard to install thanks to fink, e.g.

$ fink install pkgconfig

kudos to debian packages, but fink can be a pain to install. anyway, 
once pkg-config is installed and PKG_CONFIG_PATH properly set, this 
works fine.

> | ./configure: line 3527: pkg-config: command not found
> | ./configure: line 3528: pkg-config: command not found
> | ...
> | checking google/protobuf/stubs/common.h usability... yes
> | checking google/protobuf/stubs/common.h presence... yes
> | checking for google/protobuf/stubs/common.h... yes
> | checking google/protobuf/compiler/code_generator.h usability... yes
> | checking google/protobuf/compiler/code_generator.h presence... yes
> | checking for google/protobuf/compiler/code_generator.h... yes
>
> Did you just get lucky ie did you install protobuf in a common location?

./configure
make
sudo make install

installed in /usr/local/

> | but then :
> |
> | g++-4.2 -arch x86_64 -o RProtoBuf.dylib addressbook.pb.o
> | ConnectionCopyingInputStream.o ConnectionCopyingOutputStream.o
> | ConnectionInputStream.o ConnectionOutputStream.o DescriptorPoolLookup.o
> | EnumDescriptor_wrapper.o FieldDescriptor_wrapper.o RSourceTree.o
> | RWarningErrorCollector.o RconnectionCopyingInputStream.o
> | ServiceDescriptor_wrapper.o SocketCopyingInputStream.o
> | ZeroCopyInputStreamWrapper.o ZeroCopyOutputStreamWrapper.o add.o
> | add_person_R.o as.o ascharacter.o aslist.o clear.o clear_person_R.o
> | clone.o completion.o constructors.o containing_type.o exceptions.o
> | extractors.o field_count.o fileDescriptor.o has.o identical.o
> | initialized.o length.o list_people_R.o lookup.o merge.o methods.o
> | mutators.o name.o read.o rpc_over_http.o rprotobuf.o serialize.o set.o
> | size.o streams.o swap.o update.o -dynamiclib
> | -Wl,-headerpad_max_install_names  -undefined dynamic_lookup
> | -single_module -multiply_defined suppress
> | /Library/Frameworks/R.framework/Resources/library/Rcpp/lib/x86_64/libRcpp.a
> | g++-4.2 -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names
> | -undefined dynamic_lookup -single_module -multiply_defined suppress
> | -L/usr/local/lib -o RProtoBuf.so ConnectionCopyingInputStream.o
> | ConnectionCopyingOutputStream.o ConnectionInputStream.o
> | ConnectionOutputStream.o DescriptorPoolLookup.o EnumDescriptor_wrapper.o
> | FieldDescriptor_wrapper.o RSourceTree.o RWarningErrorCollector.o
> | RconnectionCopyingInputStream.o ServiceDescriptor_wrapper.o
> | SocketCopyingInputStream.o ZeroCopyInputStreamWrapper.o
> | ZeroCopyOutputStreamWrapper.o add.o add_person_R.o as.o ascharacter.o
> | aslist.o clear.o clear_person_R.o clone.o completion.o constructors.o
> | containing_type.o exceptions.o extractors.o field_count.o
> | fileDescriptor.o has.o identical.o initialized.o length.o
> | list_people_R.o lookup.o merge.o methods.o mutators.o name.o read.o
> | rpc_over_http.o rprotobuf.o serialize.o set.o size.o streams.o swap.o
> | update.o
> | /Library/Frameworks/R.framework/Resources/library/Rcpp/lib/x86_64/libRcpp.a
> | -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
> | -Wl,CoreFoundation
> | installing to
> | /Library/Frameworks/R.framework/Resources/library/RProtoBuf/libs/x86_64
> |
> | ** R
> | ** demo
> | ** inst
> | ** preparing package for lazy loading
> | ** help
> | *** installing help indices
> | ** building package indices ...
> | ** testing if installed package can be loaded
> | Error in dyn.load(file, DLLpath = DLLpath, ...) :
> |    impossible de charger la bibliothèque partagée
> | '/Library/Frameworks/R.framework/Resources/library/RProtoBuf/libs/x86_64/RProtoBuf.so':
> |
> | dlopen(/Library/Frameworks/R.framework/Resources/library/RProtoBuf/libs/x86_64/RProtoBuf.so,
> | 6): Symbol not found:
> | __ZN6google8protobuf15FieldDescriptor17kTypeToCppTypeMapE
> |    Referenced from:
> | /Library/Frameworks/R.framework/Resources/library/RProtoBuf/libs/x86_64/RProtoBuf.so
> |    Expected in: flat namespace
> |   in
> | /Library/Frameworks/R.framework/Resources/library/RProtoBuf/libs/x86_64/RProtoBuf.so
> | ERREUR : loading failed
> | * removing ‘/Library/Frameworks/R.framework/Resources/library/RProtoBuf’
> |
> |
> | It seems I can install pkg-config from fink, but maybe some other would
> | not, can we do it without pkg-config ?
> |
> | (.... installing pkg-config through fink.)
>
> I have no idea. OS X is all yours. Maybe you could ask on the protobuf list
> how they expect to be tested for on OS X?

Perhaps.

> | Now I get a different error:
> |
> | ** testing if installed package can be loaded
> | Error in dyn.load(file, DLLpath = DLLpath, ...) :
> |    impossible de charger la bibliothèque partagée
> | '/Library/Frameworks/R.framework/Resources/library/RProtoBuf/libs/x86_64/RProtoBuf.so':
> |
> | dlopen(/Library/Frameworks/R.framework/Resources/library/RProtoBuf/libs/x86_64/RProtoBuf.so,
> | 6): Symbol not found: __ZN8tutorial18Person_PhoneNumber16_default_number_E
> |    Referenced from:
> | /Library/Frameworks/R.framework/Resources/library/RProtoBuf/libs/x86_64/RProtoBuf.so
> |    Expected in: flat namespace
> |   in
> | /Library/Frameworks/R.framework/Resources/library/RProtoBuf/libs/x86_64/RProtoBuf.so
> | ERREUR : loading failed
> | * removing ‘/Library/Frameworks/R.framework/Resources/library/RProtoBuf’
> |
> | Using protobuf 2.3.0 freshly compiled and "make check" happy.
>
> Ack.
>
> On 7 April 2010 at 14:52, Romain Francois wrote:
> | Le 07/04/10 14:30, Romain Francois a écrit :
> [...]
> |
> | Right. Something to do with the file generated by protoc.
> |
> | If I remove the addressbook.cc, and all the files that use it
> | (clear_person, ...) it works fine.
>
> Can you explain that in a tad more detail? I haven't looked at Proto in a
> while. What happens now, what does it break, what do you suggest.

Right. Here we go. The linker seems to be unhappy about the classes that 
are generated by the protocol buffer compiler, and the code that uses 
these classes, generated from the addressbook proto file you played with 
in early days of RProtoBuf.
http://dirk.eddelbuettel.com/blog/2009/10/22/#ordsessions_to_r-forge

Symbol not found: __ZN8tutorial18Person_PhoneNumber16_default_number_E

Now, this usage of protobuf is somewhat orthogonal to how RProtoBuf has 
become. So I was suggesting to simply remove them. Since these are 
mostly your toys I was asking first.

> | Is there any point about keeping these around, thy are sort of an
> | outlier compared to the rest of the code. It would also simplify the
> | Makevars to these two lines:
> |
> | PKG_CPPFLAGS=		@PKG_CPPFLAGS@
> | PKG_LIBS=		@PKG_LIBS@
> |
> | which might facilitates porting the package to windows, etc ...
>
> Again, I am not yet on the same page but maybe this is not an urgent matter.
>
> Dirk

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/9aKDM9 : embed images in Rd documents
|- http://tr.im/OIXN : raster images and RImageJ
|- http://tr.im/OcQe : Rcpp 0.7.7




More information about the Rprotobuf-yada mailing list