tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] Transitive LIBDPLIBS, PROGDPLIBS



At Wed, 15 Jan 2025 08:19:14 +0000, Taylor R Campbell <riastradh%NetBSD.org@localhost> wrote:
Subject: [PATCH] Transitive LIBDPLIBS, PROGDPLIBS
>
> ### USAGE
>
> Using the mechanism proposed in this patch (not yet applied to
> Makefiles throughout the tree -- to be done in separate changes),
> libsqlite3's Makefile (using bsd.lib.mk) will have:
>
> LIBDPLIBS+=	m	${NETBSDSRCDIR}/lib/libm
>
> And a program (using bsd.prog.mk) that needs to use libsqlite3 can
> just have:
>
> PROGDPLIBS+=	sqlite3 ${NETBSDSRCDIR}/external/public-domain/sqlite3/lib

So far this looks good, I think.  It might massively help clean up the
xsrc build too!  (I have a large number of fixes for static xsrc builds.)

> (b) the necessary -l arguments are passed through (just -lsqlite3 for
>     dynamic builds; -lsqlite3 -lm for static builds); and

This part I've never understood.  Why is there reluctance to require
'-lm' for dynamic builds?  These small efficiencies lead to confusion
and ignorance, as is evident in how much of a mess X11 linking is for
many third-party programs.

Sure, it's not strictly needed since the intermediate library also has
this information, but having it there would allow both the build time
and runtime linkers to do some extra checks to make sure that all the
dependencies are/were actually truly known to the build.

I've never ever been comfortable with not knowing all dependencies
explicitly, including the transitive dependencies of intermediate
libraries, at build time.  The main program's build really should know
all the dependencies its product(s) will have, not just the "front-line"
ones.

If a dependent library grows a new transitive dependency on another
library then I think this should always be treated as an ABI change and
require recompilation (or at least re-linking), i.e. a major-number
bump.  The runtime linker should never be allowed to pull in a new
library to satisfy an new transitive dependency, i.e. one that wasn't
known when the main program was first linked.  This is one way DLL hell
starts.

--
					Greg A. Woods <gwoods%acm.org@localhost>

Kelowna, BC     +1 250 762-7675           RoboHack <woods%robohack.ca@localhost>
Planix, Inc. <woods%planix.com@localhost>     Avoncote Farms <woods%avoncote.ca@localhost>

Attachment: pgpqdflJYGhEl.pgp
Description: OpenPGP Digital Signature



Home | Main Index | Thread Index | Old Index