NetBSD Problem Report #50961

From www@NetBSD.org  Sun Mar 13 02:16:25 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 7B7717A214
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 13 Mar 2016 02:16:25 +0000 (UTC)
Message-Id: <20160313021621.676A27ABD8@mollari.NetBSD.org>
Date: Sun, 13 Mar 2016 02:16:21 +0000 (UTC)
From: venture37@geeklan.co.uk
Reply-To: venture37@geeklan.co.uk
To: gnats-bugs@NetBSD.org
Subject: cross compiling evbarm tools on Darwin 8 PowerPC fails
X-Send-Pr-Version: www-1.0

>Number:         50961
>Category:       toolchain
>Synopsis:       cross compiling evbarm tools on Darwin 8 PowerPC fails
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 13 02:20:00 +0000 2016
>Last-Modified:  Tue May 17 14:25:00 +0000 2016
>Originator:     Sevan Janiyan
>Release:        NetBSD-current
>Organization:
>Environment:
Darwin 8.11.0 Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007; root:xnu-792.24.17~1/RELEASE_PPC Power Macintosh powerpc
>Description:
Attempting to cross compile the evbarm tools on OS X Tiger 10.4.11 for PowerPC Macs fails with the following error:


cc -O  -I/Users/sme/Sandbox/src/tools/libelf/../compat -I/Users/sme/Sandbox/src/tools/libelf/../../external/bsd/elftoolchain/dist/libelf -I/Users/sme/Sandbox/src/tools/libelf/../../external/bsd/elftoolchain/dist/libelf/../common -I/Users/sme/Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh/include/nbinclude -DLIBELF_TEST_HOOKS -no-cpp-precomp -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64  -no-cpp-precomp -I/Users/sme/Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh/include/compat -I/Users/sme/Sandbox/src/tools/compat  -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -I/Users/sme/Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh/include -I/Users/sme/Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh/include/nbinclude -c -o elf_begin.lo.o    /Users/sme/Sandbox/src/tools/libelf/../../external/bsd/elftoolchain/dist/libelf/elf_begin.c
In file included from /Users/sme/Sandbox/src/tools/libelf/../../external/bsd/elftoolchain/dist/libelf/_libelf.h:38,
                 from /Users/sme/Sandbox/src/tools/libelf/../../external/bsd/elftoolchain/dist/libelf/elf_begin.c:31:
/Users/sme/Sandbox/src/tools/libelf/../../external/bsd/elftoolchain/dist/libelf/../common/_elftc.h:382:1: warning: "htobe32" redefined
In file included from /Users/sme/Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh/include/compat/nbtool_config.h:720,
                 from /Users/sme/Sandbox/src/tools/libelf/../../external/bsd/elftoolchain/dist/libelf/libelf.h:35,
                 from /Users/sme/Sandbox/src/tools/libelf/../../external/bsd/elftoolchain/dist/libelf/elf_begin.c:29:
/Users/sme/Sandbox/src/tools/libelf/../compat/compat_defs.h:1004:1: warning: this is the location of the previous definition
/var/tmp//ccj4K31V.s:184:Unknown pseudo-op: .ident
/var/tmp//ccj4K31V.s:184:Rest of line ignored. 1st junk character valued 34 (").

*** Failed target:  elf_begin.lo
*** Failed command: cc -O -I/Users/sme/Sandbox/src/tools/libelf/../compat -I/Users/sme/Sandbox/src/tools/libelf/../../external/bsd/elftoolchain/dist/libelf -I/Users/sme/Sandbox/src/tools/libelf/../../external/bsd/elftoolchain/dist/libelf/../common -I/Users/sme/Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh/include/nbinclude -DLIBELF_TEST_HOOKS -no-cpp-precomp -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -no-cpp-precomp -I/Users/sme/Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh/include/compat -I/Users/sme/Sandbox/src/tools/compat -DHAVE_NBTOOL_CONFIG_H=1 -D_FILE_OFFSET_BITS=64 -I/Users/sme/Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh/include -I/Users/sme/Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh/include/nbinclude -c -o elf_begin.lo.o /Users/sme/Sandbox/src/tools/libelf/../../external/bsd/elftoolchain/dist/libelf/elf_begin.c
*** Error code 1

Stop.
nbmake[3]: stopped in /Users/sme/Sandbox/src/tools/libelf

*** Failed target:  dependall
*** Failed command: cd "/Users/sme/Sandbox/src/tools/libelf"; /Users/sme/Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh/bin/nbmake realall
*** Error code 1

Stop.
nbmake[2]: stopped in /Users/sme/Sandbox/src/tools/libelf

*** Failed target:  dependall-libelf
*** Failed command: _makedirtarget() { dir="$1"; shift; target="$1"; shift; case "${dir}" in /*) this="${dir}/"; real="${dir}" ;; .) this=""; real="/Users/sme/Sandbox/src/tools" ;; *) this="${dir}/"; real="/Users/sme/Sandbox/src/tools/${dir}" ;; esac; show=${this:-.}; echo "${target} ===> ${show%/}${1:+ (with: $@)}"; cd "${real}" && /Users/sme/Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh/bin/nbmake _THISDIR_="${this}" "$@" ${target}; }; _makedirtarget libelf dependall
*** Error code 1

Stop.
nbmake[1]: stopped in /Users/sme/Sandbox/src/tools

*** Failed target:  build_install
*** Failed command: _makedirtarget() { dir="$1"; shift; target="$1"; shift; case "${dir}" in /*) this="${dir}/"; real="${dir}" ;; .) this=""; real="/Users/sme/Sandbox/src/tools" ;; *) this="${dir}/"; real="/Users/sme/Sandbox/src/tools/${dir}" ;; esac; show=${this:-.}; echo "${target} ===> ${show%/}${1:+ (with: $@)}"; cd "${real}" && /Users/sme/Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh/bin/nbmake _THISDIR_="${this}" "$@" ${target}; }; _makedirtarget . dependall-libelf
*** Error code 1

Stop.
nbmake: stopped in /Users/sme/Sandbox/src/tools

ERROR: Failed to make build_install in "tools"
*** BUILD ABORTED ***

I'm using the stock GCC shipped with XCode 2.5
% cc -v
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: /var/tmp/gcc/gcc-5370~2/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5370)
>How-To-Repeat:
Checkout NetBSD-current src on OS X Tiger
run ./build.sh -Um evbarm tools
>Fix:

>Audit-Trail:
From: Sevan Janiyan <venture37@geeklan.co.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/50961: cross compiling evbarm tools on Darwin 8 PowerPC
 fails
Date: Sun, 15 May 2016 17:09:53 +0100

 As a hack I excluded Apple from the if statement which defines 
 ELFTC_VCSID(ID) to __asm__(".ident\t\"" ID "\"") and I was able to build 
 the cross-compile toolchain on Darwin 8 PowerPC without issue, will see 
 if v9 has any issues before proposing an amendment to the if statement.

 Index: external/bsd/elftoolchain/dist/common/_elftc.h
 ===================================================================
 RCS file: /cvsroot/src/external/bsd/elftoolchain/dist/common/_elftc.h,v
 retrieving revision 1.5
 diff -u -r1.5 _elftc.h
 --- external/bsd/elftoolchain/dist/common/_elftc.h	13 Mar 2016 03:47:41 
 -0000	1.5
 +++ external/bsd/elftoolchain/dist/common/_elftc.h	15 May 2016 16:07:50 
 -0000
 @@ -296,7 +296,7 @@
   #define	ELFTC_VCSID(ID)		__FBSDID(ID)
   #endif

 -#if defined(__APPLE__) || defined(__GLIBC__) || defined(__GNU__) || \
 +#if !defined(__APPLE__) || defined(__GLIBC__) || defined(__GNU__) || \
       defined(__linux__)
   #if defined(__GNUC__)
   #define	ELFTC_VCSID(ID)		__asm__(".ident\t\"" ID "\"")


 ===> Tools built to /Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh
 ===> build.sh ended:      Sun May 15 16:54:51 BST 2016
 ===> Summary of results:
           build.sh command:    ./build.sh -U -m evbarm tools
           build.sh started:    Sun May 15 15:53:58 BST 2016
           NetBSD version:      7.99.29
           MACHINE:             evbarm
           MACHINE_ARCH:        earm
           Build platform:      Darwin 8.11.0 Power Macintosh
           HOST_SH:             /bin/sh
           No $TOOLDIR/bin/nbmake, needs building.
           Bootstrapping nbmake
           MAKECONF file:       /etc/mk.conf (File not found)
           TOOLDIR path: 
 /Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh
           DESTDIR path:        /Sandbox/src/obj/destdir.evbarm
           RELEASEDIR path:     /Sandbox/src/obj/releasedir
           Created 
 /Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh/bin/nbmake
           Updated makewrapper: 
 /Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh/bin/nbmake-evbarm
           Tools built to 
 /Sandbox/src/obj/tooldir.Darwin-8.11.0-Power_Macintosh
           build.sh ended:      Sun May 15 16:54:51 BST 2016
 ===> .

From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/50961: cross compiling evbarm tools on Darwin 8 PowerPC fails
Date: Tue, 17 May 2016 07:59:44 +0700

     Date:        Sun, 15 May 2016 16:10:01 +0000 (UTC)
     From:        Sevan Janiyan <venture37@geeklan.co.uk>
     Message-ID:  <20160515161001.3B45B7AAAF@mollari.NetBSD.org>

   |  As a hack I excluded Apple from the if statement which defines 
   |  ELFTC_VCSID(ID) to __asm__(".ident\t\"" ID "\"") and I was able to build 
   |  the cross-compile toolchain on Darwin 8 PowerPC without issue, will see 
   |  if v9 has any issues before proposing an amendment to the if statement.

 I am not sure what the underlying issue or problem is here, but this ...

   |  -#if defined(__APPLE__) || defined(__GLIBC__) || defined(__GNU__) || \
   |  +#if !defined(__APPLE__) || defined(__GLIBC__) || defined(__GNU__) || \
   |        defined(__linux__)

 is certainly not the correct fix.

 Before the change the #if block would be executed if any of APPLE GLIBC
 GNU or linux were defined (ignoring the __'s for simplicity here.)

 After the change, the #if block will be executed if any of GLIBC GNU or linux
 are defined, and also on all systems where APPLE is not defined.

 That's not going to be what you intended I expect.

 Delete the "defined(__APPLE__) ||" completely, if the objective is for the
 #if block to be excluded on all apple (Darwin I guess this means) systems,
 unless one of the other 3 symbols is defined (which I assume in environments
 where it matters they will not be, or your change would have changed nothing.)

 If you don't want the block on any APPLE systems regardless of GLIBC GNU or
 linux (which is unlikely, especially if it is linux, on a x86 Mac), then
 delete the defined(_APPLE__) and add a new #if !defined(__APPLE)/#endif
 block inside, or outside

 More likely though you want to just exclude powerpc Apple, in which case
 you might want something more like

 #if	( defined(__APPLE__) && ! however_one_tests_for_PowerPC ) || ...

 of if it is not to be used on any PowerPC regardless of manufacturer

 #if	! however_one_tests_for_PowerPC && ( defined(__APPLE__) || .... )

 But first you need to know exactly what the issue is, and the environment(s)
 in which you need to include or exclude that Makefile block.

 kre

From: Joerg Sonnenberger <joerg@bec.de>
To: gnats-bugs@NetBSD.org
Cc: toolchain-manager@netbsd.org, gnats-admin@netbsd.org,
	netbsd-bugs@netbsd.org, venture37@geeklan.co.uk
Subject: Re: toolchain/50961: cross compiling evbarm tools on Darwin 8
 PowerPC fails
Date: Tue, 17 May 2016 16:19:49 +0200

 On Sun, May 15, 2016 at 04:10:01PM +0000, Sevan Janiyan wrote:
 >  As a hack I excluded Apple from the if statement which defines 
 >  ELFTC_VCSID(ID) to __asm__(".ident\t\"" ID "\"") and I was able to build 
 >  the cross-compile toolchain on Darwin 8 PowerPC without issue, will see 
 >  if v9 has any issues before proposing an amendment to the if statement.

 I'd say the easiest approach for *our* tree is to make it aware of the
 cross-compiling defines and use the normal sys/cdefs.h logic here.

 Joerg

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-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.