I should add - also removing -zdefs works, as -zdefs causes the Sun Studio compiler to throw the undefined symbols warnings.
Monty Taylor wrote: > Hi! > > I'm working on a build issue on Solaris with Sun Studio. In short, I've > baked it down to this: > > lib_LTLIBRARIES = libprotobuf.la libprotoc.la > > libprotobuf_la_LIBADD = $(PTHREAD_LIBS) > libprotobuf_la_LDFLAGS = -version-info 6:0:0 -export-dynamic -no-undefined > > libprotoc_la_LIBADD = $(PTHREAD_LIBS) libprotobuf.la > libprotoc_la_LDFLAGS = -version-info 6:0:0 -export-dynamic -no-undefined > > make works correctly. > > make install produces this during the relink: > > CC -G -zdefs -hlibprotoc.so.6 -o .libs/libprotoc.so.6.0.0 <various .o > files snipped> -R/usr/local/lib/amd64 -L/usr/local/lib/amd64 -lprotobuf > -library=stlport4 -library=Crun -lpthread -lz -lc -template=no%extdef > -mt -m64 -mt > Undefined first referenced > symbol in file > void google::protobuf::internal::RepeatedPtrFieldBase::Reserve(int) > .libs/command_line_interface.o > void > google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(int,const > google::protobuf::MessageLite&,google::protobuf::io::CodedOutputStream*) > .libs/plugin.pb.o > void google::protobuf::UnknownFieldSet::ClearFallback() .libs/plugin.pb.o > unsigned google::protobuf::io::CodedInputStream::ReadTagFallback() > .libs/plugin.pb.o > void google::protobuf::internal::WireFormatLite::WriteString(int,const > std::string &,google::protobuf::io::CodedOutputStream*) .libs/plugin.pb.o > std::string google::protobuf::strings::CHexEscape(const std::string &) > .libs/python_generator.o > bool > google::protobuf::internal::WireFormatLite::ReadString(google::protobuf::io::CodedInputStream*,std::string > *) .libs/plugin.pb.o > ld: fatal: symbol referencing errors. No output written to > .libs/libprotoc.so.6.0.0 > > Thing is - libprotobuf.so hasn't been installed in /usr/local/lib/amd64 > yet, so the -lprotobuf seems to trigger the unknown symbols above. > > If I remove -no-undefined from the LDFLAGS or I manually edit the above > line to do: > > CC -G -zdefs -hlibprotoc.so.6 -o .libs/libprotoc.so.6.0.0 <various .o > files snipped> -R/usr/local/lib/amd64 -L/usr/local/lib/amd64 > .libs/libprotobuf.so -library=stlport4 -library=Crun -lpthread -lz -lc > -template=no%extdef -mt -m64 -mt > > It works. Of course, I know the above editing is wrong, because it > really wants to be linked with -lprotobuf. Am I just SOL in terms of > being able to use -no-undefined in this case? It would be nice to get > that error on the compile-for-tree stage but not have it apply to the > relink for install phase. > > Thanks! > Monty > > > _______________________________________________ > http://lists.gnu.org/mailman/listinfo/libtool > _______________________________________________ http://lists.gnu.org/mailman/listinfo/libtool