NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/58664: tools/binutils doesn't build with clang-18



>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



Home | Main Index | Thread Index | Old Index