[Rprotobuf-yada] alternative to pkg-config

Dirk Eddelbuettel edd at debian.org
Wed Apr 7 15:54:09 CEST 2010


On 7 April 2010 at 15:44, Romain Francois wrote:
| 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.

Maybe not. I only gave half the story as this was on Linux: cran2deb had
autobuilt fftw fine, and now failed. Turns out that pkg-config is now pulled
in via autoconf et al, but was not part of minimal build environment. Adding
pkg-config to the latter solved the issue.  So maybe pkg-config is becoming
yet more standard on Linux.

Which doesn't buy us lunch on non-standard OSs.  I can always if/else branch
in configure if pkg-config is not found. We do that for RPostgreSQL basically
just looping over 'possible' locations for the header file identifying the
library.  So that is an easy change.
 
| > 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/

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

I'd be curious what they say. Maybe they just don't care -- there is
essentially no Windows support for ProtoBuf either.
 
| > | 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.

Right. If it breaks things we can of course remove it, or make it just an
example/ directory.

But did this ever work?  Had you built RProtoBuf on OS X before or is this a
first? 

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

-- 
  Registration is open for the 2nd International conference R / Finance 2010
  See http://www.RinFinance.com for details, and see you in Chicago in April!


More information about the Rprotobuf-yada mailing list