I'm trying to compile lib with static nss stuff, however, it does not work: mkdir /export/scratch/build/glibc-2.3.4-20050102/objdir-static/sunrpc/rpcsvc /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x64): undefined reference to `_nss_files_getaliasent_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x6c): undefined reference to `_nss_files_endaliasent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x74): undefined reference to `_nss_files_setaliasent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x7c): undefined reference to `_nss_files_getaliasbyname_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x84): undefined reference to `_nss_files_getetherent_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x8c): undefined reference to `_nss_files_endetherent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x94): undefined reference to `_nss_files_setetherent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x9c): undefined reference to `_nss_files_getgrent_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0xa4): undefined reference to `_nss_files_endgrent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0xac): undefined reference to `_nss_files_setgrent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0xb4): undefined reference to `_nss_files_getgrgid_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0xbc): undefined reference to `_nss_files_getgrnam_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0xc4): undefined reference to `_nss_files_gethostent_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0xcc): undefined reference to `_nss_files_endhostent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0xd4): undefined reference to `_nss_files_sethostent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0xdc): undefined reference to `_nss_files_gethostbyaddr_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0xe4): undefined reference to `_nss_files_gethostbyname_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0xec): undefined reference to `_nss_files_gethostton_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0xf4): undefined reference to `_nss_files_getntohost_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0xfc): undefined reference to `_nss_dns_gethostbyaddr_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x104): undefined reference to `_nss_dns_gethostbyname_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x10c): undefined reference to `_nss_dns_gethostbyname2_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x114): undefined reference to `_nss_files_getnetgrent_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x11c): undefined reference to `_nss_files_endnetgrent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x124): undefined reference to `_nss_files_setnetgrent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x12c): undefined reference to `_nss_files_getnetent_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x134): undefined reference to `_nss_files_endnetent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x13c): undefined reference to `_nss_files_setnetent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x144): undefined reference to `_nss_files_getnetbyname_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x14c): undefined reference to `_nss_files_getnetbyaddr_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x154): undefined reference to `_nss_dns_getnetbyname_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x15c): undefined reference to `_nss_dns_getnetbyaddr_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x164): undefined reference to `_nss_files_getprotoent_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x16c): undefined reference to `_nss_files_endprotoent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x174): undefined reference to `_nss_files_setprotoent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x17c): undefined reference to `_nss_files_getprotobyname_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x184): undefined reference to `_nss_files_getprotobynumber_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x18c): undefined reference to `_nss_files_getpwent_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x194): undefined reference to `_nss_files_endpwent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x19c): undefined reference to `_nss_files_setpwent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x1a4): undefined reference to `_nss_files_getpwnam_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x1ac): undefined reference to `_nss_files_getpwuid_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x1b4): undefined reference to `_nss_files_getrpcent_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x1bc): undefined reference to `_nss_files_endrpcent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x1c4): undefined reference to `_nss_files_setrpcent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x1cc): undefined reference to `_nss_files_getrpcbyname_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x1d4): undefined reference to `_nss_files_getrpcbynumber_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x1dc): undefined reference to `_nss_files_getservent_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x1e4): undefined reference to `_nss_files_endservent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x1ec): undefined reference to `_nss_files_setservent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x1f4): undefined reference to `_nss_files_getservbyname_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x1fc): undefined reference to `_nss_files_getservbyport_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x204): undefined reference to `_nss_files_getspent_r' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x20c): undefined reference to `_nss_files_endspent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x214): undefined reference to `_nss_files_setspent' /export/scratch/build/glibc-2.3.4-20050102/objdir-static/libc.a(nsswitch.o)(.data+0x21c): undefined reference to `_nss_files_getspnam_r' collect2: ld returned 1 exit status make[2]: *** [/export/scratch/build/glibc-2.3.4-20050102/objdir-static/elf/ldconfig] Error 1 make[1]: *** [elf/others] Error 2 make: *** [all] Error 2 Env: gcc-3.4.1; binutils 2.15.94.0.2; Linux 2.6.9 i686; glibc-2_3-branch 20050102 - vanilla (i.e. without any add. patches) Build: TARGET="i686-pc-linux-gnu" OPTIMIZ="-g -O3 -march=i686" KERNELVER=2.6.9 CFLAGS="$OPTIMIZ" \ ../configure \ --prefix=/usr \ --enable-add-ons=linuxthreads \ --disable-profile \ --enable-static-nss \ --without-cvs \ --enable-kernel=2.4.20 \ --sysconfdir=/etc \ --with-headers=${TMPBUILD}/../linux-${KERNELVER}/include \ --with-gd=${ROOT4BUILD}/usr \ --without-tls \ --build $TARGET --host $TARGET BTW: If I add the --disabled-shared flag to the config above, build breaks even earlier: mkdir /export/scratch/build/glibc-2.3.4-20050102/objdir-static/misc make[2]: *** No rule to make target `/export/scratch/build/glibc-2.3.4-20050102/objdir-static/misc/vm86.o', needed by `/export/scratch/build/glibc-2.3.4-20050102/objdir-static/misc/stamp.o'. Stop. make[1]: *** [misc/subdir_lib] Error 2 make: *** [all] Error 2 Other warnings, which might be interesting: ../locale/programs/charmap-dir.c: In function `charmap_aliases': ../locale/programs/charmap-dir.c:268: warning: float format, pointer arg (arg 3)../locale/programs/charmap-dir.c:269: warning: float format, pointer arg (arg 3)programs/ld-monetary.c: In function `monetary_finish': programs/ld-monetary.c:288: warning: comparison is always false due to limited range of data type programs/ld-monetary.c:288: warning: comparison is always false due to limited range of data type programs/ld-monetary.c:289: warning: comparison is always false due to limited range of data type programs/ld-monetary.c:289: warning: comparison is always false due to limited range of data type programs/charmap-dir.c: In function `charmap_aliases': programs/charmap-dir.c:268: warning: float format, pointer arg (arg 3) programs/charmap-dir.c:269: warning: float format, pointer arg (arg 3)
Same problem here. Just about everything I attempt to compile with static NSS glibc breaks during the build, with *exactly* the same error message described above. Glibc-2.3.3 compiles without errors, however. glibc version 2.3.3 (from ftp.gnu.org) gcc version 3.3.4 Slackware 10.1 Kernel 2.6.11.5 / 2.6.11.3 i686 architecture glibc-2.3.3 compiled with the following flags: ../glibc-2.3.3/configure --enable-add-ons=linuxthreads --prefix=/usr/local/glibc-static-2.3.3 --enable-static-nss Packages compiled with the above libraries use the following flags: ./configure --disable-nls (--disable-shared) and make LDFLAGS="(-static | -all-static) -L/usr/local/glibc-static-2.3.3/lib -Wl,--start-group -lc -lnss_files -lnss_dns -lresolv -Wl,--end-group" Have tried compiling with CFLAGS+="-static" and similar to no avail, as well with --disable-shared with individual packages, which also did not work. Of note is that shadow-4.06 successfully compiles with the library compiled as above. I believe this is not a Redhat bug, rather a bug in the C library which occurs when using static NSS routines. I have seen reports of it from debian, red hat, and slackware systems. I am compiling the de facto library from gnu.org.
Same problem with 2.3.4... again, *exactly* the same error messages. packages will compile when linked against libraries using static nss routines; however with 2.3.4, most packages fail when linked against those libraries. Shadow-4.06 still compiles successfully with static NSS support. Build system: glibc-2.3.4 gcc-3.4.4 binutils 2.15.92.0.2 Slackware 10.1 Kernel 2.6.11.5 / 2.6.11.3 i686 architecture
I saw this myself this morning building glibc-2.3.5. It seems to be a missing hunk in elf/Makefile. I have a patch that seems to solve it; I arrived at the patch by mimicing similar stanzas in other subdirectories' Makefiles, stealing an idea from Makeconfig, and tweaking Makeconfig slightly so $(otherlibs) is obeyed when linking static apps. I'll attach the patch.
Created attachment 517 [details] Proposed fix for link failure of ldconfig with --enable-static-nss
This bug report is a bit confusing because similar errors happen when building glibc-2.3.5, and when building user apps. The patch I posted fixes building glibc-2.3.5 itself. Compiling user apps with this option might require some more flags than the user is used to. I had to add -Wl,--start-group -lc -lnss_files -lnss_dns -lresolv -Wl,--end-group to the gcc commandline to get a small test program to link -static. I haven't figured out the options for g++ yet.
(In reply to comment #5) > I had to add > -Wl,--start-group -lc -lnss_files -lnss_dns -lresolv -Wl,--end-group > to the gcc commandline to get a small test program to link -static. I hope you are aware this is perfectly valid as .a do not contain interlibrary dependencies. Would glibc distribute yet-to-implement libtool's .la files for it?
--enable-static-nss is not a supported option. If it's broken, feel free to fix it, but don't file bugs about build issues. Use the mailing lists. *** This bug has been marked as a duplicate of 333 ***
*** Bug 260998 has been marked as a duplicate of this bug. *** Seen from the domain http://volichat.com Page where seen: http://volichat.com/adult-chat-rooms Marked for reference. Resolved as fixed @bugzilla.