Status: New
Owner: liuj...@google.com
Labels: Type-Defect Priority-Medium

New issue 280 by dye.jona...@gmail.com: solaris compilation problems - quirks with friends and nested classes?
http://code.google.com/p/protobuf/issues/detail?id=280

What steps will reproduce the problem?
1. attempt to build 2.4.0a on solaris with ./configure && make

What is the expected output? What do you see instead?
make fails with the following compile error:
======== >8 =========
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -pthreads -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -O2 -g -DNDEBUG -m64 -MT structurally_valid.lo -MD -MP -MF .deps/structurally_valid.Tpo -c google/protobuf/stubs/structurally_valid.cc -o structurally_valid.o
/dev/null 2>&1
mv -f .deps/structurally_valid.Tpo .deps/structurally_valid.Plo
/bin/sh ../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -pthreads -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -O2 -g -DNDEBUG -m64 -MT descriptor.lo -MD -MP -MF .deps/descriptor.Tpo -c -o descriptor.lo `test -f 'google/protobuf/descriptor.cc' || echo './'`google/protobuf/descriptor.cc libtool: compile: g++ -DHAVE_CONFIG_H -I. -I.. -D_REENTRANT -pthreads -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -O2 -g -DNDEBUG -m64 -MT descriptor.lo -MD -MP -MF .deps/descriptor.Tpo -c google/protobuf/descriptor.cc -fPIC -DPIC -o .libs/descriptor.o google/protobuf/descriptor.cc: In member function `virtual const google::protobuf::FieldDescriptor* google::protobuf::DescriptorBuilder::OptionInterpreter::AggregateOptionFinder::FindExtension(google::protobuf::Message*, const std::string&) const': ./google/protobuf/descriptor.h:1152: error: `google::protobuf::internal::Mutex*google::protobuf::DescriptorPool::mutex_' is private
google/protobuf/descriptor.cc:4341: error: within this context
./google/protobuf/descriptor.h:1152: error: `google::protobuf::internal::Mutex*google::protobuf::DescriptorPool::mutex_' is private
google/protobuf/descriptor.cc:4342: error: within this context
*** Error code 1
make: Fatal error: Command failed for target `descriptor.lo'
Current working directory /root/projects/agent/proto2/protobuf-2.4.0a/src
*** Error code 1
The following command caused the error:
fail= failcom='exit 1'; \
for f in x $MAKEFLAGS; do \
  case $f in \
    *=* | --[!k]*);; \
    *k*) failcom='fail=yes';; \
  esac; \
done; \
dot_seen=no; \
target=`echo all-recursive | sed s/-recursive//`; \
list='. src'; for subdir in $list; do \
  echo "Making $target in $subdir"; \
  if test "$subdir" = "."; then \
    dot_seen=yes; \
    local_target="$target-am"; \
  else \
    local_target="$target"; \
  fi; \
  (CDPATH="${ZSH_VERSION+.}:" && cd $subdir && make  $local_target) \
  || eval $failcom; \
done; \
if test "$dot_seen" = "no"; then \
  make  "$target-am" || exit 1; \
fi; test -z "$fail"
make: Fatal error: Command failed for target `all-recursive'
Current working directory /root/projects/agent/proto2/protobuf-2.4.0a
*** Error code 1
make: Fatal error: Command failed for target `all'
======== 8< =========

What version of the product are you using? On what operating system?
2.4.0a, solaris 11 express

Please provide any additional information below.
[forgive my lack of c++ understanding]
it appears OptionInterpreter is a nested class within DescriptorBuilder. i guess in linux's g++ 'friend' applies to nested classes, but not so in solaris's g++. perhaps you could declare nested classes as friends explicitly, but OptionInterpreter is not known to the header where DescriptorPool is declared and the mutex is a private member, and apparently you can't forward declare nested classes in c++. so, is it okay if i move this class declaration to the header? i could use some guidance.

--
You received this message because you are subscribed to the Google Groups "Protocol 
Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.

Reply via email to