Bugzilla – Bug 667
Link error for sudoers because of missing -lshadow
Last modified: 2014-10-08 02:33:36 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
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.
Thanks, the patch works for me.
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).
Fixed in sudo 1.8.11p1, available now.