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