LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   autotools/gcc linker issue (https://www.linuxquestions.org/questions/linux-software-2/autotools-gcc-linker-issue-442926/)

fibbi 05-08-2006 06:41 PM

autotools/gcc linker issue
 
hello,

I've just finished writing a decently-sized library in c++ to interface with amazon's s3 service. I'm trying to get it all packaged up now using autotools (automake, autoconf, and libtool).

I had to end up depending on a few libraries like libgcrypt. I've got everything working, except that, when I compile my tester program, I'm forced to link against all of the libraries used by my own libs3.

As an example:
libs3 depends on libgcrypt, and is thus compiled with -lgcrypt
To my knowledge, that _should_ be the end of it. However, when I try to compile s3Tester.cpp, the linker complains unless I pass a -lgcrypt there as well.

I'm assuming I've got some configuration problem in autotools, but I have no idea what. Any suggestions?

Thanks!

bosewicht 05-08-2006 07:10 PM

how are you compiling your code? post some more info

fibbi 05-08-2006 10:38 PM

My configure.ac is the following:

----
AC_INIT(libs3, 0.1, Bobby Holley <bobbyholley@stanford.edu>)
AM_INIT_AUTOMAKE
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
AC_CONFIG_FILES([Makefile
src/Makefile])
AC_OUTPUT
-----

The Makefile.am in the top directory is the following:

----
EXTRA_DIST = reconf Doxyfile
SUBDIRS = src
----

The Makefile.am in the src directory is the following:

----
INCLUDES = -I${QTDIR}/include -I/usr/kde/3.5/include
AM_LDFLAGS = -L$(QTDIR)/lib
LDADD = -lqt-mt -lgcrypt -lkdecore
lib_LTLIBRARIES = libs3.la
TESTS = $(check_PROGRAMS)
include_HEADERS = s3.h
libs3_la_SOURCES = s3Internals.h AWSAuthConnection.cpp AWSAuthConnection.h base64.cpp base64.h HttpHandler.cpp HttpHandler.h HttpReadHandler.cpp HttpReadHandler.h HttpWriteHandler.h ListAllMyBucketsResponse.cpp ListAllMyBucketsResponse.h ListBucketResponse.cpp ListBucketResponse.h moc_HttpHandler.cpp moc_HttpReadHandler.cpp moc_HttpWriteHandler.cpp Response.cpp Response.h Utils.cpp Utils.h
----

I build the program like this:
$autoreconf
$./configure
$make

I'm sure there's some autoconf macro or something to do what I want, but I can't figure it out. Isn't that how libraries normally work? It doesn't seem like you should have to link against every dependency of your library when linking against it.

Thanks,
//BHolley


All times are GMT -5. The time now is 10:16 PM.