On Fri, Apr 9, 2010 at 4:30 PM, Dan McGee <[email protected]> wrote: > On Fri, Apr 9, 2010 at 8:21 AM, Matthias Lanzinger <[email protected]> wrote: >> I noticed a serious mistake in my previous patch. >> -lssl and -lcrypto were beeing added to $LIBS and >> by that they were added as linker flags during compilation. >> This overruled the --as-needed flag and causes ssl to be directly >> linked to pacman. >> >> Signed-off-by: Matthias Lanzinger <[email protected]> > > I'm actually going to revert most of this link stuff as you are still > not doing it right, and I want to make our library linking process a > bit saner. > >> --- >> configure.ac | 4 ++-- >> 1 files changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/configure.ac b/configure.ac >> index d0fed48..9bb0cd1 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -142,8 +142,8 @@ if test "x$internaldownload" = "xyes" ; then >> AC_MSG_RESULT(yes) >> AC_DEFINE([INTERNAL_DOWNLOAD], , [Use internal download library]) >> # Check for a download library if it was actually requested >> - AC_CHECK_LIB([fetch], [fetchParseURL], [AC_SUBST([LIBS], ["-lfetch >> -lssl -lcrypto -ldl $LIBS"])], >> - AC_MSG_ERROR([libfetch is needed to compile with internal >> download support]), [-lssl -lcrypto -ldl] ) >> + AC_CHECK_LIB([fetch], [fetchParseURL], [AC_SUBST([LIBS], ["-lfetch >> -ldl $LIBS"])], >> + AC_MSG_ERROR([libfetch is needed to compile with internal >> download support]), [-lcrypto -ldl] ) > The [-lcrypto -ldl] in the second line here is completely wrong if I'm > reading autoconf docs correctly. This is meant to be fallback > libraries, not additional dependencies of the original library. >
http://www.gnu.org/software/hello/manual/autoconf/Libraries.html — Macro: AC_CHECK_LIB (library, function, [action-if-found], [action-if-not-found], [other-libraries]) If linking with library results in unresolved symbols that would be resolved by linking with additional libraries, give those libraries as the other-libraries argument, separated by spaces: e.g., -lXt -lX11. Otherwise, this macro may fail to detect that library is present, because linking the test program can fail with unresolved symbols. The other-libraries argument should be limited to cases where it is desirable to test for one library in the presence of another that is not already in LIBS. I don't know how to find how libfetch was built though. Why isn't the linker able to resolve this automatically ? Otherwise would that be pkg-config job ? I thought this whole mess was only needed for a static build, not dynamic one. That's why I bothered to add pkg-config support to libarchive : $ pkg-config --libs --static libarchive -larchive -lacl -lattr -lcrypto -lexpat -llzma -lbz2 -lz $ readelf -d /usr/lib/libarchive.so 0x0000000000000001 (NEEDED) Shared library: [libacl.so.1] 0x0000000000000001 (NEEDED) Shared library: [libattr.so.1] 0x0000000000000001 (NEEDED) Shared library: [libcrypto.so.1.0.0] 0x0000000000000001 (NEEDED) Shared library: [libexpat.so.1] 0x0000000000000001 (NEEDED) Shared library: [liblzma.so.0] 0x0000000000000001 (NEEDED) Shared library: [libbz2.so.1.0] 0x0000000000000001 (NEEDED) Shared library: [libz.so.1] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
