Build fails with GCC 11
- Dominant language
- C++
- Stars
- 28.9k
- Forks
- 5.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 437
Description
*Title*: Build fails with GCC 11
*Description*:
Building envoy with GCC 11 fails with the following error. I am testing on Ubuntu 21.10.
```
user1@user1-MS-7B46:~/my_stuff/envoy$ bazel build -c opt envoy
INFO: Analyzed target //:envoy (753 packages loaded, 42550 targets configured).
INFO: Found 1 target...
ERROR: /home/user1/.cache/bazel/_bazel_user1/000cfbe7b945d70ffe5141196905c97b/external/boringssl/BUILD:162:11: Compiling src/crypto/curve25519/curve25519.c failed: (Exit 1): gcc failed: error executing command /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections ... (remaining 41 argument(s) skipped)
Use --sandbox_debug to see verbose messages from the sandbox
external/boringssl/src/crypto/curve25519/curve25519.c:503:57: error: argument 2 of type 'const uint8_t[32]' {aka 'const unsigned char[32]'} with mismatched bound [-Werror=array-parameter=]
503 | int x25519_ge_frombytes_vartime(ge_p3 *h, const uint8_t s[32]) {
| ~~~~~~~~~~~~~~^~~~~
In file included from external/boringssl/src/crypto/curve25519/curve25519.c:33:
external/boringssl/src/crypto/curve25519/internal.h:109:58: note: previously declared as 'const uint8_t *' {aka 'const unsigned char *'}
109 | int x25519_ge_frombytes_vartime(ge_p3 *h, const uint8_t *s);
| ~~~~~~~~~~~~~~~^
external/boringssl/src/crypto/curve25519/curve25519.c:823:57: error: argument 2 of type 'const uint8_t *' {aka 'const unsigned char *'} declared as a pointer [-Werror=array-parameter=]
823 | void x25519_ge_scalarmult_base(ge_p3 *h, const uint8_t *a) {
| ~~~~~~~~~~~~~~~^
In file included from external/boringssl/src/crypto/curve25519/curve25519.c:33:
external/boringssl/src/crypto/curve25519/internal.h:117:56: note: previously declared as an array 'const uint8_t[32]' {aka 'const unsigned char[32]'}
117 | void x25519_ge_scalarmult_base(ge_p3 *h, const uint8_t a[32]);
| ~~~~~~~~~~~~~~^~~~~
cc1: all warnings being treated as errors
Target //source/exe:envoy-static failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 12.226s, Critical Path: 5.53s
INFO: 194 processes: 14 internal, 180 linux-sandbox.
FAILED: Build did NOT complete successfully
user1@user1-MS-7B46:~/my_stuff/envoy$
```
This appears to be a known issue in BoringSSL [here](https://bugs.chromium.org/p/boringssl/issues/detail?id=402) and was fixed [here](https://boringssl.googlesource.com/boringssl/+/92c6fbfc4c44dc8462d260d836020d2b793e7804), so bumping the BoringSSL version is likely to fix it.
*Repro steps*:
1. Use Ubuntu 21.10
2. Build envoy as per the instructions [here](https://github.com/envoyproxy/envoy/blob/98d0394b5e41b8581d55833cd567ddd30ac4cc7f/bazel/README.md#production-environments)
Contributor guide
Assessment
This issue has not been assessed yet.