Bug 667 - Link error for sudoers because of missing -lshadow
Link error for sudoers because of missing -lshadow
Status: RESOLVED FIXED
Product: Sudo
Classification: Unclassified
Component: Configure
1.8.11
PC Linux
: low normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-09-27 06:32 MDT by jue
Modified: 2014-10-08 02:33 MDT (History)
3 users (show)

See Also:


Attachments
Only check for getspnam() in -lshadow if not in libc (2.90 KB, patch)
2014-09-27 10:13 MDT, Todd C. Miller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jue 2014-09-27 06:32:04 MDT
As of 1.8.11 I'm no longer able to build sudo on my CRUX linux system because configure thinks we need to link sudoers.so against libshadow.
However libshadow is no longer installed with newer versions of shadow.
Works for me with all older versions of sudo.

Here's the error:

libtool: link: gcc -shared  -fPIC -DPIC  .libs/sudo_auth.o .libs/getspwuid.o .libs/passwd.o .libs/boottime.o .libs/check.o .libs/env.o .libs/find_path.o .libs/goodpath.o .libs/group_plugin.o .libs/interfaces.o .libs/iolog.o .libs/iolog_path.o .libs/locale.o .libs/logging.o .libs/logwrap.o .libs/parse.o .libs/policy.o .libs/prompt.o .libs/set_perms.o .libs/sudo_nss.o .libs/sudoers.o .libs/timestamp.o  -Wl,--whole-archive ./.libs/libparsesudoers.a -Wl,--no-whole-archive  -Wl,-rpath -Wl,/tmp/sudo/src/sudo-1.8.11/lib/util/.libs -Wl,-rpath -Wl,/usr/lib/sudo -lcrypt -lshadow ../../lib/util/.libs/libsudo_util.so -ldl -lz  -Wl,-z -Wl,relro   -Wl,-soname -Wl,sudoers.so -o .libs/sudoers.so
/usr/bin/ld: cannot find -lshadow
collect2: error: ld returned 1 exit status


Thanks
Comment 1 Todd C. Miller 2014-09-27 10:13:12 MDT
Created attachment 431 [details]
Only check for getspnam() in -lshadow if not in libc

The attached patch should fix things.  I don't know if there are still any Linux distros that use a separate shadow lib but I'm going to leave support for that just in case.
Comment 2 jue 2014-09-29 04:42:12 MDT
Thanks, the patch works for me.
Comment 3 Ulrich Müller 2014-10-05 09:46:08 MDT
This is also seen in Gentoo Linux bug http://bugs.gentoo.org/524074 by users who are building sudo with USE=-pam (which translates to the --without-pam configure option).
Comment 4 Todd C. Miller 2014-10-08 02:33:36 MDT
Fixed in sudo 1.8.11p1, available now.