NetBSD Problem Report #57083
From www@netbsd.org Wed Nov 16 17:43:53 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 2403C1A921F
for <gnats-bugs@gnats.NetBSD.org>; Wed, 16 Nov 2022 17:43:53 +0000 (UTC)
Message-Id: <20221116174352.2F75C1A9239@mollari.NetBSD.org>
Date: Wed, 16 Nov 2022 17:43:52 +0000 (UTC)
From: jiaxun.yang@flygoat.com
Reply-To: jiaxun.yang@flygoat.com
To: gnats-bugs@NetBSD.org
Subject: build.sh failed to build toolchain on macOS (patch)
X-Send-Pr-Version: www-1.0
>Number: 57083
>Category: lib
>Synopsis: build.sh failed to build toolchain on macOS (patch)
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lukem
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Nov 16 17:45:00 +0000 2022
>Closed-Date: Sat Jun 10 07:14:42 +0000 2023
>Last-Modified: Sat Jun 10 07:14:42 +0000 2023
>Originator: Jiaxun Yang
>Release: current
>Organization:
>Environment:
Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 arm64
>Description:
When bootstrapping toolchain on macOS, I got following error report:
time/zic.c:1204:9: warning: implicit declaration of function 'getrandom' is invalid in C99 [-Wimplicit-function-declaration]
>How-To-Repeat:
Bootstrapping on macOS with:
./build.sh -U -O ~/obj -j8 -m evbmips -a mips64el tools
>Fix:
Just don't prove sys/random.h on macOS.
Darwin would supply sys/random.h but it doesn't contains getrandon().
diff --git a/lib/libc/time/private.h b/lib/libc/time/private.h
index 314e3c994af0..6a72afa92591 100644
--- a/lib/libc/time/private.h
+++ b/lib/libc/time/private.h
@@ -75,7 +75,7 @@
# define HAVE_GENERIC (201112 <= __STDC_VERSION__)
#endif
-#if !defined HAVE_GETRANDOM && defined __has_include
+#if !defined HAVE_GETRANDOM && && !defined __APPLE__ && !defined __has_include
# if __has_include(<sys/random.h>)
# define HAVE_GETRANDOM true
# else
>Release-Note:
>Audit-Trail:
From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57083 CVS commit: src/lib/libc/time
Date: Wed, 16 Nov 2022 14:38:08 -0500
Module Name: src
Committed By: christos
Date: Wed Nov 16 19:38:08 UTC 2022
Modified Files:
src/lib/libc/time: private.h
Log Message:
PR/57083: Jiaxun Yang: Fix build on MacOS/X which has <sys/random.h> but no
getrandom(3).
To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/lib/libc/time/private.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
From: Jiaxun Yang <jiaxun.yang@flygoat.com>
To: "gnats-bugs@netbsd.org" <gnats-bugs@NetBSD.org>
Cc:
Subject: Re: lib/57083
Date: Wed, 16 Nov 2022 18:04:21 +0000
Update patch:
diff --git a/lib/libc/time/private.h b/lib/libc/time/private.h
index 314e3c994af0..6ea9d324fd6f 100644
--- a/lib/libc/time/private.h
+++ b/lib/libc/time/private.h
@@ -75,7 +75,7 @@
# define HAVE_GENERIC (201112 <= __STDC_VERSION__)
#endif
-#if !defined HAVE_GETRANDOM && defined __has_include
+#if !defined HAVE_GETRANDOM && !defined __APPLE__ && !defined __has_include
# if __has_include(<sys/random.h>)
# define HAVE_GETRANDOM true
# else
From: "Jonathan A. Kollasch" <jakllsch@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc:
Subject: PR/57083 CVS commit: src/lib/libc/time
Date: Thu, 17 Nov 2022 17:35:25 +0000
Module Name: src
Committed By: jakllsch
Date: Thu Nov 17 17:35:25 UTC 2022
Modified Files:
src/lib/libc/time: private.h
Log Message:
Simply set HAVE_GETRANDOM to false on __APPLE__.
Addresses PR 57083.
To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/lib/libc/time/private.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
State-Changed-From-To: open->feedback
State-Changed-By: lukem@NetBSD.org
State-Changed-When: Thu, 18 May 2023 14:33:23 +0000
State-Changed-Why:
Is this fixed? There's been two separate commits that claim to fix it
Responsible-Changed-From-To: lib-bug-people->lukem
Responsible-Changed-By: lukem@NetBSD.org
Responsible-Changed-When: Sat, 20 May 2023 08:36:43 +0000
Responsible-Changed-Why:
State-Changed-From-To: feedback->closed
State-Changed-By: lukem@NetBSD.org
State-Changed-When: Sat, 10 Jun 2023 07:14:42 +0000
State-Changed-Why:
No response to feedback.
I've been cross-building -current on macOS for a while without
problem, so this is fixed.
>Unformatted:
(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-2023
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.