link fails if xml-security-c library outside default link path

Description

The link step fails during compilation if the xml-security-c library was installed outside of ld's default search path, due to the ordering of link options on the libtool command line:

make output

Making all in xmltooling
make all-am
/bin/bash ../libtool --silent --tag=CXX --mode=link CC -mt -D_REENTRANT -g -Qoption ccfe -stabs=no%dfltlit+no%dflthlp -L/usr/local/lib -lcurl -L/opt/openssl/lib -R/opt/openssl/lib -L/opt/openssl/lib -lz -lssl -lcrypto -ldl -lsocket -lnsl -lz -L/opt/openssl/lib -lcrypto -lssl -lxml-security-c -version-info 5:2:0 -L/opt/shibboleth-sp/lib -L/opt/shibboleth-sp/lib -L/opt/shibboleth-sp/lib -L/usr/local/lib -R/usr/local/lib -R/opt/openssl/lib -o libxmltooling.la -rpath /opt/shibboleth-sp/lib AbstractAttributeExtensibleXMLObject.lo AbstractComplexElement.lo AbstractDOMCachingXMLObject.lo AbstractSimpleElement.lo AbstractXMLObject.lo exceptions.lo Lockable.lo Namespace.lo QName.lo unicode.lo XMLObjectBuilder.lo XMLToolingConfig.lo AnyElement.lo UnknownElement.lo AbstractXMLObjectMarshaller.lo AbstractXMLObjectUnmarshaller.lo HTTPRequest.lo HTTPResponse.lo SOAPClient.lo SOAPImpl.lo SOAPSchemaValidators.lo DateTime.lo NDC.lo ParserPool.lo PathResolver.lo ReloadableXMLFile.lo TemplateEngine.lo URLEncoder.lo XMLConstants.lo XMLHelper.lo ValidatorSuite.lo PThreads.lo Decrypter.lo EncryptedKeyResolver.lo Encrypter.lo EncryptionImpl.lo EncryptionSchemaValidators.lo MemoryStorageService.lo AbstractPKIXTrustEngine.lo BasicX509Credential.lo ChainingCredentialResolver.lo ChainingTrustEngine.lo CredentialCriteria.lo CredentialResolver.lo ExplicitKeyTrustEngine.lo FilesystemCredentialResolver.lo InlineKeyResolver.lo KeyInfoResolver.lo OpenSSLCryptoX509CRL.lo SecurityHelper.lo StaticPKIXTrustEngine.lo TrustEngine.lo XSECCryptoX509CRL.lo KeyInfoImpl.lo KeyInfoSchemaValidators.lo SignatureValidator.lo XMLSecSignatureImpl.lo CURLSOAPTransport.lo CurlURLInputStream.lo ReplayCache.lo StorageService.lo -lxerces-c -L/opt/shibboleth-sp/lib -llog4shib -lpthread -lnsl -lsocket -lpthread -ldl
ld: fatal: library -lxml-security-c: not found
ld: fatal: File processing errors. No output written to .libs/libxmltooling.so.5.0.2
*** Error code 1
make: Fatal error: Command failed for target `libxmltooling.la'
Current working directory /home/src/objss9/xmltooling-1.4.2/xmltooling

This occurs because XMLSEC_LIBS precedes LDFLAGS on the libtool link command line, and XMLSEC_LIBS includes -lxml-security-c but not the -L option needed to find the library.

Two possible solutions:

  • Move XMLSEC_LIBS after LDFLAGS on the libtool link command line in xmltooling/Makefile

  • Add the with_xmlsec -L option to XMLSEC_LIBS in configure

Environment

Solaris 9, Sun Forte 5.8

Activity

Scott Cantor 
November 15, 2011 at 4:22 AM

Scott Cantor 
November 15, 2011 at 4:02 AM

Scott Cantor 
August 8, 2011 at 2:40 PM

http://svn.shibboleth.net/view/cpp-xmltooling?view=revision&revision=892

XMLSEC_LIBS ends up in LDFLAGS by way of automake, so no need to set -L in both.

Christopher Bongaarts 
July 27, 2011 at 6:42 PM

This patch seems to work:

--- configure.orig Mon Jun 27 19:40:01 2011 +++ configure Wed Jul 27 12:28:36 2011 @@ -19143,6 +19143,7 @@ if test x_$with_xmlsec != x_/usr; then CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS" LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS" + XMLSEC_LIBS="$XMLSEC_LIBS -L${with_xmlsec}/lib" fi
Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Created July 27, 2011 at 5:19 PM
Updated August 7, 2012 at 1:11 AM
Resolved August 8, 2011 at 2:40 PM