NetBSD Problem Report #58664

From www@netbsd.org  Wed Sep  4 08:29:02 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)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 02EC91A923B
	for <gnats-bugs@gnats.NetBSD.org>; Wed,  4 Sep 2024 08:29:02 +0000 (UTC)
Message-Id: <20240904082900.9B4701A923C@mollari.NetBSD.org>
Date: Wed,  4 Sep 2024 08:29:00 +0000 (UTC)
From: sotiris@lamprinidis.com
Reply-To: sotiris@lamprinidis.com
To: gnats-bugs@NetBSD.org
Subject: tools/binutils doesn't build with clang-18
X-Send-Pr-Version: www-1.0

>Number:         58664
>Category:       toolchain
>Synopsis:       tools/binutils doesn't build with clang-18
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 04 08:30:00 +0000 2024
>Originator:     Sotiris Lamprinidis
>Release:        release-10
>Organization:
>Environment:
Darwin 23.6.0 arm64 / clang version 18.1.8
>Description:
It seems that some deprecated macros in the zlib bundled in binutils cause trouble with clang 18, ref: https://gitlab.kitware.com/cmake/cmake/-/issues/25755.
>How-To-Repeat:

>Fix:
 I am using the fix described there, i.e. append -fno-define-target-os-macros. Not sure if that's the desired way to do it though.

Index: tools/binutils/Makefile
===================================================================
RCS file: /cvsroot/src/tools/binutils/Makefile,v
retrieving revision 1.33
diff -u -u -r1.33 Makefile
--- tools/binutils/Makefile     18 Sep 2021 01:47:10 -0000      1.33
+++ tools/binutils/Makefile     4 Sep 2024 08:18:44 -0000
@@ -32,6 +32,17 @@
 INSTALL_TARGET+=install-gprof
 .endif

+# https://gitlab.kitware.com/cmake/cmake/-/issues/25755
+# deprecated macros in zlib error with clang 18
+.if ${HOST_CC} == "clang"
+CLANG_VERSION_STR!= ${HOST_CC} -v 2>&1
+CLANG_VERSION=${CLANG_VERSION_STR:[3]}
+CLANG_VERSION_MAJOR=${CLANG_VERSION:S,., ,g:[1]}
+.if ${CLANG_VERSION_MAJOR} >= 18
+HOST_CFLAGS+= -fno-define-target-os-macros
+.endif
+.endif
+
 .include "${.CURDIR}/../Makefile.gnuhost"

 CCADDFLAGS=    -I${GNUHOSTDIST}/include  -I${DESTDIR}/usr/include

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.