Subject: toolchain/23226: file(1) fails to build on solaris
To: None <gnats-bugs@gnats.netbsd.org>
From: None <dmcmahill@netbsd.org>
List: netbsd-bugs
Date: 10/22/2003 07:47:18
>Number:         23226
>Category:       toolchain
>Synopsis:       file(1) fails to build on solaris
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 22 11:48:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Dan McMahill
>Release:        NetBSD 20031020
>Organization:
NetBSD
>Environment:
solaris-2.6/sparc, gcc-2.95.1
	
	
System: NetBSD bondage 1.6.1 NetBSD 1.6.1 (BONDAGE) #0: Mon Apr 21 18:28:45 EDT 2003 dan@bondage:/export/disk1/src/src-netbsd-1-6-1/sys/arch/alpha/compile/BONDAGE alpha
Architecture: alpha
Machine: alpha
>Description:
When trying to crossbuild netbsd from solaris-2.6 using build.sh, the 
cross toolchain build fails on file(1).

Making all in src
source='/export/home1/software/NetBSD/src-netbsd-current/tools/file/../../dist/file/src/magic.c' object='magic.lo' libtool=yes  depfile='.deps/magic.Plo' tmpdepfile='.deps/magic.TPlo'  depmode=gcc /bin/sh /export/home1/software/NetBSD/src-netbsd-current/tools/file/../../dist/file/depcomp  /bin/sh ../libtool --mode=compile gcc -DHAVE_CONFIG_H -I. -I/export/home1/software/NetBSD/src-netbsd-current/tools/file/../../dist/file/src -I..   -DMAGIC='"/export/home1/software/build/tools/share/file/magic"'   -O -c -o magic.lo `test -f '/export/home1/software/NetBSD/src-netbsd-current/tools/file/../../dist/file/src/magic.c' || echo '/export/home1/software/NetBSD/src-netbsd-current/tools/file/../../dist/file/src/'`/export/home1/software/NetBSD/src-netbsd-current/tools/file/../../dist/file/src/magic.c
gcc -DHAVE_CONFIG_H -I. -I/export/home1/software/NetBSD/src-netbsd-current/tools/file/../../dist/file/src -I.. -DMAGIC=\"/export/home1/software/build/tools/share/file/magic\" -O -c /export/home1/software/NetBSD/src-netbsd-current/tools/file/../../dist/file/src/magic.c -Wp,-MD,.deps/magic.TPlo -o magic.o
In file included from /export/home1/software/NetBSD/src-netbsd-current/tools/file/../../dist/file/src/file.h:48,
                 from /export/home1/software/NetBSD/src-netbsd-current/tools/file/../../dist/file/src/magic.c:33:
		 ../config.h:181: warning: `_FILE_OFFSET_BITS' redefined
		 /usr/include/sys/feature_tests.h:80: warning: this is the location of the previous definition
		 In file included from /export/home1/software/NetBSD/src-netbsd-current/tools/file/../../dist/file/src/magic.c:44:
		 /usr/include/sys/mman.h:160: conflicting types for `mmap64'
		 /usr/include/sys/mman.h:149: previous declaration of `mmap64'


In /usr/include/sys/mman.h around lines 149 and 160 I see:

/*
 * Except for old binaries mmap() will return the resultant
  * address of mapping on success and (caddr_t)-1 on error.
   */
   #ifdef  __STDC__
   #if     (_POSIX_C_SOURCE > 2) || defined(_XPG4_2)
   extern void *mmap(void *, size_t, int, int, int, off_t);
   extern int munmap(void *, size_t);
   extern int mprotect(void *, size_t, int);
   extern int msync(void *, size_t, int);
   #if     !defined(_XPG4_2) || defined(__EXTENSIONS__)
   extern int mlock(void *, size_t);
   extern int munlock(void *, size_t);
   extern int shm_open(const char *, int, mode_t);
   extern int shm_unlink(const char *);
   #endif  /* !defined(_XPG4_2) || defined(__EXTENSIONS__) */
   /* transitional large file interface version */
   #if     defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
	       !defined(__PRAGMA_REDEFINE_EXTNAME))
	       extern void *mmap64(void *, size_t, int, int, int, off64_t);
	       #endif  /* _LARGEFILE64_SOURCE... */
	       #else   /* (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) */
	       extern caddr_t mmap(caddr_t, size_t, int, int, int, off_t);
	       extern int munmap(caddr_t, size_t);
	       extern int mprotect(caddr_t, size_t, int);
	       extern int msync(caddr_t, size_t, int);
	       extern int mlock(caddr_t, size_t);
	       extern int munlock(caddr_t, size_t);
	       extern int mincore(caddr_t, size_t, char *);
	       extern int memcntl(caddr_t, size_t, int, caddr_t, int, int);
	       extern int madvise(caddr_t, size_t, int);
	       /* transitional large file interface version */
	       #ifdef  _LARGEFILE64_SOURCE
	       extern caddr_t mmap64(caddr_t, size_t, int, int, int, off64_t);
	       #endif
	       #endif  /* (_POSIX_C_SOURCE > 2)  || defined(_XPG4_2) */

	
>How-To-Repeat:

env HOST_CC=gcc ./build.sh -m sparc64 -T /export/home1/software/build/tools -D /export/home1/software/build/destdir.sparc64 -R /export/home1/software/build/release/sparc64 release

	
>Fix:
not sure. 
	
>Release-Note:
>Audit-Trail:
>Unformatted: