Static linking issue on Solaris sparc

961 views Asked by At

Undefined symbols Error while statically linking xerces with application only on solaris sparc, whereas static linking on other platforms(Linux, HP-UX,Solaris-x86) working.

Here are errors.

Undefined           first referenced
 symbol                 in file
void xercesc_2_8::JanitorMemFunCall<xercesc_2_8::XMLNotationDecl>::release() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(XMLNotationDecl.o)
const xercesc_2_8::XMLAttr*xercesc_2_8::BaseRefVectorOf<xercesc_2_8::XMLAttr>::elementAt(const unsigned)const /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(SAX2XMLReaderImpl.o)
void xercesc_2_8::RefHashTableOf<xercesc_2_8::KVStringPair>::put(void*,xercesc_2_8::KVStringPair*const) /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(DatatypeValidatorFactory.o)
socket                              /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(UnixHTTPURLInputStream.o)
xercesc_2_8::SchemaElementDecl*xercesc_2_8::Janitor<xercesc_2_8::SchemaElementDecl>::release() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(TraverseSchema.o)
void xercesc_2_8::ValueVectorOf<xercesc_2_8::DOMNode*>::addElement(xercesc_2_8::DOMNode*const&) /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(GeneralAttributeCheck.o)
unsigned xercesc_2_8::RefHashTableOf<xercesc_2_8::XercesAttGroupInfo>::getHashModulus()const /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(XTemplateSerializer.o)
bool xercesc_2_8::RefHashTableOf<xercesc_2_8::XMLAttDef>::containsKey(const void*const)const /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(TraverseSchema.o)
void xercesc_2_8::JanitorMemFunCall<xercesc_2_8::IdentityConstraintHandler>::release() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(IdentityConstraintHandler.o)
xercesc_2_8::XMLHolder<_pthread_mutex>::~XMLHolder() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(SolarisPlatformUtils.o)
void xercesc_2_8::ValueHashTableOf<unsigned short>::put(void*,const unsigned short&) /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(GeneralAttributeCheck.o)
void xercesc_2_8::ValueHashTableOf<unsigned>::put(void*,const unsigned&) /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(TraverseSchema.o)
xercesc_2_8::RefVectorOf<xercesc_2_8::DOMImplementationSource>::~RefVectorOf() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(DOMImplementationRegistry.o)
void xercesc_2_8::JanitorMemFunCall<xercesc_2_8::FieldValueMap>::release() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(FieldValueMap.o)
void xercesc_2_8::Janitor<xercesc_2_8::SchemaAttDef>::orphan() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(TraverseSchema.o)
xercesc_2_8::SchemaInfo&xercesc_2_8::BaseRefVectorEnumerator<xercesc_2_8::SchemaInfo>::nextElement() /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(TraverseSchema.o)
void xercesc_2_8::BaseRefVectorOf<xercesc_2_8::ENameMap>::addElement(xercesc_2_8::ENameMap*const) /src/xerces_stat_libs/Solaris28-sun4/libxerces-c.a(TransService.o)
3

There are 3 answers

1
tpgould On BEST ANSWER

Sachin,can you please provide your link line, as reported by your build system?

This will show what libraries are being used in what order and what flags are being invoked. (I expect this is a CC command, not ld.)

Also to respond to Erik, Solaris 10 does support static linking -- you can link a static library (.a file) with your binary -- what it doesn't support is linking the Solaris system libraries statically. Sachin, from the errors it look like you're linking your own static xerces library against your binary, which is fine in S10.

0
Erik On

What version of solaris are you using? If it's solaris 10 then you're out of luck, it no longer supports static linking. See here.

6
jlliagre On

As far as compiling and linking is concerned, there is no difference between Solaris running on x86 and SPARC. You certainly can build and link with static libraries on Solaris 10 (and 11). One notable exception would be the C library which is only provided as a dynamic library, but the error messages you show are unrelated to libc.