NetBSD Problem Report #41503

From hf@spg.tu-darmstadt.de  Fri May 29 08:15:43 2009
Return-Path: <hf@spg.tu-darmstadt.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 26B2663BADB
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 29 May 2009 08:15:43 +0000 (UTC)
Message-Id: <200905290645.n4T6j4rp025066@Gstoder.nt.e-technik.tu-darmstadt.de>
Date: Fri, 29 May 2009 08:45:04 +0200 (CEST)
From: Hauke Fath <hf@spg.tu-darmstadt.de>
Reply-To: Hauke Fath <hf@spg.tu-darmstadt.de>
To: gnats-bugs@gnats.NetBSD.org
Cc: Hauke Fath <hf@spg.tu-darmstadt.de>
Subject: netbsd-5 LDSTATIC=-static amd build does not
X-Send-Pr-Version: 3.95

>Number:         41503
>Category:       bin
>Synopsis:       netbsd-5 LDSTATIC=-static amd build does not
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 29 08:20:00 +0000 2009
>Closed-Date:    Fri Feb 20 08:15:07 +0000 2026
>Last-Modified:  Fri Feb 20 08:15:07 +0000 2026
>Originator:     Hauke Fath
>Release:        NetBSD 5.0_STABLE
>Organization:
-- 
     The ASCII Ribbon Campaign                    Hauke Fath
()     No HTML/RTF in email	        Institut für Nachrichtentechnik
/\     No Word docs in email                     TU Darmstadt
     Respect for open standards              Ruf +49-6151-16-3281
>Environment:


System: NetBSD Gstoder 5.0_STABLE NetBSD 5.0_STABLE (P4W) #0: Wed May 13 20:40:29 CEST 2009 hf@Hochstuhl:/var/obj/netbsd-builds/5/i386/sys/arch/i386/compile/P4W i386
Architecture: i386
Machine: i386
>Description:

	A build.sh run with LDSTATIC=-static (mac68k cross-build here,
	but doesn't really make a difference) fails to build amd(8)
	with

[...]

#      link  amd/amd
/u/netbsd-builds/5/mac68k/tools/bin/m68k--netbsdelf-gcc  -B/u/netbsd-builds/5/mac68k/destdir/usr/lib/ -B/u/netbsd-builds/5/mac68k/destdir/usr/lib/  -Wl,-nostdlib    -Wl,--fatal-warnings   -static   -o amd  am_ops.o amd.o amfs_auto.o amfs_generic.o amfs_direct.o amfs_error.o amfs_host.o amfs_link.o amfs_linkx.o amfs_nfsl.o amfs_nfsx.o amfs_program.o amfs_root.o amfs_toplvl.o amfs_union.o amq_subr.o amq_svc.o autil.o clock.o conf.o get_args.o info_exec.o info_file.o info_ndbm.o info_passwd.o info_sun.o info_union.o map.o mapc.o mntfs.o nfs_prot_svc.o nfs_start.o nfs_subr.o ops_cdfs.o ops_efs.o ops_mfs.o ops_nfs.o ops_nfs3.o ops_nullfs.o ops_pcfs.o ops_tfs.o ops_tmpfs.o ops_ufs.o ops_umapfs.o ops_unionfs.o opts.o readdir.o restart.o rpc_fwd.o sched.o srvr_amfs_auto.o srvr_nfs.o sun_map.o sun_map_parse.o sun_map_tok.o conf_parse.o conf_tok.o info_hesiod.o info_ldap.o info_nis.o -L/var/obj/netbsd-builds/5/mac68k/external/bsd/am-utils/lib/libamu -lamu -lldap -llber -lssl -lcrypto !
  -lrpcsvc -L/var/obj/netbsd-builds/5/mac68k/external/bsd/am-utils/lib/libamu -lamu       -L/u/netbsd-builds/5/mac68k/destdir/usr/lib   -Wl,-rpath-link,/u/netbsd-builds/5/mac68k/destdir/lib  -L/u/netbsd-builds/5/mac68k/destdir/lib -Wl,-rpath-link,/u/netbsd-builds/5/mac68k/destdir/usr/lib  -L/u/netbsd-builds/5/mac68k/destdir/usr/lib
/u/netbsd-builds/5/mac68k/destdir/usr/lib/libcrypto.a(e_idea.o): In function `EVP_idea_ecb':
e_idea.c:(.text+0xe0): warning: IDEA is a patented algorithm; link against libcrypto_idea.a
e_idea.c:(.text+0xec): warning: IDEA is a patented algorithm; link against libcrypto_idea.a
e_idea.c:(.text+0x19a): warning: IDEA is a patented algorithm; link against libcrypto_idea.a
/u/netbsd-builds/5/mac68k/destdir/usr/lib/libcrypto.a(i_ecb.o): In function `idea_ecb_encrypt':
i_ecb.c:(.text+0x70): warning: IDEA is a patented algorithm; link against libcrypto_idea.a
collect2: ld returned 1 exit status

*** Failed target:  amd
*** Failed command: /u/netbsd-builds/5/mac68k/tools/bin/m68k--netbsdelf-gcc -B/u/netbsd-builds/5/mac68k/destdir/usr/lib/ -B/u/netbsd-builds/5/mac68k/destdir/usr/lib/ -Wl,-nostdlib -Wl,--fatal-warnings -static -o amd am_ops.o amd.o amfs_auto.o amfs_generic.o amfs_direct.o amfs_error.o amfs_host.o amfs_link.o amfs_linkx.o amfs_nfsl.o amfs_nfsx.o amfs_program.o amfs_root.o amfs_toplvl.o amfs_union.o amq_subr.o amq_svc.o autil.o clock.o conf.o get_args.o info_exec.o info_file.o info_ndbm.o info_passwd.o info_sun.o info_union.o map.o mapc.o mntfs.o nfs_prot_svc.o nfs_start.o nfs_subr.o ops_cdfs.o ops_efs.o ops_mfs.o ops_nfs.o ops_nfs3.o ops_nullfs.o ops_pcfs.o ops_tfs.o ops_tmpfs.o ops_ufs.o ops_umapfs.o ops_unionfs.o opts.o readdir.o restart.o rpc_fwd.o sched.o srvr_amfs_auto.o srvr_nfs.o sun_map.o sun_map_parse.o sun_map_tok.o conf_parse.o conf_tok.o info_hesiod.o info_ldap.o info_nis.o -L/var/obj/netbsd-builds/5/mac68k/external/bsd/am-utils/lib/libamu -lamu -lldap -llber -lssl!
  -lcrypto -lrpcsvc -L/var/obj/netbsd-builds/5/mac68k/external/bsd/am-utils/lib/libamu -lamu -L/u/netbsd-builds/5/mac68k/destdir/usr/lib -Wl,-rpath-link,/u/netbsd-builds/5/mac68k/destdir/lib -L/u/netbsd-builds/5/mac68k/destdir/lib -Wl,-rpath-link,/u/netbsd-builds/5/mac68k/destdir/usr/lib -L/u/netbsd-builds/5/mac68k/destdir/usr/lib
*** Error code 1

Stop.
nbmake: stopped in /public/netbsd-5/external/bsd/am-utils/bin/amd


>How-To-Repeat:

	Run the equivalent of 'env LDSTATIC=-static ./build.sh' on
	netbsd-5 sources.

>Fix:
	Wish I'd know.

>Release-Note:

>Audit-Trail:
From: "Greg A. Woods" <woods@planix.com>
To: NetBSD GNATS <gnats-bugs@NetBSD.org>
Cc: Hauke Fath <hf@spg.tu-darmstadt.de>
Subject: Re: bin/41503: netbsd-5 LDSTATIC=-static amd build does not
Date: Fri, 29 May 2009 18:42:48 -0400

 --pgp-sign-Multipart_Fri_May_29_18:42:48_2009-1
 Content-Type: text/plain; charset=US-ASCII
 Content-Transfer-Encoding: quoted-printable

 At Fri, 29 May 2009 08:20:01 +0000 (UTC), Hauke Fath <hf@spg.tu-darmstadt.d=
 e> wrote:
 Subject: bin/41503: netbsd-5 LDSTATIC=3D-static amd build does not
 >=20
 > 	A build.sh run with LDSTATIC=3D-static (mac68k cross-build here,
 > 	but doesn't really make a difference) fails to build amd(8)
 > 	with

 Somewhere along the line there's a linker flag being added telling it to
 die on the warnings:

 	-Wl,--fatal-warnings
 =20
 It shouldn't be coming from bsd.sys.mk though:

 	# Set linker warnings to be fatal
 	# XXX no proper way to avoid "FOO is a patented algorithm" warnings
 	# XXX on linking static libs
 	.if (!defined(MKPIC) || ${MKPIC} !=3D "no") && \
 	    (!defined(LDSTATIC) || ${LDSTATIC} !=3D "-static")
 	LDFLAGS+=3D       -Wl,--fatal-warnings
 	.endif
 	.endif

 unless somehow LDSTATIC isn't seen to be set as a make variable at the
 right place....

 Maybe if you move the LDSTATIC=3D-static setting into /etc/mk.conf instead
 of setting it in build.sh's environment?  LDSTATIC isn't directly
 supported by build.sh, for what it's worth.  Also, FYI, I use "env -i"
 in my wrapper to build.sh as otherwise reproducible builds can be much
 more difficult to achieve:

 	# make sure we start out with a very clean environment!
 	if [ x"$_MY_BUILD_CLEAN" !=3D x"true" ]; then
 		exec env -i USER=3D${USER} SHELL=3D/bin/ksh _MY_BUILD_CLEAN=3Dtrue "$0" $=
 {1+"$@"}
 	fi

 Try checking all the various relevant make variables after moving
 LDSTATIC=3D-static to /etc/mk.conf, like this

     18:36 [298] $ pwd
     /usr/src-current/external/bsd/am-utils/bin/amd
     18:37 [299] $ nbmake-i386 -V LDFLAGS    =20
     ${LDFLAGS.amd}
     18:37 [300] $ nbmake-i386 -V LDFLAGS.amd=20
    =20
     18:37 [301] $ nbmake-i386 -V LDSTATIC   =20
     -static
     18:38 [302] $=20

 I don't build amd myself (MKAMD=3Dno), but I'm sure other programs I do
 build would encounter the same problem, and as shown above for me
 LDSTATIC=3D-static somehow does prevent setting LDFLAGS with the fatal
 warning option.

 --=20
 						Greg A. Woods
 						Planix, Inc.

 <woods@planix.com>       +1 416 218-0099        http://www.planix.com/

 --pgp-sign-Multipart_Fri_May_29_18:42:48_2009-1
 Content-Type: application/pgp-signature
 Content-Transfer-Encoding: 7bit

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.9 (NetBSD)

 iD8DBQBKIGToZn1xt3i/9H8RAom3AKDn9+cUakGF/8V7Y+NEJqur5CHdAQCgjrZ2
 +nbZ1Fr8/tdfL9svvNEcqcE=
 =ydGt
 -----END PGP SIGNATURE-----

 --pgp-sign-Multipart_Fri_May_29_18:42:48_2009-1--

State-Changed-From-To: open->feedback
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Mon, 20 Oct 2025 03:26:18 +0000
State-Changed-Why:
Is this still reproducible?  I can't reproduce it in an isolated
makewrapper invocation.  Tried, in a clang build (so HAVE_LLVM is
defined and HAVE_GCC is not -- these cover the -Wl,--fatal-warnings
addition now):

$ cd external/bsd/am-utils/bin/amd
$ $TOOLDIR/bin/nbmake-evbarm64 -v _LDFLAGS.amd
 --sysroot=/home/riastradh/netbsd/current/src/../obj.arm64-clang/destdir.evbarm   -pie  -Wl,--fatal-warnings -Wl,--warn-shared-textrel -Wl,-z,relro
$ LDSTATIC=-static $TOOLDIR/bin/nbmake-evbarm64 -v _LDFLAGS.amd
 --sysroot=/home/riastradh/netbsd/current/src/../obj.arm64-clang/destdir.evbarm    -Wl,--warn-shared-textrel -Wl,-z,relro

Maybe build.sh is clobbering LDSTATIC in the environment somehow, but I
don't see a mechanism by which it could do that.

(Also, the patents expired long ago at this point and the separate
libcrypto_idea library is long since gone.)


From: Hauke Fath <hf@spg.tu-darmstadt.de>
To: gnats-bugs@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,
        riastradh@NetBSD.org
Cc: 
Subject: Re: bin/41503 (netbsd-5 LDSTATIC=-static amd build does not)
Date: Tue, 21 Oct 2025 14:58:05 +0200

 On 10/20/25 05:26, riastradh@NetBSD.org wrote:
 > Is this still reproducible?  I can't reproduce it in an isolated
 > makewrapper invocation.

 A static amd(8) build works for me on netbsd-10 (amd64).

 A complete static build fails linking cron(8) 
 <ftp://ftp.causeuse.org/pub/NetBSD/bin-41503/amd64-10-static.buildlog.zst>, 
 but that is a different kettle of fish.

 And, as you say, the original link error is moot.

 Cheerio,
 Hauke

 -- 
       The ASCII Ribbon Campaign                    Hauke Fath
 ()     No HTML/RTF in email	        Institut für Nachrichtentechnik
 /\     No Word docs in email                     TU Darmstadt
       Respect for open standards              Ruf +49-6151-16-21344

State-Changed-From-To: feedback->closed
State-Changed-By: hauke@NetBSD.org
State-Changed-When: Fri, 20 Feb 2026 08:15:07 +0000
State-Changed-Why:
The issue is fixed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.