[PATCH 24/24] [hack] turn off -Werror


Gerd Hoffmann
 

workaround for this:
CryptoPkg/Library/OpensslLib/openssl/providers/implementations/kdfs/kbkdf.c:49: warning: "MIN" redefined

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
index 7424cd16ac21..0ec925d8b53e 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -16,7 +16,7 @@ [Defines]
VERSION_STRING = 1.0
LIBRARY_CLASS = OpensslLib
DEFINE OPENSSL_PATH = openssl
- DEFINE OPENSSL_FLAGS = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_NO_ASM
+ DEFINE OPENSSL_FLAGS = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_NO_ASM -Wno-error

#
# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
--
2.33.1


Michael D Kinney
 

You should be able to undefine MIN at the right place instead of turning off all warnings as errors.

Mike

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd Hoffmann
Sent: Friday, December 3, 2021 8:08 AM
To: devel@edk2.groups.io
Cc: Yao, Jiewen <jiewen.yao@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; Jiang, Guomin <guomin.jiang@intel.com>;
Pawel Polawski <ppolawsk@redhat.com>; Philippe Mathieu-Daudé <philmd@redhat.com>; Lu, XiaoyuX <xiaoyux.lu@intel.com>; Gerd
Hoffmann <kraxel@redhat.com>
Subject: [edk2-devel] [PATCH 24/24] [hack] turn off -Werror

workaround for this:
CryptoPkg/Library/OpensslLib/openssl/providers/implementations/kdfs/kbkdf.c:49: warning: "MIN" redefined

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
index 7424cd16ac21..0ec925d8b53e 100644
--- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
+++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
@@ -16,7 +16,7 @@ [Defines]
VERSION_STRING = 1.0
LIBRARY_CLASS = OpensslLib
DEFINE OPENSSL_PATH = openssl
- DEFINE OPENSSL_FLAGS = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -
D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_NO_ASM
+ DEFINE OPENSSL_FLAGS = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -
D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_NO_ASM -Wno-error

#
# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
--
2.33.1





Pedro Falcato
 

Mike,

If I get the patch right, it's working around a bug in upstream openssl, which is in a git submodule. That may make it impossible to undefine MIN, unless it comes from one of our headers in edk2 proper.

We also have similar build warning-as-errors with the brotli submodule(s) which have been breaking the build for recent GCC compilers, for months now. I suggest we find a good way to fix these submodule Werrors for once and for all. Maybe having a project-wide policy of disabling Werror in external (submodule) code isn't such a bad idea?

Best regards,
Pedro


On Fri, Dec 3, 2021 at 4:27 PM Michael D Kinney <michael.d.kinney@...> wrote:
You should be able to undefine MIN at the right place instead of turning off all warnings as errors.

Mike

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd Hoffmann
> Sent: Friday, December 3, 2021 8:08 AM
> To: devel@edk2.groups.io
> Cc: Yao, Jiewen <jiewen.yao@...>; Wang, Jian J <jian.j.wang@...>; Jiang, Guomin <guomin.jiang@...>;
> Pawel Polawski <ppolawsk@...>; Philippe Mathieu-Daudé <philmd@...>; Lu, XiaoyuX <xiaoyux.lu@...>; Gerd
> Hoffmann <kraxel@...>
> Subject: [edk2-devel] [PATCH 24/24] [hack] turn off -Werror
>
> workaround for this:
> CryptoPkg/Library/OpensslLib/openssl/providers/implementations/kdfs/kbkdf.c:49: warning: "MIN" redefined
>
> Signed-off-by: Gerd Hoffmann <kraxel@...>
> ---
>  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> index 7424cd16ac21..0ec925d8b53e 100644
> --- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> +++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> @@ -16,7 +16,7 @@ [Defines]
>    VERSION_STRING                 = 1.0
>    LIBRARY_CLASS                  = OpensslLib
>    DEFINE OPENSSL_PATH            = openssl
> -  DEFINE OPENSSL_FLAGS           = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -
> D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_NO_ASM
> +  DEFINE OPENSSL_FLAGS           = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -
> D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_NO_ASM -Wno-error
>
>  #
>  #  VALID_ARCHITECTURES           = IA32 X64 ARM AARCH64
> --
> 2.33.1
>
>
>
>
>








--
Pedro Falcato


Michael D Kinney
 

Hi Pedro,

 

If there are specific issues with specific submodules, I would prefer that we disable only the specific subset of warnings that are triggered by that one project.  Disabling all warnings as errors may hide way too much.

 

The INF file for building a lib that uses submodule content can append CC_FLAGS with specific warning disable.  We did this approach for the Python3 work in edk2-libc.  I think we ran into issue around MIN() macro as well, but I can’t recall exactly how we fixed it.

 

Mike

 

 

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Pedro Falcato
Sent: Friday, December 3, 2021 9:58 AM
To: edk2-devel-groups-io <devel@edk2.groups.io>; Kinney, Michael D <michael.d.kinney@...>
Cc: kraxel@...; Yao, Jiewen <jiewen.yao@...>; Wang, Jian J <jian.j.wang@...>; Jiang, Guomin <guomin.jiang@...>; Pawel Polawski <ppolawsk@...>; Philippe Mathieu-Daudé <philmd@...>; Lu, XiaoyuX <xiaoyux.lu@...>
Subject: Re: [edk2-devel] [PATCH 24/24] [hack] turn off -Werror

 

Mike,

 

If I get the patch right, it's working around a bug in upstream openssl, which is in a git submodule. That may make it impossible to undefine MIN, unless it comes from one of our headers in edk2 proper.

 

We also have similar build warning-as-errors with the brotli submodule(s) which have been breaking the build for recent GCC compilers, for months now. I suggest we find a good way to fix these submodule Werrors for once and for all. Maybe having a project-wide policy of disabling Werror in external (submodule) code isn't such a bad idea?

 

Best regards,

Pedro

 

On Fri, Dec 3, 2021 at 4:27 PM Michael D Kinney <michael.d.kinney@...> wrote:

You should be able to undefine MIN at the right place instead of turning off all warnings as errors.

Mike

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd Hoffmann
> Sent: Friday, December 3, 2021 8:08 AM
> To: devel@edk2.groups.io
> Cc: Yao, Jiewen <jiewen.yao@...>; Wang, Jian J <jian.j.wang@...>; Jiang, Guomin <guomin.jiang@...>;
> Pawel Polawski <ppolawsk@...>; Philippe Mathieu-Daudé <philmd@...>; Lu, XiaoyuX <xiaoyux.lu@...>; Gerd
> Hoffmann <kraxel@...>
> Subject: [edk2-devel] [PATCH 24/24] [hack] turn off -Werror
>
> workaround for this:
> CryptoPkg/Library/OpensslLib/openssl/providers/implementations/kdfs/kbkdf.c:49: warning: "MIN" redefined
>
> Signed-off-by: Gerd Hoffmann <kraxel@...>
> ---
>  CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> index 7424cd16ac21..0ec925d8b53e 100644
> --- a/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> +++ b/CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf
> @@ -16,7 +16,7 @@ [Defines]
>    VERSION_STRING                 = 1.0
>    LIBRARY_CLASS                  = OpensslLib
>    DEFINE OPENSSL_PATH            = openssl
> -  DEFINE OPENSSL_FLAGS           = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -
> D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_NO_ASM
> +  DEFINE OPENSSL_FLAGS           = -DL_ENDIAN -DOPENSSL_SMALL_FOOTPRINT -D_CRT_SECURE_NO_DEPRECATE -
> D_CRT_NONSTDC_NO_DEPRECATE -DOPENSSL_NO_ASM -Wno-error
>
>  #
>  #  VALID_ARCHITECTURES           = IA32 X64 ARM AARCH64
> --
> 2.33.1
>
>
>
>
>







--

Pedro Falcato


Gerd Hoffmann
 

On Fri, Dec 03, 2021 at 04:27:02PM +0000, Michael D Kinney wrote:
You should be able to undefine MIN at the right place instead of turning off all warnings as errors.
Not so easy unfortunately.

Tried that in CryptoPkg/Library/Include/CrtLibSupport.h (which is the
place where all the other #defines to make openssl build for edk2 are).

Result was I got errors elsewhere (BaseCryptLib IIRC) that MIN is
undeclared ...

take care,
Gerd


Gerd Hoffmann
 

On Fri, Dec 03, 2021 at 06:38:52PM +0000, Kinney, Michael D wrote:
Hi Pedro,

If there are specific issues with specific submodules, I would prefer
that we disable only the specific subset of warnings that are
triggered by that one project. Disabling all warnings as errors may
hide way too much.

The INF file for building a lib that uses submodule content can append
CC_FLAGS with specific warning disable. We did this approach for the
Python3 work in edk2-libc. I think we ran into issue around MIN()
macro as well, but I can’t recall exactly how we fixed it.
There are a bunch of these -Wno-error=<something> in
CryptoPkg/Library/OpensslLib/OpensslLib*.inf already.

workaround for this:
CryptoPkg/Library/OpensslLib/openssl/providers/implementations/kdfs/kbkdf.c:49: warning: "MIN" redefined
Couldn't figure whenever there is a switch to turn off this one
specifically. Newer gcc typically prints which -W<name> enables the
warning printed. Not sure why this didn't happen here, maybe because
it is cpp throwing the warning here. The cpp man-page likewise doesn't
help much :(

take care,
Gerd


Gerd Hoffmann
 

On Fri, Dec 03, 2021 at 04:27:02PM +0000, Michael D Kinney wrote:
You should be able to undefine MIN at the right place instead of turning off all warnings as errors.
FYI: trying to get that fixed in openssl upstream.

https://github.com/openssl/openssl/pull/17219

take care,
Gerd