apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Orton <jor...@redhat.com>
Subject Re: Looking for HOWTO: Linking to APR
Date Mon, 17 Jan 2005 09:45:07 GMT
On Fri, Jan 14, 2005 at 04:33:02PM +0200, Graham Leggett wrote:
> Hi all,
> One piece of the docs that seems to be missing is a howto describing the
> "right" way to link to APR. apr-config offers me an array of options, but
> only indicates help if you're using libtool (I am not, my app is an
> application) or want to compile statically (I would like to compile
> dynamically). It does not tell you how to link to a dynamic library on the
> system in a portable way.
> What flags (in other words apr-config --<something>) must be used at the
> compile stage? What flags must be used at the link stage?

I'd say: --cppflags, --includes and --cflags at compile stage,
--ldflags, --cflags, --libs and --link-ld at link stage, and best using
CC as `apr --cc` throughout.

> I have code that links to APR fine on MacOSX, but build the same code on
> Solaris v2.8 and it bombs out with the error below. I am pretty sure I am
> using the wrong apr-config flags, but without knowing what the right flags
> are supposed to be I am pretty stuck:
> cc -DHAVE_CONFIG_H -I. -I. -I../../src/include   
> -I/udd001/app/spread/usr/include/apr-0 -g -c -o diablo-diablo.o `test -f
> 'diablo.c' || echo './'`diablo.c
> cc  -g   -o diablo -L/udd001/app/spread/usr/lib -lapr-0 -lsendfile -lrt
> -lm -lsocket -lnsl -lresolv  -lpthread -ldl diablo-diablo.o
> ild: (bad file) archive subfile #1 in
> /udd001/app/spread/usr/lib/libapr-0.a is a file of unknown type

That's pretty weird.  You weren't mixing 64-bit and 32-bit objects or 
anything?  "ar -tv" output on libapr-0.a show anything other than .o 
files in the archive?


View raw message