NetBSD Problem Report #42470

From www@NetBSD.org  Fri Dec 18 13:19:50 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 434E063C37E
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 18 Dec 2009 13:19:50 +0000 (UTC)
Message-Id: <20091218131950.0C33B63B844@www.NetBSD.org>
Date: Fri, 18 Dec 2009 13:19:50 +0000 (UTC)
From: asau@inbox.ru
Reply-To: asau@inbox.ru
To: gnats-bugs@NetBSD.org
Subject: tools doesn't build on FreeBSD 7.2
X-Send-Pr-Version: www-1.0

>Number:         42470
>Category:       toolchain
>Synopsis:       tools doesn't build on FreeBSD 7.2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    asau
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 18 13:20:00 +0000 2009
>Closed-Date:    Fri Jan 15 13:04:13 +0000 2010
>Last-Modified:  Wed Nov 02 19:45:05 +0000 2011
>Originator:     Aleksej Saushev
>Release:        
>Organization:
>Environment:
FreeBSD 7.2-RELEASE-p4 i386
>Description:
"build.sh tools" breaks at:

#      link  binstall/xinstall
cc -O -I/var/home/asau/wrk/netbsd/src/../obj/tools/compat -I/var/home/asau/wrk/netbsd/src/../obj/tools/compat/include  -I/var/home/asau/wrk/netbsd/src/tools/binstall/../compat -DHAVE_NBTOOL_CONFIG_H=1  -D_FILE_OFFSET_BITS=64  -I/var/home/asau/wrk/netbsd/src/tools/binstall/../compat/sys -DTARGET_STRIP=\"/var/home/asau/wrk/netbsd/src/../obj/tooldir.FreeBSD-7.2-RELEASE-p4-i386/bin/i486--netbsdelf-strip\" -I/var/home/asau/wrk/netbsd/src/usr.sbin/mtree   -o xinstall xinstall.lo getid.lo -L/var/home/asau/wrk/netbsd/src/../obj/tools/compat -lnbcompat -lz
xinstall.lo(.text+0xf3b): In function `do_symlink':
: warning: warning: mktemp() possibly used unsafely; consider using mkstemp()
/var/home/asau/wrk/netbsd/src/../obj/tools/compat/libnbcompat.a(sha2.lo)(.text+0x1533): In function `SHA512_Final':
: undefined reference to `be64enc'

The problem is that be64enc is defined in sys/endian.h, but it is:
"static __inline void be64enc(void *pp, uint64_t u)"

common/lib/libc/hash/sha2/sha2.c contains following:

#if HAVE_NBTOOL_CONFIG_H
#  if HAVE_SYS_ENDIAN_H
#    include <sys/endian.h>
#  else

but nbtool_config.h doesn't define HAVE_SYS_ENDIAN_H,
it defines HAVE_MACHINE_ENDIAN_H instead.
In fact, tools/compat/nbtool_config.h.in doesn't have HAVE_SYS_ENDIAN_H,
hence no traces of it in the output.

tools/compat/configure.ac contains test:

AC_CHECK_DECLS([be16enc, le16enc, be16dec, le16dec, be32enc, le32enc, be32dec, le32dec, be64enc, le64enc, be64dec, le64dec],,, [#include <sys/endian.h>])

but it doesn't check sys/endian.h presense.

>How-To-Repeat:
./build.sh -m i386 tools
>Fix:
sha2.c references be64enc still, I don't know how this is to be handled.
For me this change suffices (after running autoconf in tools/compat):

Index: tools/compat/configure.ac
===================================================================
RCS file: /home/asau/ext/wrk/netbsd/../../netbsd/src/tools/compat/configure.ac,v
retrieving revision 1.70
diff -u -r1.70 configure.ac
--- tools/compat/configure.ac   16 Jun 2009 22:35:34 -0000      1.70
+++ tools/compat/configure.ac   18 Dec 2009 13:09:21 -0000
@@ -80,7 +80,7 @@
 AC_HEADER_DIRENT
 AC_CHECK_HEADERS(sys/mtio.h sys/sysmacros.h sys/syslimits.h \
        getopt.h features.h malloc.h sys/poll.h stddef.h)
-AC_CHECK_HEADERS(sys/bswap.h machine/bswap.h sys/cdefs.h machine/endian.h \
+AC_CHECK_HEADERS(sys/bswap.h machine/bswap.h sys/cdefs.h machine/endian.h sys/endian.h \
        sys/featuretest.h err.h inttypes.h libgen.h paths.h stdint.h util.h \
        resolv.h arpa/nameser.h,,
        [test -f include/$ac_header || touch include/$ac_header])
Index: tools/compat/nbtool_config.h.in
===================================================================
RCS file: /home/asau/ext/wrk/netbsd/../../netbsd/src/tools/compat/nbtool_config.h.in,v
retrieving revision 1.23
diff -u -r1.23 nbtool_config.h.in
--- tools/compat/nbtool_config.h.in     16 Jun 2009 22:35:34 -0000      1.23
+++ tools/compat/nbtool_config.h.in     18 Dec 2009 12:58:11 -0000
@@ -336,6 +336,9 @@
 /* Define if you have the <machine/endian.h> header file. */
 #undef HAVE_MACHINE_ENDIAN_H

+/* Define if you have the <sys/endian.h> header file. */
+#undef HAVE_SYS_ENDIAN_H
+
 /* Define if you have the <malloc.h> header file. */
 #undef HAVE_MALLOC_H


>Release-Note:

>Audit-Trail:
From: henning petersen <henning.petersen@t-online.de>
To: gnats-bugs@NetBSD.org
Cc: asau@inbox.ru, toolchain-manager@netbsd.org, gnats-admin@netbsd.org, 
 netbsd-bugs@netbsd.org
Subject: Re: toolchain/42470: tools doesn't build on FreeBSD 7.2
Date: Fri, 18 Dec 2009 15:04:46 +0100

 Am 18.12.2009 14:20, schrieb asau@inbox.ru:
 >> Number:         42470
 >> Category:       toolchain
 >> Synopsis:       tools doesn't build on FreeBSD 7.2
 >> Confidential:   no
 >> Severity:       serious
 >> Priority:       medium
 >> Responsible:    toolchain-manager
 >> State:          open
 >> Class:          sw-bug
 >> Submitter-Id:   net
 >> Arrival-Date:   Fri Dec 18 13:20:00 +0000 2009
 >> Originator:     Aleksej Saushev
 >> Release:
 >> Organization:
 >> Environment:
 >>      
 > FreeBSD 7.2-RELEASE-p4 i386
 >    
 >> Description:
 >>      
 > "build.sh tools" breaks at:
 >
 > #      link  binstall/xinstall
 > cc -O -I/var/home/asau/wrk/netbsd/src/../obj/tools/compat -I/var/home/asau/wrk/netbsd/src/../obj/tools/compat/include  -I/var/home/asau/wrk/netbsd/src/tools/binstall/../compat -DHAVE_NBTOOL_CONFIG_H=1  -D_FILE_OFFSET_BITS=64  -I/var/home/asau/wrk/netbsd/src/tools/binstall/../compat/sys -DTARGET_STRIP=\"/var/home/asau/wrk/netbsd/src/../obj/tooldir.FreeBSD-7.2-RELEASE-p4-i386/bin/i486--netbsdelf-strip\" -I/var/home/asau/wrk/netbsd/src/usr.sbin/mtree   -o xinstall xinstall.lo getid.lo -L/var/home/asau/wrk/netbsd/src/../obj/tools/compat -lnbcompat -lz
 > xinstall.lo(.text+0xf3b): In function `do_symlink':
 > : warning: warning: mktemp() possibly used unsafely; consider using mkstemp()
 > /var/home/asau/wrk/netbsd/src/../obj/tools/compat/libnbcompat.a(sha2.lo)(.text+0x1533): In function `SHA512_Final':
 > : undefined reference to `be64enc'
 >
 > The problem is that be64enc is defined in sys/endian.h, but it is:
 > "static __inline void be64enc(void *pp, uint64_t u)"
 >
 > common/lib/libc/hash/sha2/sha2.c contains following:
 >
 > #if HAVE_NBTOOL_CONFIG_H
 > #  if HAVE_SYS_ENDIAN_H
 > #    include<sys/endian.h>
 > #  else
 >
 > but nbtool_config.h doesn't define HAVE_SYS_ENDIAN_H,
 > it defines HAVE_MACHINE_ENDIAN_H instead.
 > In fact, tools/compat/nbtool_config.h.in doesn't have HAVE_SYS_ENDIAN_H,
 > hence no traces of it in the output.
 >
 > tools/compat/configure.ac contains test:
 >
 > AC_CHECK_DECLS([be16enc, le16enc, be16dec, le16dec, be32enc, le32enc, be32dec, le32dec, be64enc, le64enc, be64dec, le64dec],,, [#include<sys/endian.h>])
 >
 > but it doesn't check sys/endian.h presense.
 >
 >    
 >> How-To-Repeat:
 >>      
 > ./build.sh -m i386 tools
 >    
 >> Fix:
 >>      
 > sha2.c references be64enc still, I don't know how this is to be handled.
 > For me this change suffices (after running autoconf in tools/compat):
 >
 > Index: tools/compat/configure.ac
 > ===================================================================
 > RCS file: /home/asau/ext/wrk/netbsd/../../netbsd/src/tools/compat/configure.ac,v
 > retrieving revision 1.70
 > diff -u -r1.70 configure.ac
 > --- tools/compat/configure.ac   16 Jun 2009 22:35:34 -0000      1.70
 > +++ tools/compat/configure.ac   18 Dec 2009 13:09:21 -0000
 > @@ -80,7 +80,7 @@
 >   AC_HEADER_DIRENT
 >   AC_CHECK_HEADERS(sys/mtio.h sys/sysmacros.h sys/syslimits.h \
 >          getopt.h features.h malloc.h sys/poll.h stddef.h)
 > -AC_CHECK_HEADERS(sys/bswap.h machine/bswap.h sys/cdefs.h machine/endian.h \
 > +AC_CHECK_HEADERS(sys/bswap.h machine/bswap.h sys/cdefs.h machine/endian.h sys/endian.h \
 >          sys/featuretest.h err.h inttypes.h libgen.h paths.h stdint.h util.h \
 >          resolv.h arpa/nameser.h,,
 >          [test -f include/$ac_header || touch include/$ac_header])
 > Index: tools/compat/nbtool_config.h.in
 > ===================================================================
 > RCS file: /home/asau/ext/wrk/netbsd/../../netbsd/src/tools/compat/nbtool_config.h.in,v
 > retrieving revision 1.23
 > diff -u -r1.23 nbtool_config.h.in
 > --- tools/compat/nbtool_config.h.in     16 Jun 2009 22:35:34 -0000      1.23
 > +++ tools/compat/nbtool_config.h.in     18 Dec 2009 12:58:11 -0000
 > @@ -336,6 +336,9 @@
 >   /* Define if you have the<machine/endian.h>  header file. */
 >   #undef HAVE_MACHINE_ENDIAN_H
 >
 > +/* Define if you have the<sys/endian.h>  header file. */
 > +#undef HAVE_SYS_ENDIAN_H
 > +
 >   /* Define if you have the<malloc.h>  header file. */
 >   #undef HAVE_MALLOC_H
 >
 >
 >
 >
 >
 >    
     You have to regenerate "configure" and "nbtool_config.h.in" from 
 "configure.ac" with autoconfig.
           cd ${SRCDIR}/tools/compat && ${TOOLDIR}/bin/nbmake-${MACHINE} 
 regen.

      You can look at 42440 from 11.12.2009 .

 henning.petersen@t-online.de




From: Aleksej Saushev <asau@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/42470 CVS commit: src/tools/compat
Date: Fri, 15 Jan 2010 11:26:26 +0000

 Module Name:	src
 Committed By:	asau
 Date:		Fri Jan 15 11:26:25 UTC 2010

 Modified Files:
 	src/tools/compat: configure.ac nbtool_config.h.in

 Log Message:
 Test for <sys/endian.h> and provide HAVE_SYS_ENDIAN_H.
 Fixes FreeBSD hosted builds (PR 42440 and PR 42470).

 Approved by <dholland>.


 To generate a diff of this commit:
 cvs rdiff -u -r1.70 -r1.71 src/tools/compat/configure.ac
 cvs rdiff -u -r1.23 -r1.24 src/tools/compat/nbtool_config.h.in

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: toolchain-manager->asau
Responsible-Changed-By: asau@NetBSD.org
Responsible-Changed-When: Fri, 15 Jan 2010 13:04:13 +0000
Responsible-Changed-Why:


State-Changed-From-To: open->closed
State-Changed-By: asau@NetBSD.org
State-Changed-When: Fri, 15 Jan 2010 13:04:13 +0000
State-Changed-Why:
Fixed.


From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/42470 CVS commit: [netbsd-5] src/tools/compat
Date: Wed, 2 Nov 2011 19:43:03 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Wed Nov  2 19:43:03 UTC 2011

 Modified Files:
 	src/tools/compat [netbsd-5]: configure configure.ac nbtool_config.h.in

 Log Message:
 Pull up following revision(s) (requested by tsutsui in ticket #1676):
 	tools/compat/configure.ac: revision 1.71
 	tools/compat/configure: revision 1.71
 	tools/compat/nbtool_config.h.in: revision 1.24
 Test for <sys/endian.h> and provide HAVE_SYS_ENDIAN_H.
 Fixes FreeBSD hosted builds (PR 42440 and PR 42470).
 Approved by <dholland>.
 Regenerate.


 To generate a diff of this commit:
 cvs rdiff -u -r1.67.2.2 -r1.67.2.3 src/tools/compat/configure \
     src/tools/compat/configure.ac
 cvs rdiff -u -r1.21.2.1 -r1.21.2.2 src/tools/compat/nbtool_config.h.in

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.