Subject: Re: CVS commit: pkgsrc
To: Johnny C. Lam <>
From: Nick Hudson <>
List: pkgsrc-changes
Date: 03/12/2001 17:43:06
"Johnny C. Lam" wrote:
> Nick Hudson <> writes:
> >
> > "Johnny C. Lam" wrote:
> > >
> > > Create _pic.a libraries needed by forthcoming xerces-p package.
> > > XXX This uses libtool internals!
> > > Requested in private mail by Emmanuel Dreyfus <>.
> >
> > Which reminds me...
> >
> > Why do you need it to be called _pic.a? Can't you just use the normal .a
> > library created by libtool - all the objects are compiled with -fPIC
> > -DPIC which is what you are after, right?. Unless I don't understand
> > what you are trying to do - which is, of course, very likely.
> My understanding of how libtool currently works is as follows.  First,
> libtool generates a directory .libs.  Then during compilation, it
> generates an object file compiled with PIC flags in ./.libs/foo.o and
> an object file compiled without PIC flags in ./foo.o.  Then during
> linking, a shared library is created from ./.libs/*.o and a
> static library libfoo.a is created from ./*.o.  So libfoo.a is
> composed of objects compiled _without_ the PIC flags.

You're right if you specify the -rpath flag to libtool. If you don't get
a library of the -fPIC objects.

$ libtool --mode=compile cc -c foo.c
cc -c foo.c  -fPIC -DPIC -o .libs/foo.o
cc -c foo.c -o foo.o >/dev/null 2>&1
$ libtool --mode=link cc -o foo.lo
rm -fr  .libs/libl1_pic.a .libs/
ar cru .libs/libl1_pic.a .libs/foo.o
ranlib .libs/libl1_pic.a
(cd .libs && rm -f && ln -s ../

ps. Still don't understand why you can't use the shared library. I must
read your email again...