Current-Users archive

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

Re: Problem cross building NetBSD under Mac OS X Snow Leopard



On Thu 12 Nov 2009 at 10:39:16 +0100, Rhialto wrote:
> Something like this seems to compile, but then I run into some other
> detail that I overlooked previously.

>        link  binstall/xinstall
> xinstall.lo(.text+0xde7): In function `do_symlink':
> : warning: warning: mktemp() possibly used unsafely; consider using mkstemp()
> /vol-fourquid-1/olafs/netbsd-git//work/obj.amd64/tools/compat/libnbcompat.a(sha2.lo)(.text+0xe8d):
>  In function `SHA512_Final':
> : undefined reference to `be64enc'
> --- xinstall ---
> *** [xinstall] Error code 1
> 1 error
> 
> nbmake: stopped in 
> /tank/vol-fourquid-1/olafs/netbsd-git/cvs/src/tools/binstall

This change introduced a call to be64enc in SHA512_Final:

http://cvsweb.netbsd.org/bsdweb.cgi/src/common/lib/libc/hash/sha2/sha2.c.diff?r1=1.19&r2=1.20&f=h

I don't know why the link fails to resolve, since FreeBSD claims to have
the be64enc, requiring #include <sys/endian.h>. They're not in libc,
according to nm.

sha2.c has

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

however <sys/endian.h> isn't being checked by configure
(<machine/endian.h> is). Correspondingly there is no mention of
HAVE_SYS_ENDIAN_H in obj.amd64/tools/compat/nbtool_config.h.

I got around this hurdle with

Index: ./common/lib/libc/hash/sha2/sha2.c
===================================================================
RCS file: /cvsroot/src/common/lib/libc/hash/sha2/sha2.c,v
retrieving revision 1.20
diff -u -r1.20 sha2.c
--- ./common/lib/libc/hash/sha2/sha2.c  6 Nov 2009 20:31:18 -0000       1.20
+++ ./common/lib/libc/hash/sha2/sha2.c  12 Nov 2009 17:00:01 -0000
@@ -63,7 +63,7 @@
 #include <sys/sha2.h>
 
 #if HAVE_NBTOOL_CONFIG_H
-#  if HAVE_SYS_ENDIAN_H
+#  if HAVE_SYS_ENDIAN_H || HAVE_MACHINE_ENDIAN_H
 #    include <sys/endian.h>
 #  else
 #   undef htobe32

but of course it should be solved properly in the configure script.
Something like this, which I haven't tried yet.

Index: configure.ac
===================================================================
RCS file: /cvsroot/src/tools/compat/configure.ac,v
retrieving revision 1.70
diff -u -r1.70 configure.ac
--- configure.ac        16 Jun 2009 22:35:34 -0000      1.70
+++ configure.ac        12 Nov 2009 17:02:27 -0000
@@ -82,7 +82,7 @@
        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 \
        sys/featuretest.h err.h inttypes.h libgen.h paths.h stdint.h util.h \
-       resolv.h arpa/nameser.h,,
+       resolv.h arpa/nameser.h sys/endian.h,,
        [test -f include/$ac_header || touch include/$ac_header])
 AC_CHECK_HEADERS(rpc/types.h netconfig.h,,
        [echo '#include "nbtool_config.h"' >include/$ac_header.new


-Olaf.
-- 
___ Olaf 'Rhialto' Seibert    -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl      -- Cetero censeo "authored" delendum esse.


Home | Main Index | Thread Index | Old Index