Subject: Re: and -Wl,-R stuff
To: Harlan Stenn <>
From: Todd Vierling <>
List: tech-pkg
Date: 07/29/2001 17:53:53
On Mon, 23 Jul 2001, Harlan Stenn wrote:

: Apparently, we're starting with netbsd versions of several of the .mk files.
: And I have a question.
: Why does have the -Wl,-R stuff in it at all?  While it provides
: the location for dynamic libraries, I don't see any corresponding logic to
: handle #include files.  Shouldn't the actual source packages handle this?

The -Wl,-R logic is to ensure that all packages get /usr/pkg/lib in their
*dynamic linker* library search path.  Without that (and don't say
"", because pkgsrc does not depend on that mechanism whatsoever),
you'll get runtime library-not-found errors.

: This has become an issue because in addressing portability issues I need to
: "rewrite" this logic.  The -R items are gnu-ld specific,

No, -R works on just about any linker that supports rpaths.  Only really old
linkers don't -- COFF and friends, platforms without shlibs, and probably
FreeBSD a.out unless they imported NetBSD's rpath additions later on.
(NetBSD's a.out has supported rpaths since NetBSD 1.3.)

: and the -Wl, items are gcc-specific.

Yes, these are, although many compilers will just accept -R and pass it on
appropriately.  We use -Wl,-R because it works with all NetBSD versions
(earlier bundled gcc versions didn't pass -R through to the linker on all

:  Yes, there may be other compilers/loaders that also accept these flags,
: but I need to implement a portable solution.

...make it an OS-dependent setting?  (duh?  LDFLAGS are naturally
OS-dependent anyway....)  For NetBSD specifically, it should use -Wl,-R.

-- Todd Vierling <>  *  Wasabi NetBSD:  Run with it.
-- NetBSD 1.5 now available on CD-ROM  --