NetBSD Problem Report #57131

From www@netbsd.org  Thu Dec 22 13:23:25 2022
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id B80901A921F
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 22 Dec 2022 13:23:25 +0000 (UTC)
Message-Id: <20221222132324.20BD51A9239@mollari.NetBSD.org>
Date: Thu, 22 Dec 2022 13:23:24 +0000 (UTC)
From: smurfd@gmail.com
Reply-To: smurfd@gmail.com
To: gnats-bugs@NetBSD.org
Subject: Cross compile from macos to aarch64
X-Send-Pr-Version: www-1.0

>Number:         57131
>Category:       toolchain
>Synopsis:       Cross compile from macos to aarch64
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 22 13:25:00 +0000 2022
>Closed-Date:    Fri Dec 23 08:15:09 +0000 2022
>Last-Modified:  Fri Dec 23 08:15:09 +0000 2022
>Originator:     nicklas boman
>Release:        current and 9
>Organization:
>Environment:
Darwin brr.local 22.2.0 Darwin Kernel Version 22.2.0: Fri Nov 11 02:03:51 PST 2022; root:xnu-8792.61.2~4/RELEASE_ARM64_T6000 arm64

gcc --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.2.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

(using Xcode 14.2, latest stable release as of 22nd dec 2022)

>Description:
I tried to cross compile netbsd tools and release from a linux vm, and that worked out without a problem using the commands :
$ ./build.sh -U -O ../netbsd-build -j12 -m evbarm -a aarch64 tools
$ ./build.sh -U -u -O ../netbsd-build -j12 -m evbarm -a aarch64 tools
$ ./build.sh -U -u -O ../netbsd-build -j12 -m evbarm -a aarch64 kernel=GENERIC64
$ ./build.sh -U -u -O ../netbsd-build -j12 -m evbarm -a aarch64 release

Wanted to use my mac m1 instead, so cloned current and ran the above commands again. first three went without a problem.
but when i was to compile the release it errors out like below

i have tried different -j values, no difference.

#   compile  libm/e_j1.po
/Users/hellbeard/code/_misc/netbsd/../netbsd-build/tooldir.Darwin-22.2.0-arm64/bin/aarch64--netbsd-gcc -O2   -std=gnu99    -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare  -Wsystem-headers   -Wno-traditional   -Wa,--fatal-warnings  -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter -Wno-sign-compare -Wold-style-definition -Wsign-compare -Wformat=2  -Wno-format-zero-length  -Werror   -fPIE  -frounding-math  -fno-strict-aliasing   --sysroot=/Users/hellbeard/code/_misc/netbsd/../netbsd-build/destdir.evbarm -D_MULTI_LIBM -D_POSIX_MODE -DLIBM_SCCS -I/Users/hellbeard/code/_misc/netbsd/lib/libm/src -I/Users/hellbeard/code/_misc/netbsd/lib/libm/gen  -c -DGPROF -DPROF    -pg -fPIC /Users/hellbeard/code/_misc/netbsd/lib/libm/src/e_j1.c -o e_j1.po.o
--- e_hypotf.po ---
/Users/hellbeard/code/_misc/netbsd/../netbsd-build/tooldir.Darwin-22.2.0-arm64/bin/nbctfconvert -g -L VERSION -o e_hypotf.po e_hypotf.po.o && rm -f e_hypotf.po.o
--- e_j0.po ---
aarch64--netbsd-gcc: internal compiler error: Segmentation fault: 11 signal terminated program cc1
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://www.NetBSD.org/support/send-pr.html> for instructions.
--- e_j1f.pico ---
#   compile  libm/e_j1f.pico
/Users/hellbeard/code/_misc/netbsd/../netbsd-build/tooldir.Darwin-22.2.0-arm64/bin/aarch64--netbsd-gcc -O2   -std=gnu99    -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare  -Wsystem-headers   -Wno-traditional   -Wa,--fatal-warnings  -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter -Wno-sign-compare -Wold-style-definition -Wsign-compare -Wformat=2  -Wno-format-zero-length  -Werror   -fPIE  -frounding-math  -fno-strict-aliasing   --sysroot=/Users/hellbeard/code/_misc/netbsd/../netbsd-build/destdir.evbarm -D_MULTI_LIBM -D_POSIX_MODE -DLIBM_SCCS -I/Users/hellbeard/code/_misc/netbsd/lib/libm/src -I/Users/hellbeard/code/_misc/netbsd/lib/libm/gen  -c    -fPIC   /Users/hellbeard/code/_misc/netbsd/lib/libm/src/e_j1f.c -o e_j1f.pico
--- e_j0.po ---

*** Failed target: e_j0.po
*** Failed commands:
	${_MKTARGET_COMPILE}
	=> @echo '#  ' "compile " libm/e_j0.po
	${COMPILE.c} ${PROFFLAGS} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${PGFLAGS} ${.IMPSRC} ${OBJECT_TARGET}
	=> /Users/hellbeard/code/_misc/netbsd/../netbsd-build/tooldir.Darwin-22.2.0-arm64/bin/aarch64--netbsd-gcc -O2   -std=gnu99    -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare  -Wsystem-headers   -Wno-traditional   -Wa,--fatal-warnings  -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings -Wextra -Wno-unused-parameter -Wno-sign-compare -Wold-style-definition -Wsign-compare -Wformat=2  -Wno-format-zero-length  -Werror   -fPIE  -frounding-math  -fno-strict-aliasing   --sysroot=/Users/hellbeard/code/_misc/netbsd/../netbsd-build/destdir.evbarm -D_MULTI_LIBM -D_POSIX_MODE -DLIBM_SCCS -I/Users/hellbeard/code/_misc/netbsd/lib/libm/src -I/Users/hellbeard/code/_misc/netbsd/lib/libm/gen  -c -DGPROF -DPROF    -pg -fPIC /Users/hellbeard/code/_misc/netbsd/lib/libm/src/e_j0.c -o e_j0.po.o
	${CTFCONVERT_RUN}
	=> /Users/hellbeard/code/_misc/netbsd/../netbsd-build/tooldir.Darwin-22.2.0-arm64/bin/nbctfconvert -g -L VERSION -o e_j0.po e_j0.po.o && rm -f e_j0.po.o
	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
	=> /Users/hellbeard/code/_misc/netbsd/../netbsd-build/tooldir.Darwin-22.2.0-arm64/bin/aarch64--netbsd-objcopy -X  e_j0.po
*** [e_j0.po] Error code 4

nbmake[7]: stopped in /Users/hellbeard/code/_misc/netbsd/lib/libm
--- e_hypotf.po ---

>How-To-Repeat:
$ git clone https://github.com/NetBSD/src netbsd
$ cd netbsd
and run the commands
$ ./build.sh -U -O ../netbsd-build -j12 -m evbarm -a aarch64 tools
$ ./build.sh -U -u -O ../netbsd-build -j12 -m evbarm -a aarch64 tools
$ ./build.sh -U -u -O ../netbsd-build -j12 -m evbarm -a aarch64 kernel=GENERIC64
$ ./build.sh -U -u -O ../netbsd-build -j12 -m evbarm -a aarch64 release

>Fix:

>Release-Note:

>Audit-Trail:
From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/57131: Cross compile from macos to aarch64
Date: Thu, 22 Dec 2022 17:16:35 +0100

 You are out of swap or the compiler ran into resource limits?

 Martin

From: smurfd <smurfd@gmail.com>
To: gnats-bugs@netbsd.org, toolchain-manager@netbsd.org,
 gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/57131: Cross compile from macos to aarch64
Date: Fri, 23 Dec 2022 00:03:00 +0100

 Hey, thanks for quick reply.
 It does not look like any limits is reached. disc is good, memory is 
 good and swap is no where near its limit.
 Im suspecting it has to do with the MacOS Clang toolchain.
 Tried to use HOST_CC=/opt/pkg/bin/clang & HOST_CXX=/opt/pkg/bin/clang++ 
 but then ran into other issues, failed basic c building program (after 
 installing it with pkgin on my mac)
 if i run ./build.sh -U -u -O ../netbsd-build -j12 -m evbarm -a aarch64 
 release
 several times, it fails on different spots, so it seems intermittent.
 think you can close the bug.

 if i find what caused it or if i get it to build ill reply here.

 br Nicklas
 On 2022-12-22 17:20, Martin Husemann wrote:
 > The following reply was made to PR toolchain/57131; it has been noted by GNATS.
 >
 > From: Martin Husemann <martin@duskware.de>
 > To: gnats-bugs@netbsd.org
 > Cc:
 > Subject: Re: toolchain/57131: Cross compile from macos to aarch64
 > Date: Thu, 22 Dec 2022 17:16:35 +0100
 >
 >   You are out of swap or the compiler ran into resource limits?
 >   
 >   Martin
 >   


State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Fri, 23 Dec 2022 08:15:09 +0000
State-Changed-Why:
Closing on submitters request, will reopen when we have something debuggable


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2022 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.