NetBSD Problem Report #57837

From www@netbsd.org  Fri Jan 12 01:00:29 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 EA12E1A9238
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 12 Jan 2024 01:00:28 +0000 (UTC)
Message-Id: <20240112010027.E7AA11A923A@mollari.NetBSD.org>
Date: Fri, 12 Jan 2024 01:00:27 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: bootstrap-mk-files bsd.own.mk defines wrong OBJECT_FMT on macOS (Darwin)
X-Send-Pr-Version: www-1.0

>Number:         57837
>Category:       pkg
>Synopsis:       bootstrap-mk-files bsd.own.mk defines wrong OBJECT_FMT on macOS (Darwin)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 12 01:05:00 +0000 2024
>Last-Modified:  Wed Jun 05 17:45:01 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The NetBSDarwin Foundation
>Environment:
macOS
>Description:
On macOS (`Darwin'), bootstrap-mk-files bsd.own.mk defines OBJECT_FMT=ELF even though the correct definition is OBJECT_FMT=Mach-O.

pkgsrc's mk infrastructure has a workaround in mk/bsd.prefs.mk:

# Set this before <bsd.own.mk> does, since it doesn't know about Darwin
.if ${OPSYS} == "Darwin"
OBJECT_FMT?=            Mach-O
.endif

But it would be nice if bootstrap-mk-files defined this correctly in the first place to render this workaround unnecessary.
>How-To-Repeat:
$ cat Makefile
.include <bsd.own.mk>
$ bmake -V OBJECT_FMT
ELF
>Fix:
Yes, please!

>Audit-Trail:
From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57837 CVS commit: pkgsrc/mk
Date: Fri, 26 Jan 2024 03:25:36 +0000

 Module Name:	pkgsrc
 Committed By:	riastradh
 Date:		Fri Jan 26 03:25:36 UTC 2024

 Modified Files:
 	pkgsrc/mk: bsd.prefs.mk

 Log Message:
 bsd.prefs.mk: Set OBJECT_FMT for Darwin before cross variables.

 This way it can be handled by the cross variable logic when the host
 and target have misatched object formats, like building NetBSD
 packages (ELF) on macOS (Mach-O).

 This whole stanza can be removed when PR pkg/57837
 (bootstrap-mk-files bsd.own.mk defines wrong OBJECT_FMT on macOS
 (Darwin), https://gnats.NetBSD.org/57837) is fixed.

 No functional change intended so far -- this just makes subsequent
 patches easier to follow.


 To generate a diff of this commit:
 cvs rdiff -u -r1.437 -r1.438 pkgsrc/mk/bsd.prefs.mk

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Taylor R Campbell <riastradh@NetBSD.org>
To: gnats-bugs@NetBSD.org, pkgsrc-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/57837: bootstrap-mk-files bsd.own.mk defines wrong OBJECT_FMT on macOS (Darwin)
Date: Wed, 5 Jun 2024 17:41:08 +0000

 Likely same problem on:

 - AIX (OBJECT_FMT=XCOFF)
 - Cygwin (OBJECT_FMT=PE, PR pkg/58315 https://gnats.NetBSD.org/58315)
 - HP-UX (OBJECT_FMT=SOM on hppa/hppa64)
 - OSF/1 (OBJECT_FMT=ECOFF)

 (and possibly old OpenBSD where ELF_TOOLCHAIN is not defined, but I
 doubt anyone cares about a.out-era OpenBSD in the year 2024 --
 probably even less than AIX, HP-UX, or OSF/1)

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.