Building library that depends on another library.

Pawel Jakub Dawidek pjd at FreeBSD.org
Tue May 7 19:37:12 UTC 2013


On Tue, May 07, 2013 at 01:27:34PM -0600, Warner Losh wrote:
> 
> On May 7, 2013, at 12:50 PM, Pawel Jakub Dawidek wrote:
> 
> > On Mon, May 06, 2013 at 08:49:15PM +0200, Dag-Erling Smørgrav wrote:
> >> Pawel Jakub Dawidek <pjd at FreeBSD.org> writes:
> >>> It looks like to make such dependency work one HAS TO add libnv to
> >>> _prebuild_libs in src/Makefile.inc1, which seems wrong.
> >> 
> >> It may seem wrong, but it is correct, cf the following comment in
> >> Makefile.inc1:
> >> 
> >> # The list of libraries with dependents (${_prebuild_libs}) and their
> >> # interdependencies (__L) are built automatically by the
> >> # ${.CURDIR}/tools/make_libdeps.sh script.
> > 
> > Yes, this also means SUBDIR_ORDERED in lib/Makefile doesn't make sense.
> > 
> > All in all I really don't like to add libraries to Makefile.inc1, it
> > doesn't sound right. I'd like this to be self-contained. For bsd.prog.mk
> > it is enough to specify DPADD/LDADD in program's Makefile instead of
> > hacking some central Makefile.
> > 
> > I came up with something like the following. Instead of:
> > 
> > DPADD=	${LIBNV}
> > LDADD=	-lnv
> > (plus modifying src/Makefile.inc1)
> > 
> > I only add:
> > 
> > LDADD=	-L${.OBJDIR}/../libnv -lnv
> > 
> > What do people think?
> 
> Still won't work. It won't ensure that libnv is built, leading to cross-threading on upgrade issues.
> 
> Better would be a 'plus modifying src/Makefile.inc1' would instead be 'have Makefile.inc1 figure it out fast.' We have to get the order right, there's no way around that.

I forgot to mention. The way I'm proposing makes SUBDIR_ORDERED relevant
again. So we should either remove SUBDIR_ORDERED fro lib/Makefile and
keep adding to _prebuild_libs or adopt what I'm proposing.

One argument against my method was that my library without DPADD won't
be relinked after libnv change, which may affect symbol versioning.
My libraries don't use symbol versioning yet, but I'm after general
solution here.

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://mobter.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20130507/5613d6eb/attachment.sig>


More information about the freebsd-arch mailing list