This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Gcc 5.4 Compilation failure with -fPIC: undefined reference to `getrpcbynumber'
- From: Matt <mattator at gmail dot com>
- To: libc-help at sourceware dot org
- Date: Thu, 21 Jul 2016 20:40:13 +0200
- Subject: Gcc 5.4 Compilation failure with -fPIC: undefined reference to `getrpcbynumber'
- Authentication-results: sourceware.org; auth=none
Hi,
I've been trying various branches (master branch, 2.23 tag) and
various configurations in order to compile libc on ubuntu 16.04 with
gcc-5.real (Ubuntu 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609 with -fPIC
(I want to create a shared library statically linking some glibc
functions.
I came up with this command:
$ CFLAGS=" -fPIC -O2 -fno-stack-protector -U_FORTIFY_SOURCE "
LD_LIBRARY_PATH="" ../configure --prefix=/home/teto/libcinstall
--disable-shared --enable-static-nss --enable-obsolete-rpc
--disable-werror
but I keep ending up with:
===
make[2]: Entering directory '/home/teto/glibc/nss'
gcc -nostdlib -nostartfiles -static -o /home/teto/glibc/d/nss/getent
/home/teto/glibc/d/csu/crt1.o /home/teto/glibc/d/csu/crti.o `gcc
--print-file-name=crtbeginT.o` /home/teto/glibc/d/nss/getent.o
-Wl,--start-group /home/teto/glibc/d/libc.a -lgcc -lgcc_eh
-Wl,--end-group `gcc --print-file-name=crtend.o`
/home/teto/glibc/d/csu/crtn.o
/home/teto/glibc/d/nss/getent.o: In function `rpc_keys':
getent.c:(.text+0xc37): undefined reference to `getrpcbynumber'
getent.c:(.text+0xc64): undefined reference to `getrpcbyname'
getent.c:(.text+0xc93): undefined reference to `setrpcent'
getent.c:(.text+0xca9): undefined reference to `getrpcent'
getent.c:(.text+0xcb3): undefined reference to `endrpcent'
collect2: error: ld returned 1 exit status
../Rules:147: recipe for target '/home/teto/glibc/d/nss/getent' failed
make[2]: *** [/home/teto/glibc/d/nss/getent] Error 1
====
is there anything I can do to fix this ?
also if I don't compile first with a simpler command, "libc-modules.h"
doesn't get created, thus stopping the compilation process :/
Best regards