Subject: toolchain/22827: src/bin/sh/mkinit.c doesn't compile on RedHat Linux
To: None <gnats-bugs@gnats.netbsd.org>
From: None <bsh@netbsd.org>
List: netbsd-bugs
Date: 09/17/2003 14:19:39
>Number:         22827
>Category:       toolchain
>Synopsis:       src/bin/sh/mkinit.c doesn't compile on RedHat Linux
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 17 05:20:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Hiroyuki Bessho
>Release:        NetBSD 1.6ZA as of 2003 Sep 16
>Organization:
	Genetec corporation.
>Environment:
	Linux localhost.localdomain 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux
	Red Hat Linux release 9 (Shrike)
>Description:
	cross build on RedHat Linux fails at src/bin/sh/mkinit.c as
follows.  Linux doesn't have strlcpy(3)?

CC=/home/bsh/xxx/src/../tools/bin/i386--netbsdelf-gcc /home/bsh/xxx/src/../tools/bin/nbmkdep -f histedit.d    -DSHELL -I. -I/home/bsh/xxx/src/bin/sh  -nostdinc -isystem /home/bsh/xxx/src/../i386/usr/include    /home/bsh/xxx/src/bin/sh/histedit.c
cc -O   -o mkinit /home/bsh/xxx/src/bin/sh/mkinit.c
/tmp/ccQa0J98.o(.text+0x192): In function `readfile':
: undefined reference to `strlcpy'
collect2: ld returned 1 exit status

*** Failed target:  mkinit
*** Failed command: cc -O -o mkinit /home/bsh/xxx/src/bin/sh/mkinit.c
*** Error code 1

Stop.
nbmake: stopped in /home/bsh/xxx/src/bin/sh

*** Failed target:  dependall-sh
*** Failed command: targ=dependall;dir=sh; case "$dir" in /*) echo "$targ ===> $dir"; cd "$dir"; /home/bsh/xxx/src/../tools/bin/nbmake "_THISDIR_=$dir/" $targ; ;; *) echo "$targ ===> bin/$dir"; cd "/home/bsh/xxx/src/bin/$dir"; /home/bsh/xxx/src/../tools/bin/nbmake "_THISDIR_=bin/$dir/" $targ; ;; esac
*** Error code 1

Stop.
nbmake: stopped in /home/bsh/xxx/src/bin

*** Failed target:  dependall-bin
*** Failed command: targ=dependall;dir=bin; case "$dir" in /*) echo "$targ ===> $dir"; cd "$dir"; /home/bsh/xxx/src/../tools/bin/nbmake "_THISDIR_=$dir/" $targ; ;; *) echo "$targ ===> $dir"; cd "/home/bsh/xxx/src/$dir"; /home/bsh/xxx/src/../tools/bin/nbmake "_THISDIR_=$dir/" $targ; ;; esac
*** Error code 1

Stop.
nbmake: stopped in /home/bsh/xxx/src

*** Failed target:  do-build
*** Failed command: (cd /home/bsh/xxx/src && /home/bsh/xxx/src/../tools/bin/nbmake dependall BUILD_tools=no BUILD_lib=no)
*** Error code 1

Stop.
nbmake: stopped in /home/bsh/xxx/src

*** Failed target:  build
*** Failed command: (cd /home/bsh/xxx/src && /home/bsh/xxx/src/../tools/bin/nbmake do-build)
*** Error code 1

Stop.
nbmake: stopped in /home/bsh/xxx/src

ERROR: Failed to make build
*** BUILD ABORTED ***

>How-To-Repeat:
	do cross-build on Linux
>Fix:
	Link mkinit with -lnbcompat.  Here's a quick hack.

--- Makefile	11 Jun 2003 02:13:35 -0000
+++ Makefile	17 Sep 2003 04:52:07 -0000
@@ -71,8 +71,10 @@
 	[ -f syntax.h ]
 	touch syntax.h
 
+COMPATOBJ!=	cd ${.CURDIR}/../../tools/compat && ${PRINTOBJDIR}
+
 mkinit: mkinit.c
-	${HOST_LINK.c} -o mkinit ${.IMPSRC}
+	${HOST_LINK.c} -o mkinit ${.IMPSRC} -L${COMPATOBJ} -lnbcompat
 
 mknodes: mknodes.c
 	${HOST_LINK.c} -o mknodes ${.IMPSRC}
>Release-Note:
>Audit-Trail:
>Unformatted: