On 2010-12-03 16:36:10 -0800, Russ Allbery wrote:
> Stefano Rivera <stef...@rivera.za.net> writes:
> > gcc argument order:
> > g++ -o conftest -pthread -g -O2 -Wall -O2 -DNDEBUG -pthread -g -O2 -g -Wall 
> > -O2 -O2 -DNDEBUG    -L/usr/lib -llog4cpp -lnsl -Wl,-Bsymbolic-functions 
> > conftest.cpp -lz   >&5
> 
> > This will work:
> > g++ -o conftest -pthread -g -O2 -Wall -O2 -DNDEBUG -pthread -g -O2 -g -Wall 
> > -O2 -O2 -DNDEBUG conftest.cpp   -L/usr/lib -llog4cpp -lnsl 
> > -Wl,-Bsymbolic-functions -lz
> 
> > Looks like autoconf's fault.
> 
> Hm, yeah, the code in the package is just:
> 
>     AC_TRY_LINK(
>             [#include <log4cpp/Category.hh>
> #include <log4cpp/CategoryStream.hh>],
>             [log4cpp::Category::getInstance("foo").errorStream() << 
> log4cpp::eol],
>             [AC_DEFINE(SHIBSP_LOG4CPP,1,[Define if log4cpp library is 
> used.])],
>             [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or 
> later])])
> 
> so I don't see anything obvious that I can do to fix this in the package.
> Autoconf doesn't seem to like the way that Ubuntu is adding the additional
> linker flag.

The problem lies 3 lines above that snippet:
    LDFLAGS="`${LOG4CPP_CONFIG} --libs` $LDFLAGS"

using LIBS instead of LDFLAGS fixes the order as configure uses LIBS
after the source file during linking.

When one looks at the remaining configure.ac it adds other libs (-l) to
LIBS and library directories (-L) to LDFLAGS.
But as "log4cpp-config --libs" outputs "-L/usr/lib -llog4cpp -lnsl" I'm
not sure if LDFLAGS or LIBS is the better place (but using LIBS makes
the package build again in Ubuntu).

Michael

Here is a patch for opensaml2 but a similar patch should also work for
shibboleth-sp2 and xmltooling:

--- opensaml2-2.3.orig/configure
+++ opensaml2-2.3/configure
@@ -22997,7 +22997,7 @@
 
 fi;
 if test -f "${LOG4SHIB_CONFIG}"; then
-    LDFLAGS="`${LOG4SHIB_CONFIG} --libs` $LDFLAGS"
+    LIBS="`${LOG4SHIB_CONFIG} --libs` $LIBS"
     CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
 
 if test "${ac_cv_header_log4shib_CategoryStream_hh+set}" = set; then
@@ -23259,7 +23259,7 @@
        if test -f "${LOG4CPP_CONFIG}"; then
                { echo "$as_me:$LINENO: WARNING: will try to use log4cpp, note 
that most non-Internet2 supplied versions are not thread-safe" >&5
 echo "$as_me: WARNING: will try to use log4cpp, note that most non-Internet2 
supplied versions are not thread-safe" >&2;}
-           LDFLAGS="`${LOG4CPP_CONFIG} --libs` $LDFLAGS"
+           LIBS="`${LOG4CPP_CONFIG} --libs` $LIBS"
            CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
                if test "${ac_cv_header_log4cpp_CategoryStream_hh+set}" = set; 
then
   echo "$as_me:$LINENO: checking for log4cpp/CategoryStream.hh" >&5
--- opensaml2-2.3.orig/configure.ac
+++ opensaml2-2.3/configure.ac
@@ -132,7 +132,7 @@
     fi
     ])
 if test -f "${LOG4SHIB_CONFIG}"; then
-    LDFLAGS="`${LOG4SHIB_CONFIG} --libs` $LDFLAGS"
+    LIBS="`${LOG4SHIB_CONFIG} --libs` $LIBS"
     CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
        AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to 
find log4shib header files]))
        AC_TRY_LINK(
@@ -157,7 +157,7 @@
            ])
        if test -f "${LOG4CPP_CONFIG}"; then
                AC_MSG_WARN([will try to use log4cpp, note that most 
non-Internet2 supplied versions are not thread-safe])
-           LDFLAGS="`${LOG4CPP_CONFIG} --libs` $LDFLAGS"
+           LIBS="`${LOG4CPP_CONFIG} --libs` $LIBS"
            CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
                
AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find 
log4cpp header files]))
                AC_TRY_LINK(


-- 
To UNSUBSCRIBE, email to debian-devel-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20101204111913.ga5...@vorlon.ping.de

Reply via email to