public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* BaseTools no longer builds on macOS: "error: unknown warning option '-Werror=stringop-overflow'"
@ 2022-08-25 16:20 Rebecca Cran
  2022-08-25 17:45 ` Andrew Fish
       [not found] ` <170EA793884203D0.22386@groups.io>
  0 siblings, 2 replies; 7+ messages in thread
From: Rebecca Cran @ 2022-08-25 16:20 UTC (permalink / raw)
  To: devel@edk2.groups.io, Andrew Fish, Kinney, Michael D

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=stringop-overflow DevicePath.c -o DevicePath.o
error: unknown warning option '-Werror=stringop-overflow'; did you mean 
'-Werror=shift-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=/Library/Developer/CommandLineTools/usr 
--with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: BaseTools no longer builds on macOS: "error: unknown warning option '-Werror=stringop-overflow'"
  2022-08-25 16:20 BaseTools no longer builds on macOS: "error: unknown warning option '-Werror=stringop-overflow'" Rebecca Cran
@ 2022-08-25 17:45 ` Andrew Fish
       [not found] ` <170EA793884203D0.22386@groups.io>
  1 sibling, 0 replies; 7+ messages in thread
From: Andrew Fish @ 2022-08-25 17:45 UTC (permalink / raw)
  To: Rebecca Cran; +Cc: devel@edk2.groups.io, Mike Kinney

[-- Attachment #1: Type: text/plain, Size: 3047 bytes --]

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 == clang here [1]

I think the issue is the check that is wrapping "BUILD_CFLAGS += -Wno-error=stringop-overflow”. 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 = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
 include $(MAKEROOT)/Makefiles/app.makefile
 
 GCCVERSION = $(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 += -Wno-error=stringop-overflow
 endif
 endif
+endif
 
 LIBS = -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 <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=stringop-overflow DevicePath.c -o DevicePath.o
> error: unknown warning option '-Werror=stringop-overflow'; did you mean '-Werror=shift-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=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/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
> 


[-- Attachment #2: Type: text/html, Size: 7317 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] BaseTools no longer builds on macOS: "error: unknown warning option '-Werror=stringop-overflow'"
       [not found] ` <170EA793884203D0.22386@groups.io>
@ 2022-08-25 17:49   ` Andrew Fish
  2022-08-25 23:13     ` Rebecca Cran
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Fish @ 2022-08-25 17:49 UTC (permalink / raw)
  To: edk2-devel-groups-io, Andrew Fish; +Cc: Rebecca Cran, Mike Kinney

[-- Attachment #1: Type: text/plain, Size: 3954 bytes --]

Maybe having the check last would be cleaner. 

diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile
index c217674345b1..17f213879e82 100644
--- a/BaseTools/Source/C/DevicePath/GNUmakefile
+++ b/BaseTools/Source/C/DevicePath/GNUmakefile
@@ -16,10 +16,12 @@ include $(MAKEROOT)/Makefiles/app.makefile
 GCCVERSION = $(shell gcc -dumpversion | awk -F'.' '{print $$1}')
 ifneq ("$(GCCVERSION)", "5")
 ifneq ($(CXX), llvm)
+ifneq ($(DARWIN),Darwin)
 # gcc 12 trips over device path handling
 BUILD_CFLAGS += -Wno-error=stringop-overflow
 endif
 endif
+endif
 
 LIBS = -lCommon
 ifeq ($(CYGWIN), CYGWIN)


Thanks,

Andrew Fish

> On Aug 25, 2022, at 10:45 AM, Andrew Fish via groups.io <afish=apple.com@groups.io> wrote:
> 
> 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 == clang here [1]
> 
> I think the issue is the check that is wrapping "BUILD_CFLAGS += -Wno-error=stringop-overflow”. 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 = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
>  include $(MAKEROOT)/Makefiles/app.makefile
>  
>  GCCVERSION = $(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 += -Wno-error=stringop-overflow
>  endif
>  endif
> +endif
>  
>  LIBS = -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 <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=stringop-overflow DevicePath.c -o DevicePath.o
>> error: unknown warning option '-Werror=stringop-overflow'; did you mean '-Werror=shift-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=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/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
>> 
> 
> 


[-- Attachment #2: Type: text/html, Size: 11827 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] BaseTools no longer builds on macOS: "error: unknown warning option '-Werror=stringop-overflow'"
  2022-08-25 17:49   ` [edk2-devel] " Andrew Fish
@ 2022-08-25 23:13     ` Rebecca Cran
  2022-08-25 23:51       ` Michael D Kinney
  0 siblings, 1 reply; 7+ messages in thread
From: Rebecca Cran @ 2022-08-25 23:13 UTC (permalink / raw)
  To: devel, afish; +Cc: Mike Kinney

[-- Attachment #1: Type: text/plain, Size: 4273 bytes --]

Thanks, that patch works. Is it too late to get it in for the stable tag?


Reviewed-by: Rebecca Cran <rebecca@bsdio.com>


On 8/25/22 11:49, Andrew Fish via groups.io wrote:
> Maybe having the check last would be cleaner.
>
> *diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile 
> b/BaseTools/Source/C/DevicePath/GNUmakefile*
>
> *index c217674345b1..17f213879e82 100644*
>
> *--- a/BaseTools/Source/C/DevicePath/GNUmakefile*
>
> *+++ b/BaseTools/Source/C/DevicePath/GNUmakefile*
>
> @@ -16,10 +16,12 @@include $(MAKEROOT)/Makefiles/app.makefile
>
>  GCCVERSION = $(shell gcc -dumpversion | awk -F'.' '{print $$1}')
>
>  ifneq ("$(GCCVERSION)", "5")
>
>  ifneq ($(CXX), llvm)
>
> +ifneq ($(DARWIN),Darwin)
>
>  # gcc 12 trips over device path handling
>
>  BUILD_CFLAGS += -Wno-error=stringop-overflow
>
>  endif
>
>  endif
>
> +endif
>
>  LIBS = -lCommon
>
>  ifeq ($(CYGWIN), CYGWIN)
>
>
>
> Thanks,
>
> Andrew Fish
>
>> On Aug 25, 2022, at 10:45 AM, Andrew Fish via groups.io 
>> <afish=apple.com@groups.io> wrote:
>>
>> 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 == clang here [1]
>>
>> I think the issue is the check that is wrapping "BUILD_CFLAGS += 
>> -Wno-error=stringop-overflow”. 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 = DevicePath.o UefiDevicePathLib.o 
>> DevicePathFromText.o DevicePathUtili
>>  include $(MAKEROOT)/Makefiles/app.makefile
>>
>>
>>  GCCVERSION = $(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 += -Wno-error=stringop-overflow
>>  endif
>>  endif
>> +endif
>>
>>
>>  LIBS = -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 <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=stringop-overflow DevicePath.c -o 
>>> DevicePath.o
>>> error: unknown warning option '-Werror=stringop-overflow'; did you 
>>> mean '-Werror=shift-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=/Library/Developer/CommandLineTools/usr 
>>> --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/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
>>>
>>
>
> 

[-- Attachment #2: Type: text/html, Size: 17813 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] BaseTools no longer builds on macOS: "error: unknown warning option '-Werror=stringop-overflow'"
  2022-08-25 23:13     ` Rebecca Cran
@ 2022-08-25 23:51       ` Michael D Kinney
  2022-08-26  1:53         ` 回复: " gaoliming
  2022-08-26  7:32         ` Rebecca Cran
  0 siblings, 2 replies; 7+ messages in thread
From: Michael D Kinney @ 2022-08-25 23:51 UTC (permalink / raw)
  To: Rebecca Cran, devel@edk2.groups.io, afish@apple.com, Gao, Liming,
	Andrew Fish (afish@apple.com), Leif Lindholm, Kinney, Michael D

[-- Attachment #1: Type: text/plain, Size: 4840 bytes --]

Hi Rebecca,

+Liming

This looks like a low risk change to me.  But given that the release is supposed to occur tonight, we may need to delay the release 1-2 days to make sure there are no side effects.

Can you please prepare a patch with this change for review and make sure it is marked for this stable tag.

There is one other revert being considered, so a delay of 1-2 days may be appropriate for that issue as well.

Mike

From: Rebecca Cran <rebecca@bsdio.com>
Sent: Thursday, August 25, 2022 4:13 PM
To: devel@edk2.groups.io; afish@apple.com
Cc: Kinney, Michael D <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] BaseTools no longer builds on macOS: "error: unknown warning option '-Werror=stringop-overflow'"


Thanks, that patch works. Is it too late to get it in for the stable tag?



Reviewed-by: Rebecca Cran <rebecca@bsdio.com><mailto:rebecca@bsdio.com>


On 8/25/22 11:49, Andrew Fish via groups.io wrote:
Maybe having the check last would be cleaner.


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

index c217674345b1..17f213879e82 100644

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

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

@@ -16,10 +16,12 @@ include $(MAKEROOT)/Makefiles/app.makefile

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

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

 ifneq ($(CXX), llvm)

+ifneq ($(DARWIN),Darwin)

 # gcc 12 trips over device path handling

 BUILD_CFLAGS += -Wno-error=stringop-overflow

 endif

 endif

+endif



 LIBS = -lCommon

 ifeq ($(CYGWIN), CYGWIN)



Thanks,

Andrew Fish


On Aug 25, 2022, at 10:45 AM, Andrew Fish via groups.io <afish=apple.com@groups.io><mailto:afish=apple.com@groups.io> wrote:

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 == clang here [1]

I think the issue is the check that is wrapping "BUILD_CFLAGS += -Wno-error=stringop-overflow”. 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 = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
 include $(MAKEROOT)/Makefiles/app.makefile


 GCCVERSION = $(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 += -Wno-error=stringop-overflow
 endif
 endif
+endif


 LIBS = -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 <rebecca@bsdio.com><mailto: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><mailto: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=stringop-overflow DevicePath.c -o DevicePath.o
error: unknown warning option '-Werror=stringop-overflow'; did you mean '-Werror=shift-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=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/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




[-- Attachment #2: Type: text/html, Size: 57140 bytes --]

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* 回复: [edk2-devel] BaseTools no longer builds on macOS: "error: unknown warning option '-Werror=stringop-overflow'"
  2022-08-25 23:51       ` Michael D Kinney
@ 2022-08-26  1:53         ` gaoliming
  2022-08-26  7:32         ` Rebecca Cran
  1 sibling, 0 replies; 7+ messages in thread
From: gaoliming @ 2022-08-26  1:53 UTC (permalink / raw)
  To: devel, michael.d.kinney, 'Rebecca Cran', afish,
	'Leif Lindholm'

[-- Attachment #1: Type: text/plain, Size: 5707 bytes --]

Mike:

 I agree with you. 

 

Thanks

Liming

发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Michael D Kinney
发送时间: 2022年8月26日 7:51
收件人: Rebecca Cran <rebecca@bsdio.com>; devel@edk2.groups.io; afish@apple.com; Gao, Liming <gaoliming@byosoft.com.cn>; Andrew Fish (afish@apple.com) <afish@apple.com>; Leif Lindholm <quic_llindhol@quicinc.com>; Kinney, Michael D <michael.d.kinney@intel.com>
主题: Re: [edk2-devel] BaseTools no longer builds on macOS: "error: unknown warning option '-Werror=stringop-overflow'"

 

Hi Rebecca,

 

+Liming

 

This looks like a low risk change to me.  But given that the release is supposed to occur tonight, we may need to delay the release 1-2 days to make sure there are no side effects.

 

Can you please prepare a patch with this change for review and make sure it is marked for this stable tag.

 

There is one other revert being considered, so a delay of 1-2 days may be appropriate for that issue as well.

 

Mike

 

From: Rebecca Cran <rebecca@bsdio.com <mailto:rebecca@bsdio.com> > 
Sent: Thursday, August 25, 2022 4:13 PM
To: devel@edk2.groups.io <mailto:devel@edk2.groups.io> ; afish@apple.com <mailto:afish@apple.com> 
Cc: Kinney, Michael D <michael.d.kinney@intel.com <mailto:michael.d.kinney@intel.com> >
Subject: Re: [edk2-devel] BaseTools no longer builds on macOS: "error: unknown warning option '-Werror=stringop-overflow'"

 

Thanks, that patch works. Is it too late to get it in for the stable tag?

 

Reviewed-by: Rebecca Cran  <mailto:rebecca@bsdio.com> <rebecca@bsdio.com>

 

On 8/25/22 11:49, Andrew Fish via groups.io wrote:

Maybe having the check last would be cleaner.  

 

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

index c217674345b1..17f213879e82 100644

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

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

@@ -16,10 +16,12 @@ include $(MAKEROOT)/Makefiles/app.makefile

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

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

 ifneq ($(CXX), llvm)

+ifneq ($(DARWIN),Darwin)

 # gcc 12 trips over device path handling

 BUILD_CFLAGS += -Wno-error=stringop-overflow

 endif

 endif

+endif

 

 LIBS = -lCommon

 ifeq ($(CYGWIN), CYGWIN)





 

Thanks,

 

Andrew Fish





On Aug 25, 2022, at 10:45 AM, Andrew Fish via groups.io  <mailto:afish=apple.com@groups.io> <afish=apple.com@groups.io> wrote:

 

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 == clang here [1]

 

I think the issue is the check that is wrapping "BUILD_CFLAGS += -Wno-error=stringop-overflow”. 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 = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili

 include $(MAKEROOT)/Makefiles/app.makefile

 

 GCCVERSION = $(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 += -Wno-error=stringop-overflow

 endif

 endif

+endif

 

 LIBS = -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  <mailto:rebecca@bsdio.com> <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  <mailto:kraxel@redhat.com> <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=stringop-overflow DevicePath.c -o DevicePath.o
error: unknown warning option '-Werror=stringop-overflow'; did you mean '-Werror=shift-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=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/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

 

 




[-- Attachment #2: Type: text/html, Size: 18540 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [edk2-devel] BaseTools no longer builds on macOS: "error: unknown warning option '-Werror=stringop-overflow'"
  2022-08-25 23:51       ` Michael D Kinney
  2022-08-26  1:53         ` 回复: " gaoliming
@ 2022-08-26  7:32         ` Rebecca Cran
  1 sibling, 0 replies; 7+ messages in thread
From: Rebecca Cran @ 2022-08-26  7:32 UTC (permalink / raw)
  To: Kinney, Michael D, devel@edk2.groups.io, afish@apple.com,
	Gao, Liming, Leif Lindholm

[-- Attachment #1: Type: text/plain, Size: 6110 bytes --]

Thanks. I've submitted it - the subject is "[PATCH edk2-stable202208 
1/1] BaseTools: Fix DevicePath GNUmakefile for macOS"


-- 

Rebecca Cran


On 8/25/2022 5:51 PM, Kinney, Michael D wrote:
>
> Hi Rebecca,
>
> +Liming
>
> This looks like a low risk change to me.But given that the release is 
> supposed to occur tonight, we may need to delay the release 1-2 days 
> to make sure there are no side effects.
>
> Can you please prepare a patch with this change for review and make 
> sure it is marked for this stable tag.
>
> There is one other revert being considered, so a delay of 1-2 days may 
> be appropriate for that issue as well.
>
> Mike
>
> *From:*Rebecca Cran <rebecca@bsdio.com>
> *Sent:* Thursday, August 25, 2022 4:13 PM
> *To:* devel@edk2.groups.io; afish@apple.com
> *Cc:* Kinney, Michael D <michael.d.kinney@intel.com>
> *Subject:* Re: [edk2-devel] BaseTools no longer builds on macOS: 
> "error: unknown warning option '-Werror=stringop-overflow'"
>
> Thanks, that patch works. Is it too late to get it in for the stable tag?
>
> Reviewed-by: Rebecca Cran <rebecca@bsdio.com> <mailto:rebecca@bsdio.com>
>
> On 8/25/22 11:49, Andrew Fish via groups.io wrote:
>
>     Maybe having the check last would be cleaner.
>
>     *diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile
>     b/BaseTools/Source/C/DevicePath/GNUmakefile*
>
>     *index c217674345b1..17f213879e82 100644*
>
>     *--- a/BaseTools/Source/C/DevicePath/GNUmakefile*
>
>     *+++ b/BaseTools/Source/C/DevicePath/GNUmakefile*
>
>     @@ -16,10 +16,12 @@include $(MAKEROOT)/Makefiles/app.makefile
>
>      GCCVERSION = $(shell gcc -dumpversion | awk -F'.' '{print $$1}')
>
>      ifneq ("$(GCCVERSION)", "5")
>
>      ifneq ($(CXX), llvm)
>
>     +ifneq ($(DARWIN),Darwin)
>
>      # gcc 12 trips over device path handling
>
>      BUILD_CFLAGS += -Wno-error=stringop-overflow
>
>      endif
>
>      endif
>
>     +endif
>
>      LIBS = -lCommon
>
>      ifeq ($(CYGWIN), CYGWIN)
>
>
>
>     Thanks,
>
>     Andrew Fish
>
>
>
>         On Aug 25, 2022, at 10:45 AM, Andrew Fish via groups.io
>         <afish=apple.com@groups.io> <mailto:afish=apple.com@groups.io>
>         wrote:
>
>         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 == clang
>         here [1]
>
>         I think the issue is the check that is wrapping "BUILD_CFLAGS
>         += -Wno-error=stringop-overflow”. 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 = DevicePath.o UefiDevicePathLib.o
>         DevicePathFromText.o DevicePathUtili
>
>          include $(MAKEROOT)/Makefiles/app.makefile
>
>          GCCVERSION = $(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 += -Wno-error=stringop-overflow
>
>          endif
>
>          endif
>
>         +endif
>
>          LIBS = -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
>             <rebecca@bsdio.com> <mailto: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>
>             <mailto: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=stringop-overflow DevicePath.c -o DevicePath.o
>             error: unknown warning option '-Werror=stringop-overflow';
>             did you mean '-Werror=shift-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=/Library/Developer/CommandLineTools/usr
>             --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/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
>
>     
>

[-- Attachment #2: Type: text/html, Size: 67812 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-08-26  1:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-25 16:20 BaseTools no longer builds on macOS: "error: unknown warning option '-Werror=stringop-overflow'" Rebecca Cran
2022-08-25 17:45 ` Andrew Fish
     [not found] ` <170EA793884203D0.22386@groups.io>
2022-08-25 17:49   ` [edk2-devel] " Andrew Fish
2022-08-25 23:13     ` Rebecca Cran
2022-08-25 23:51       ` Michael D Kinney
2022-08-26  1:53         ` 回复: " gaoliming
2022-08-26  7:32         ` Rebecca Cran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox