From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ma1-aaemail-dr-lapp02.apple.com (ma1-aaemail-dr-lapp02.apple.com [17.171.2.68]) by mx.groups.io with SMTP id smtpd.web09.27161.1661449564205245541 for ; Thu, 25 Aug 2022 10:46:04 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@apple.com header.s=20180706 header.b=agCWuFmW; spf=pass (domain: apple.com, ip: 17.171.2.68, mailfrom: afish@apple.com) Received: from pps.filterd (ma1-aaemail-dr-lapp02.apple.com [127.0.0.1]) by ma1-aaemail-dr-lapp02.apple.com (8.16.0.42/8.16.0.42) with SMTP id 27PHiZgq025885; Thu, 25 Aug 2022 10:46:01 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apple.com; h=from : message-id : content-type : mime-version : subject : date : in-reply-to : cc : to : references; s=20180706; bh=luQ8kvega0rj9t0MgKz0Yes+V1GOz0k6CsRCKYmjods=; b=agCWuFmWdY4TD1Cn9TACo0azfcrR0RcH7M3u24wVw3u/vszUTy2e+sXztmvSygUV2iIG OXr3u15vUeS+N7a/YB7A/EH8Kcls8u69ZHIrl3T5iPcQnV1J+DbnNB0jDfdTuUg2ztS9 ppcLKmzuTwC6QyFYF3YXwUhJEIvthfy8WiWIWUwt8liClTKyzg58Xf9fO0SzqCGjQHmU 00DV26W1dd03FPv1egYIOaUYAyrHx9/oqVsuE08J5Wt7p+4OJn4dmDqBiEVFRP17FHK2 Lautv/Wnmy0RzSEm4ter9eCInYd9OzDhq/ICjjNPG8fDAZuqAjy00RAFWLF5i9C3cDyo hQ== Received: from rn-mailsvcp-mta-lapp04.rno.apple.com (rn-mailsvcp-mta-lapp04.rno.apple.com [10.225.203.152]) by ma1-aaemail-dr-lapp02.apple.com with ESMTP id 3j2v9ug49h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Thu, 25 Aug 2022 10:46:01 -0700 Received: from rn-mailsvcp-mmp-lapp03.rno.apple.com (rn-mailsvcp-mmp-lapp03.rno.apple.com [17.179.253.16]) by rn-mailsvcp-mta-lapp04.rno.apple.com (Oracle Communications Messaging Server 8.1.0.19.20220711 64bit (built Jul 11 2022)) with ESMTPS id <0RH600JV0MOPN3C0@rn-mailsvcp-mta-lapp04.rno.apple.com>; Thu, 25 Aug 2022 10:46:01 -0700 (PDT) Received: from process_milters-daemon.rn-mailsvcp-mmp-lapp03.rno.apple.com by rn-mailsvcp-mmp-lapp03.rno.apple.com (Oracle Communications Messaging Server 8.1.0.19.20220711 64bit (built Jul 11 2022)) id <0RH600W00MN5C800@rn-mailsvcp-mmp-lapp03.rno.apple.com>; Thu, 25 Aug 2022 10:46:01 -0700 (PDT) X-Va-A: X-Va-T-CD: fe6d782ace777c3271852f01d6854fc9 X-Va-E-CD: 46caa3fc8187eae4c202c9eef47d1456 X-Va-R-CD: bad28361c5a74b4fe94391f43d95eff2 X-Va-CD: 0 X-Va-ID: e3e7f2d6-ed08-4889-8e8a-28bfa230115d X-V-A: X-V-T-CD: fe6d782ace777c3271852f01d6854fc9 X-V-E-CD: 46caa3fc8187eae4c202c9eef47d1456 X-V-R-CD: bad28361c5a74b4fe94391f43d95eff2 X-V-CD: 0 X-V-ID: 1e4709eb-c9a8-4e17-a124-5375d5b580c9 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517,18.0.895 definitions=2022-08-25_08:2022-08-25,2022-08-25 signatures=0 Received: from smtpclient.apple (unknown [17.235.33.86]) by rn-mailsvcp-mmp-lapp03.rno.apple.com (Oracle Communications Messaging Server 8.1.0.19.20220711 64bit (built Jul 11 2022)) with ESMTPSA id <0RH600V2JMONPO00@rn-mailsvcp-mmp-lapp03.rno.apple.com>; Thu, 25 Aug 2022 10:46:00 -0700 (PDT) From: "Andrew Fish" Message-id: <6C34C6CE-C50B-4FF1-9506-A27191E249B6@apple.com> MIME-version: 1.0 (Mac OS X Mail 16.0 \(3731.0.8.1.1\)) Subject: Re: BaseTools no longer builds on macOS: "error: unknown warning option '-Werror=stringop-overflow'" Date: Thu, 25 Aug 2022 10:45:49 -0700 In-reply-to: Cc: "devel@edk2.groups.io" , Mike Kinney To: Rebecca Cran References: X-Mailer: Apple Mail (2.3731.0.8.1.1) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.517,18.0.895 definitions=2022-08-25_08:2022-08-25,2022-08-25 signatures=0 Content-type: multipart/alternative; boundary="Apple-Mail=_138E1AB2-B7BF-410A-BCE2-D5291471871B" --Apple-Mail=_138E1AB2-B7BF-410A-BCE2-D5291471871B Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Rebecca, FYI /usr/bin/gcc has been a redirector into clang for a lot of years.=20 The build picks different default sets of complier flags based on build = type. There is already code that assumes gcc =3D=3D clang here [1] I think the issue is the check that is wrapping "BUILD_CFLAGS +=3D = -Wno-error=3Dstringop-overflow=E2=80=9D. It needs to skip the check on = macOS.=20 diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile = b/BaseTools/Source/C/DevicePath/GNUmakefile index c217674345b1..f3c9739617f2 100644 --- a/BaseTools/Source/C/DevicePath/GNUmakefile +++ b/BaseTools/Source/C/DevicePath/GNUmakefile @@ -14,12 +14,14 @@ OBJECTS =3D DevicePath.o UefiDevicePathLib.o = DevicePathFromText.o DevicePathUtili include $(MAKEROOT)/Makefiles/app.makefile =20 GCCVERSION =3D $(shell gcc -dumpversion | awk -F'.' '{print $$1}') +ifneq ($(DARWIN),Darwin) ifneq ("$(GCCVERSION)", "5") ifneq ($(CXX), llvm) # gcc 12 trips over device path handling BUILD_CFLAGS +=3D -Wno-error=3Dstringop-overflow endif endif +endif =20 LIBS =3D -lCommon ifeq ($(CYGWIN), CYGWIN) [1] = https://github.com/tianocore/edk2/blob/master/BaseTools/Source/C/Makefiles= /header.makefile#L83 Thanks, Andrew Fish > On Aug 25, 2022, at 9:20 AM, Rebecca Cran wrote: >=20 > BaseTools no longer builds on macOS (12.5.1, Monterey), because 'gcc' = in /usr/bin is really clang. >=20 > I tried installing gcc 12 from Homebrew, but the build then failed = saying it couldn't find _stdio.h. >=20 > It appears the breakage might have been introduced in this commit back = in March: >=20 > commit 22130dcd98b4d4b76ac8d922adb4a2dbc86fa52c > Author: Gerd Hoffmann > Date: Thu Mar 24 20:04:36 2022 +0800 >=20 > Basetools: turn off gcc12 warning >=20 > Running "make -C BaseTools" produces the following error: >=20 >=20 > /Library/Developer/CommandLineTools/usr/bin/make -C DevicePath > gcc -c -I .. -I ../Include/Common -I ../Include/ -I = ../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/X64/ = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror = -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result = -nostdlib -g -O2 -Wno-error=3Dstringop-overflow DevicePath.c -o = DevicePath.o > error: unknown warning option '-Werror=3Dstringop-overflow'; did you = mean '-Werror=3Dshift-overflow'? [-Werror,-Wunknown-warning-option] > make[2]: *** [DevicePath.o] Error 1 > make[1]: *** [DevicePath] Error 2 > make: *** [Source/C] Error 2 >=20 >=20 > bcran@procan edk2 % gcc -v > Configured with: --prefix=3D/Library/Developer/CommandLineTools/usr = --with-gxx-include-dir=3D/Library/Developer/CommandLineTools/SDKs/MacOSX.s= dk/usr/include/c++/4.2.1 > Apple clang version 12.0.5 (clang-1205.0.22.9) > Target: x86_64-apple-darwin21.6.0 > Thread model: posix > InstalledDir: /Library/Developer/CommandLineTools/usr/bin >=20 > bcran@procan edk2 % uname -a > Darwin procan.int.bsdio.com 21.6.0 Darwin Kernel Version 21.6.0: Wed = Aug 10 14:25:27 PDT 2022; root:xnu-8020.141.5~2/RELEASE_X86_64 x86_64 >=20 > --=20 > Rebecca Cran >=20 --Apple-Mail=_138E1AB2-B7BF-410A-BCE2-D5291471871B Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8 Rebecca,

FYI /usr/bin/gcc has = been a redirector into clang for a lot of = years. 

The build picks different default = sets of complier flags based on build type. There is already code that = assumes gcc =3D=3D clang here [1]

I think the = issue is the check that is wrapping "BUILD_CFLAGS +=3D = -Wno-error=3Dstringop-overflow=E2=80=9D. It needs to skip the check on = macOS. 

diff --git = a/BaseTools/Source/C/DevicePath/GNUmakefile = b/BaseTools/Source/C/DevicePath/GNUmakefile

index = c217674345b1..f3c9739617f2 100644

--- = a/BaseTools/Source/C/DevicePath/GNUmakefile

+++ = b/BaseTools/Source/C/DevicePath/GNUmakefile

@@ = -14,12 +14,14 @@ OBJECTS =3D DevicePath.o UefiDevicePathLib.o = DevicePathFromText.o  DevicePathUtili

 include = $(MAKEROOT)/Makefiles/app.makefile

 

 GCCVERSION =3D= $(shell gcc -dumpversion | awk -F'.' '{print $$1}')

+ifneq = ($(DARWIN),Darwin)

 ifneq = ("$(GCCVERSION)", "5")

 ifneq = ($(CXX), llvm)

 # gcc 12 = trips over device path handling

 BUILD_CFLAGS = +=3D -Wno-error=3Dstringop-overflow

 endif

 endif

+endif

 

 LIBS =3D = -lCommon

 ifeq = ($(CYGWIN), CYGWIN)




Thanks,

Andrew = Fish

On Aug 25, 2022, at 9:20 = AM, Rebecca Cran <rebecca@bsdio.com> wrote:

BaseTools no longer builds = on macOS (12.5.1, Monterey), because 'gcc' in /usr/bin is really = clang.

I tried installing gcc 12 from Homebrew, but the build = then failed saying it couldn't find _stdio.h.

It appears the = breakage might have been introduced in this commit back in = March:

commit 22130dcd98b4d4b76ac8d922adb4a2dbc86fa52c
Author: = Gerd Hoffmann <kraxel@redhat.com>
Date:   Thu Mar 24 = 20:04:36 2022 +0800

    Basetools: turn off gcc12 = warning

Running "make -C BaseTools" produces the following = error:


/Library/Developer/CommandLineTools/usr/bin/make -C = DevicePath
gcc  -c  -I .. -I ../Include/Common -I = ../Include/ -I ../Include/IndustryStandard -I ../Common/ -I .. -I . -I = ../Include/X64/ -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror = -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result = -nostdlib -g -O2  -Wno-error=3Dstringop-overflow DevicePath.c -o = DevicePath.o
error: unknown warning option = '-Werror=3Dstringop-overflow'; did you mean '-Werror=3Dshift-overflow'? = [-Werror,-Wunknown-warning-option]
make[2]: *** [DevicePath.o] Error = 1
make[1]: *** [DevicePath] Error 2
make: *** [Source/C] Error = 2


bcran@procan edk2 % gcc -v
Configured with: = --prefix=3D/Library/Developer/CommandLineTools/usr = --with-gxx-include-dir=3D/Library/Developer/CommandLineTools/SDKs/MacOSX.s= dk/usr/include/c++/4.2.1
Apple clang version 12.0.5 = (clang-1205.0.22.9)
Target: x86_64-apple-darwin21.6.0
Thread = model: posix
InstalledDir: = /Library/Developer/CommandLineTools/usr/bin

bcran@procan edk2 % = uname -a
Darwin procan.int.bsdio.com 21.6.0 Darwin Kernel Version = 21.6.0: Wed Aug 10 14:25:27 PDT 2022; = root:xnu-8020.141.5~2/RELEASE_X86_64 x86_64

--
Rebecca = Cran


= --Apple-Mail=_138E1AB2-B7BF-410A-BCE2-D5291471871B--