NetBSD Problem Report #57982

From www@netbsd.org  Sat Mar  2 11:33:28 2024
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 A62B91A923A
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  2 Mar 2024 11:33:28 +0000 (UTC)
Message-Id: <20240302113327.0B8331A923B@mollari.NetBSD.org>
Date: Sat,  2 Mar 2024 11:33:26 +0000 (UTC)
From: hubertf@gmx.de
Reply-To: hubertf@gmx.de
To: gnats-bugs@NetBSD.org
Subject: Build Error or netbsd-10 branch on Mac OS X
X-Send-Pr-Version: www-1.0

>Number:         57982
>Category:       port-amd64
>Synopsis:       Build Error or netbsd-10 branch on Mac OS X
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-amd64-maintainer
>State:          analyzed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 02 11:35:00 +0000 2024
>Closed-Date:    
>Last-Modified:  Sun Mar 03 13:40:02 +0000 2024
>Originator:     Hubert Feyrer
>Release:        netbsd-10 branch
>Organization:
private
>Environment:
the-future-is-now% uname -a
Darwin the-future-is-now.fritz.box 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:28:58 PST 2023; root:xnu-10002.81.5~7/RELEASE_X86_64 x86_64
the-future-is-now% gcc -v
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: x86_64-apple-darwin23.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
>Description:
===> build.sh command:    ./build.sh -U -j2 -r -X ../xsrc-current -x -m amd64 -T tooldir.Darwin -O /Volumes/netbsd-src-objdestdir/netbsd-10/obj.amd64-Darwin-XXX -D /Volumes/netbsd-src-objdestdir/netbsd-10/destdir.amd64 -R release.amd64 release iso-image install-image
===> build.sh started:    Sat Mar  2 11:50:19 CET 2024
===> NetBSD version:      10.0_RC5
===> MACHINE:             amd64
===> MACHINE_ARCH:        x86_64
===> Build platform:      Darwin 23.3.0 x86_64
===> HOST_SH:             /bin/sh
===> Bootstrapping nbmake

...

While building module 'LLVM_Utils' imported from /Users/feyrer/work/NetBSD/cvs/src-10/tools/llvm-lib/libLLVMSupport/../../llvm/../../external/apache2/llvm/lib/../dist/llvm/lib/Support/AArch64TargetParser.cpp:14:
In file included from <module-includes>:126:
/Users/feyrer/work/NetBSD/cvs/src-10/tools/llvm-lib/libLLVMSupport/../../llvm/../../external/apache2/llvm/lib/../dist/llvm/include/llvm/Support/Chrono.h:79:30: error: missing '#include <ratio>'; 'ratio' must be declared before it is used
template <> struct unit<std::ratio<3600>> { static const char value[]; };
                             ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ratio:250:28: note: declaration here is not visible
class _LIBCPP_TEMPLATE_VIS ratio
                           ^
/Users/feyrer/work/NetBSD/cvs/src-10/tools/llvm-lib/libLLVMSupport/../../llvm/../../external/apache2/llvm/lib/../dist/llvm/lib/Support/AArch64TargetParser.cpp:14:10: fatal error: could not build module 'LLVM_Utils'
#include "llvm/Support/AArch64TargetParser.h"
 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

...

nbmake[4]: stopped in /Users/feyrer/work/NetBSD/cvs/src-10/tools
nbmake[3]: stopped in /Users/feyrer/work/NetBSD/cvs/src-10
nbmake[2]: stopped in /Users/feyrer/work/NetBSD/cvs/src-10

nbmake[1]: stopped in /Users/feyrer/work/NetBSD/cvs/src-10

nbmake: stopped in /Users/feyrer/work/NetBSD/cvs/src-10

ERROR: Failed to make release

*** BUILD ABORTED ***
>How-To-Repeat:
Use Mac OS and Xcode, checkout netbsd-10 branch as of 2024-03-02, then:

./build.sh -U -j2 -r -X ../xsrc-current -x -m amd64 -T tooldir.Darwin -O /Volumes/netbsd-src-objdestdir/netbsd-10/obj.amd64-Darwin-XXX -D /Volumes/netbsd-src-objdestdir/netbsd-10/destdir.amd64 -R release.amd64 release iso-image install-image
>Fix:
No idea.

>Release-Note:

>Audit-Trail:
From: Harold Gutch <logix@foobar.franken.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-amd64/57982: Build Error or netbsd-10 branch on Mac OS X
Date: Sat, 2 Mar 2024 13:08:30 +0100

 Hi,

 why is LLVM built here?  The build command doesn't ask for that, does
 building on macOS default to that?  And why aarch64?!  Both build host
 and target here are amd64.

 As for the failure - does adding an #include <ratio> to Chrono.h help
 (as the error message suggests)?  See also
 https://github.com/llvm/llvm-project/commit/ab6e9a44ba8011d537cb71381c2a41a5e3354507

 For the "user friendly versions", this is macOS 14.3.1 and Xcode 15.1
 or 15.2, right?  I am guessing a bit based on the version numbers you
 pasted.  That's newer than what I have here, not sure I can
 test/reproduce the error...


   Harold

From: Taylor R Campbell <riastradh@NetBSD.org>
To: gnats-bugs@NetBSD.org
Cc: port-amd64-maintainer@NetBSD.org, gnats-admin@NetBSD.org,
	netbsd-bugs@NetBSD.org, hubertf@gmx.de, joerg@NetBSD.org
Subject: Re: port-amd64/57982: Build Error or netbsd-10 branch on Mac OS X
Date: Sat, 2 Mar 2024 15:45:05 +0000

 > Date: Sat, 2 Mar 2024 13:08:30 +0100
 > From: Harold Gutch <logix@foobar.franken.de>
 >=20
 > why is LLVM built here?  The build command doesn't ask for that, does
 > building on macOS default to that?  And why aarch64?!  Both build host
 > and target here are amd64.

 Building with MKX11=3Dyes (-x) requires llvm for Mesa.

 llvm builds all targets by default, from what I understand.

 > As for the failure - does adding an #include <ratio> to Chrono.h help
 > (as the error message suggests)?  See also
 > https://github.com/llvm/llvm-project/commit/ab6e9a44ba8011d537cb71381c2a4=
 1a5e3354507

 Sounds plausible, and we have a way to do this by adding it to
 config.h.in and adding `-include .../config.h' in the makefile to
 avoid patching upstream.

From: Hubert Feyrer <hubertf@gmx.de>
To: gnats-bugs@netbsd.org,
 Harold 'logix' Gutch <logix@foobar.franken.de>
Cc: port-amd64-maintainer@netbsd.org,
 gnats-admin@netbsd.org,
 netbsd-bugs@netbsd.org
Subject: Re: port-amd64/57982: Build Error or netbsd-10 branch on Mac OS X
Date: Sun, 3 Mar 2024 10:37:30 +0100

 --Apple-Mail=_FA031614-EEC7-4EA4-98DA-841BF828BC30
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/plain;
 	charset=utf-8

 Hi Harold,

 > Am 02.03.2024 um 13:10 schrieb Harold Gutch <logix@foobar.franken.de>:
 > As for the failure - does adding an #include <ratio> to Chrono.h help
 > (as the error message suggests)?  See also
 > =
 https://github.com/llvm/llvm-project/commit/ab6e9a44ba8011d537cb71381c2a41=
 a5e3354507

 Confirmed working, see the attached patch.
 Tested against the netbsd-10 branch.
 Please take over for this, but also see below.



 > For the "user friendly versions", this is macOS 14.3.1 and Xcode 15.1
 > or 15.2, right?  I am guessing a bit based on the version numbers you
 > pasted.  That's newer than what I have here, not sure I can
 > test/reproduce the error=E2=80=A6


 Yes, MacOS Sonoma 4.3.1 (23D60) and XCode 15.2 (plus Command Line tools)

 With the patch above, things get further, but then:

 --- gcrt0.o ---
 =
 /Users/feyrer/work/NetBSD/cvs/src-10/tooldir.Darwin/bin/x86_64--netbsd-gcc=
  -O2   -fPIE    -std=3Dgnu99    -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=3D2  =
 -Wno-format-zero-length  -Werror     =
 --sysroot=3D/Volumes/netbsd-src-objdestdir/netbsd-10/destdir.amd64 =
 -DELFSIZE=3D64 -I/Users/feyrer/work/NetBSD/cvs/src-10/lib/csu/common -I. =
  -c -fPIC -DMCRT0 =
 /Users/feyrer/work/NetBSD/cvs/src-10/lib/csu/common/crt0-common.c -o =
 gcrt0.o.c.o
 during GIMPLE pass: evrp
 /Users/feyrer/work/NetBSD/cvs/src-10/lib/csu/common/crt0-common.c: In =
 function '_preinit':
 /Users/feyrer/work/NetBSD/cvs/src-10/lib/csu/common/crt0-common.c:351:1: =
 internal compiler error: Segmentation fault: 11
   351 | }
       | ^
 libbacktrace could not find executable to open
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See <http://www.NetBSD.org/support/send-pr.html> for instructions.



   -  Hubert


 =EF=BF=BC=

 --Apple-Mail=_FA031614-EEC7-4EA4-98DA-841BF828BC30
 Content-Type: multipart/mixed;
 	boundary="Apple-Mail=_2AA8D04A-D709-47C0-BF4C-7E99DA199996"


 --Apple-Mail=_2AA8D04A-D709-47C0-BF4C-7E99DA199996
 Content-Transfer-Encoding: quoted-printable
 Content-Type: text/html;
 	charset=utf-8

 <html><head><meta http-equiv=3D"content-type" content=3D"text/html; =
 charset=3Dutf-8"></head><body style=3D"overflow-wrap: break-word; =
 -webkit-nbsp-mode: space; line-break: after-white-space;">Hi Harold,<br =
 id=3D"lineBreakAtBeginningOfMessage"><div><br><blockquote =
 type=3D"cite"><div>Am 02.03.2024 um 13:10 schrieb Harold Gutch =
 &lt;logix@foobar.franken.de&gt;:</div><div><div>As for the failure - =
 does adding an #include &lt;ratio&gt; to Chrono.h help<br> (as the error =
 message suggests)? &nbsp;See also<br> =
 https://github.com/llvm/llvm-project/commit/ab6e9a44ba8011d537cb71381c2a41=
 a5e3354507<br></div></div></blockquote><div><br></div><div>Confirmed =
 working, see the attached patch.</div><div>Tested against the netbsd-10 =
 branch.</div><div>Please take over for this, but also see =
 below.</div><br><div><br></div><br><blockquote type=3D"cite"><div><div> =
 For the "user friendly versions", this is macOS 14.3.1 and Xcode =
 15.1<br> or 15.2, right? &nbsp;I am guessing a bit based on the version =
 numbers you<br> pasted. &nbsp;That's newer than what I have here, not =
 sure I can<br> test/reproduce the =
 error=E2=80=A6</div></div></blockquote></div><div><br></div>Yes, MacOS =
 Sonoma 4.3.1 (23D60) and XCode 15.2 (plus Command Line =
 tools)<div><br></div><div>With the patch above, things get further, but =
 then:</div><div><br></div><div><div><font face=3D"Courier New">--- =
 gcrt0.o ---</font></div><div><font face=3D"Courier =
 New">/Users/feyrer/work/NetBSD/cvs/src-10/tooldir.Darwin/bin/x86_64--netbs=
 d-gcc -O2 &nbsp; -fPIE &nbsp; &nbsp;-std=3Dgnu99 &nbsp; &nbsp;-Wall =
 -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith =
 -Wno-sign-compare &nbsp;-Wsystem-headers &nbsp; -Wno-traditional &nbsp; =
 -Wa,--fatal-warnings &nbsp;-Wreturn-type -Wswitch -Wshadow -Wcast-qual =
 -Wwrite-strings -Wextra -Wno-unused-parameter -Wno-sign-compare =
 -Wold-style-definition -Wsign-compare -Wformat=3D2 =
 &nbsp;-Wno-format-zero-length &nbsp;-Werror &nbsp; &nbsp; =
 --sysroot=3D/Volumes/netbsd-src-objdestdir/netbsd-10/destdir.amd64 =
 -DELFSIZE=3D64 -I/Users/feyrer/work/NetBSD/cvs/src-10/lib/csu/common -I. =
 &nbsp;-c -fPIC -DMCRT0 =
 /Users/feyrer/work/NetBSD/cvs/src-10/lib/csu/common/crt0-common.c -o =
 gcrt0.o.c.o</font></div><div><font face=3D"Courier New">during GIMPLE =
 pass: evrp</font></div><div><font face=3D"Courier =
 New">/Users/feyrer/work/NetBSD/cvs/src-10/lib/csu/common/crt0-common.c: =
 In function '_preinit':</font></div><div><font face=3D"Courier =
 New">/Users/feyrer/work/NetBSD/cvs/src-10/lib/csu/common/crt0-common.c:351=
 :1: internal compiler error: Segmentation fault: =
 11</font></div><div><font face=3D"Courier New">&nbsp; 351 | =
 }</font></div><div><font face=3D"Courier New">&nbsp; &nbsp; &nbsp; | =
 ^</font></div><div><font face=3D"Courier New">libbacktrace could not =
 find executable to open</font></div><div><font face=3D"Courier =
 New">Please submit a full bug report,</font></div><div><font =
 face=3D"Courier New">with preprocessed source if =
 appropriate.</font></div><div><font face=3D"Courier New">See =
 &lt;http://www.NetBSD.org/support/send-pr.html&gt; for =
 instructions.</font></div></div><div><br></div><div><br></div><div><br></d=
 iv><div>&nbsp; - =
 &nbsp;Hubert</div><div><br></div><div><br></div><div></div></body></html>=

 --Apple-Mail=_2AA8D04A-D709-47C0-BF4C-7E99DA199996
 Content-Disposition: attachment;
 	filename="patch-port-amd64-57982;.txt"
 Content-Type: text/plain;
 	x-unix-mode=0644;
 	name="patch-port-amd64-57982;.txt"
 Content-Transfer-Encoding: quoted-printable

 $NetBSD$

 Fix Build on MacOS X, see port-amd64/57982;

 --- ./external/apache2/llvm/dist/llvm/include/llvm/Support/Chrono.h.orig	=
 2024-03-03 09:14:48.777651920 +0000
 +++ ./external/apache2/llvm/dist/llvm/include/llvm/Support/Chrono.h
 @@ -14,6 +14,7 @@
 =20
  #include <chrono>
  #include <ctime>
 +#include <ratio>
 =20
  namespace llvm {
 =20

 --Apple-Mail=_2AA8D04A-D709-47C0-BF4C-7E99DA199996
 Content-Transfer-Encoding: 7bit
 Content-Type: text/html;
 	charset=us-ascii

 <html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div></div></body></html>
 --Apple-Mail=_2AA8D04A-D709-47C0-BF4C-7E99DA199996--

 --Apple-Mail=_FA031614-EEC7-4EA4-98DA-841BF828BC30--

State-Changed-From-To: open->analyzed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Sun, 03 Mar 2024 13:05:50 +0000
State-Changed-Why:
problem understood, need to prepare patch now


From: =?UTF-8?B?SmFyb23DrXIgRG9sZcSNZWs=?= <jaromir.dolecek@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: port-amd64/57982: Build Error or netbsd-10 branch on Mac OS X
Date: Sun, 3 Mar 2024 14:37:45 +0100

 I confirm I needed to do the same thing on my MacOS machine to get
 llvm to compile as part of tools build.

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