tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: PR#47922



Hello list,

On Mon, 17 Jun 2013 15:17:29 +0900
Masanobu SAITOH <msaitoh%execsw.org@localhost> wrote:

>  Hi.
> 
>  I got the same problem as PR#47922:
> 
>        http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=47922

me too.
I am trying to build NetBSD/amd64 6.1 on NetBSD/amd64 current(6.99.21).
and I see similar problem about "_ctype_tab" in
src/external/mit/xorg/bin/bdftopcf.

> 
> =================
> amd64(msaitoh)% ../../../obj/tooldir.NetBSD-6.99.21-amd64/bin/nbmake-amd64
> #      link  npfctl/npfctl
> /var/sources/netbsd-6/src/obj/tooldir.NetBSD-6.99.21-amd64/bin/x86_64--netbsd-gcc
>     --sysroot=/var/sources/netbsd-6/src/obj/destdir.amd64     -o npfctl  
> npfctl.o npf_var.o npf_data.o npf_ncgen.o npf_build.o npf_extmod.o 
> npf_disassemble.o npf_scan.o npf_parse.o -lnpf -lprop -lcrypto -lutil -ly     
>   -Wl,-dynamic-linker=/libexec/ld.elf_so -Wl,-rpath,/lib  -L=/lib
> /lib/libcrypt.so.1: undefined reference to `__explicit_bzero'
> collect2: ld returned 1 exit status
> 
> *** Failed target:  npfctl
> *** Failed command: 
> /var/sources/netbsd-6/src/obj/tooldir.NetBSD-6.99.21-amd64/bin/x86_64--netbsd-gcc
>  --sysroot=/var/sources/netbsd-6/src/obj/destdir.amd64 -o npfctl npfctl.o 
> npf_var.o npf_data.o npf_ncgen.o npf_build.o npf_extmod.o npf_disassemble.o 
> npf_scan.o npf_parse.o -lnpf -lprop -lcrypto -lutil -ly 
> -Wl,-dynamic-linker=/libexec/ld.elf_so -Wl,-rpath,/lib -L=/lib
> *** Error code 1
> 
> Stop.
> nbmake: stopped in /var/sources/netbsd-6/src/usr.sbin/npf/npfctl
> ===================

I think this is because the option "-rpath-link" lacks.
This npfctl will be installed in /sbin, in which case
_PROGLDOPTS in bsd.prog.mk does not have -rpath-link.

I don't know it's a bug that ld may search the implicitly
required libraries in the paths specified by -rpath or -L
at link time.

Following patch may fix problem but is not a cool idea
at the point of that two -rpath-link options appears
because x11 Makefile will .include bsd.x11.mk and bsd.prog.mk.

Index: src/share/mk/bsd.prog.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.prog.mk,v
retrieving revision 1.270.2.1
diff -u -r1.270.2.1 bsd.prog.mk
--- src/share/mk/bsd.prog.mk    2 Mar 2012 18:27:55 -0000       1.270.2.1
+++ src/share/mk/bsd.prog.mk    17 Jun 2013 08:35:09 -0000
@@ -270,6 +270,7 @@
 .endif
 .if ${SHLIBDIR} != "/usr/lib"
 _PROGLDOPTS+=  -Wl,-rpath,${SHLIBDIR} \
+               -Wl,-rpath-link,${DESTDIR}${SHLIBDIR} \
                -L=${SHLIBDIR}
 .elif ${SHLIBINSTALLDIR} != "/usr/lib"
 _PROGLDOPTS+=  -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
Index: src/share/mk/bsd.x11.mk
===================================================================
RCS file: /cvsroot/src/share/mk/bsd.x11.mk,v
retrieving revision 1.105
diff -u -r1.105 bsd.x11.mk
--- src/share/mk/bsd.x11.mk     17 Jan 2012 19:40:08 -0000      1.105
+++ src/share/mk/bsd.x11.mk     17 Jun 2013 08:35:09 -0000
@@ -173,6 +173,7 @@
 .endif
 
 LDFLAGS+=              -Wl,-rpath,${X11USRLIBDIR} -L=${X11USRLIBDIR}
+LDFLAGS+=              -Wl,-rpath-link,${DESTDIR}${X11USRLIBDIR}
 
 
 #

> 
> So, I checked the behavior using ktrace/kdump
> 
> ===================
> amd64(msaitoh)% ktrace -i 
> /var/sources/netbsd-6/src/obj/tooldir.NetBSD-6.99.21-amd64/bin/x86_64--netbsd-gcc
>  --sysroot=/var/sources/netbsd-6/src/obj/destdir.amd64 -o npfctl npfctl.o 
> npf_var.o npf_data.o npf_ncgen.o npf_build.o npf_extmod.o npf_disassemble.o 
> npf_scan.o npf_parse.o -lnpf -lprop -lcrypto -lutil -ly 
> -Wl,-dynamic-linker=/libexec/ld.elf_so -Wl,-rpath,/lib -L=/lib
> /lib/libcrypt.so.1: undefined reference to `__explicit_bzero'
> collect2: ld returned 1 exit status
> amd64(msaitoh)% kdump | grep 'NAMI  \"/lib'
>  28679      1 ld       NAMI  "/lib/libcrypt.so.1"
>  28679      1 ld       NAMI  "/lib/libcrypt.so.1"
>  23722      1 collect2 NAMI  "/lib.rpo"
> ====================
> 
> There is no -lcrypt in command line. And,
> 
> amd64(msaitoh)% ldd ../../../../obj/destdir.amd64/lib/libcrypto.so
> ../../../../obj/destdir.amd64/lib/libcrypto.so:
>         -lcrypt.1 => /lib/libcrypt.so.1
>         -lgcc_s.1 => /lib/libgcc_s.so.1
>         -lc.12 => /lib/libc.so.12
> 
> Is this the key of the bug? collect2 or ld?

Is it concern that libcrypto is build with -lcrypt ?

#     build  libcrypto/libcrypto.so.8.0
rm -f libcrypto.so.8.0
/usr/build/nb6/obj.amd64/tooldir.NetBSD-6.99.21-amd64/bin/x86_64--netbsd-gcc \
-Wl,-x -shared -Wl,-soname,libcrypto.so.8 -Wl,--warn-shared-textrel \
--sysroot=/usr/build/nb6/obj.amd64/destdir.amd64   -o libcrypto.so.8.0 \
-Wl,-rpath,/lib  -L=/lib  -Wl,--whole-archive libcrypto_pic.a \
-Wl,--no-whole-archive -L/usr/build/nb6/obj.amd64/lib/libcrypt -lcrypt

--
t-hash



Home | Main Index | Thread Index | Old Index