Subject: Re: lib/3522: undefined symbols in libwrap
To: None <netbsd-bugs@NetBSD.ORG>
From: Jim Bernard <>
List: netbsd-bugs
Date: 04/22/1997 06:43:12
On 4 22, Jaromir Dolecek wrote:
> >Number:         3522
> >Category:       lib
> >Synopsis:       undefined symbols in libwrap
> 	My problem:
> 	When I compiled ssh to use libwrap, scp complains about missing
> 	"_deny_severity" in libwrap:
> 	/usr/libexec/ Undefined symbol "_deny_severity" in                        
> 	        scp:/usr/lib/

  The intention is that allow_severity and deny_severity are to be defined
by callers that use libwrap with host access control.  They should not be
defined in the library.  The problem arises because the ssh Makefile adds
-lwrap to the link lines for all programs it builds, assuming that the
library is static and will be included only if needed.  On NetBSD, there
is a shared version of the library, and the linker adds a shared-library
dependency to to the binaries, _including_ those that don't
use libwrap at all (these include ssh, ssh-add, ssh-agent, ssh-keygen, and
scp).  Since contains references to _allow_severity and
_deny_severity, programs that don't declare them (because they don't need
them) but have (unnecessary) dependencies on that library will fail to load.
Of the programs built by the ssh Makefile, only sshd itself actually needs
libwrap, so a fix is to remove -lwrap from the LIBS macro and define a
new macro, e.g., WRAPLIBS=-lwrap, which is then added to the link line
for sshd alone.

  One might argue that the NetBSD linker should not add dependencies to
any command-line-specified libraries that aren't actually needed, but libwrap
shouldn't have these declarations added.