Skip to content

Build fails with GCC 11 #18816

Open

Description

@jesseschalken

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 and was fixed here, 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

Activity

  1. added
    triage
    on Oct 28, 2021
  2. phlax commented on Oct 28, 2021

    @phlax
    Member

    hi, thanks for reporting this

    i tried following the instructions for updating boringssl from here

    boringssl = dict(
    project_name = "BoringSSL",
    project_desc = "Minimal OpenSSL fork",
    project_url = "https://github.com/google/boringssl",
    # To update BoringSSL, which tracks Chromium releases:
    # 1. Open https://omahaproxy.appspot.com/ and note <current_version> of linux/dev release.
    # 2. Open https://chromium.googlesource.com/chromium/src/+/refs/tags/<current_version>/DEPS and note <boringssl_revision>.
    # 3. Find a commit in BoringSSL's "master-with-bazel" branch that merges <boringssl_revision>.
    #
    # chromium-92.0.4511.0 (linux/dev)
    version = "75edea1922aefe415e0e60ac576116634b0a94f8",

    unfortunately afaict the master-with-bazel branch doesnt have the commit (revision?) suggested (45c8be91f34741b140bcbfc4043795eb14669008)

    not sure if i was following the instructions correctly or how to update this

    cc @moderation @PiotrSikora

  3. added and removed
    triage
    on Oct 28, 2021
  4. phlax commented on Oct 28, 2021

    @phlax
    Member

    wierd, i got an email about a comment, but its not here on the issue

    @phlax I'm not sure where you got 45c8be91f34741b140bcbfc4043795eb14669008 from

    i got this from (following the instructions, but perhaps incorrectly) the boringssl_revision that is set here:

    https://chromium.googlesource.com/chromium/src/+/refs/tags/97.0.4682.3/DEPS#261

    The commit is 92c6fbfc4c44dc8462d260d836020d2b793e7804 which is contained in both master-with-bazel and main-with-bazel.

    im not seeing exactly where you got that hash, but can i suggest opening a PR to update boringssl

  5. jesseschalken commented on Oct 28, 2021

    @jesseschalken
    Author

    @phlax Yes I deleted the comment when I realised the hash was from the Chromium DEPS file.

    google/boringssl@45c8be9 isn't in master-with-bazel but it is in main-with-bazel (I don't know why the Github UI doesn't include main-with-bazel in the list of branches that include the commit).

    $ git branch --all --contains 45c8be91f34741b140bcbfc4043795eb14669008
    * master
      remotes/origin/HEAD -> origin/master
      remotes/origin/main-with-bazel
      remotes/origin/master
    

    I think we're supposed to look at main-with-bazel as master-with-bazel hasn't been updated since July but main-with-bazel has been kept up to date, and at the point that master-with-bazel was last updated, the tree was the same as main-with-bazel (google/boringssl@90bc679 is equal with google/boringssl@fc44652).

    The commit in main-with-bazel that merges google/boringssl@45c8be9 is google/boringssl@1285d53 which I think is the right version to use in repository_locations.bzl.

  6. phlax commented on Oct 28, 2021

    @phlax
    Member

    which I think is the right version to use in repository_locations.bzl.

    sounds like a plan, do you want to PR ?

  7. jesseschalken commented on Oct 28, 2021

    @jesseschalken
    Author

    I am trying but google/boringssl@dddb60e makes X509_STORE_CTX opaque and envoy was assigning to the ctx member in SPIFFEValidator::doVerifyCertChain, and there is no equivelant X509_STORE_CTX_set_ctx function or similar. That breaking change is included in the boringssl_revision pointed to by the current linux/dev chromium release, which is what the comment says to use.

    Can we use any boringssl revision that is used by a released version of chromium? If so then I can just try to find the earliest such revision that includes google/boringssl@92c6fbf.

  8. phlax commented on Oct 28, 2021

    @phlax
    Member

    my suggestion would be to open a PR with the version that works out of the box, and fixes your original issue, with some explanation as to why you have pinned to that version.

    this dep will need review from others, so we can cc them from there

  9. PiotrSikora commented on Oct 28, 2021

    @PiotrSikora
    Contributor

    You could grab BoringSSL version from Chromium 94.0.4606.81 (previous linux/stable), i.e. google/boringssl@519c298 (google/boringssl@648cbaf in main-with-bazel). It predates the breaking change.

  10. github-actions commented on Nov 27, 2021

    @github-actions

    This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged "help wanted" or "no stalebot" or other activity occurs. Thank you for your contributions.

  11. added
    stale
    on Nov 27, 2021
  12. jesseschalken commented on Nov 30, 2021

    @jesseschalken
    Author

    This is still an issue and still should be fixed, but the task that required me to fix this is put on hold. I will try @PiotrSikora's suggestion when I get around to needing to build envoy again.

  13. added
    no stalebot
    and removed
    stale
    on Nov 30, 2021
  14. phlax commented on Nov 30, 2021

    @phlax
    Member

    @jesseschalken thanks for input so far - i reckon we should raise a PR to address this

    @kfaseela is this something you want to look at ? im happy to assist

  15. kfaseela commented on Nov 30, 2021

    @kfaseela
    Contributor

    @phlax I can take a look

  16. kfaseela commented on Dec 1, 2021

    @kfaseela
    Contributor

    @jesseschalken : I tried to pick the latest version as per https://omahaproxy.appspot.com/, and https://chromium.googlesource.com/chromium/src/+/refs/tags/98.0.4710.4/DEPS, however this revision of boring_ssl brings in a breaking change as you already reported above, that needs some refactoring in SPIFFEValidator::doVerifyCertChain in envoy. Hence moved back to 94.0.4606.81 as suggested by @PiotrSikora and that does not seem to have the build issue. PR linked above for your reference. Let me know if it solves your issue.

  17. phlax commented on Dec 1, 2021

    @phlax
    Member

    @jesseschalken as #19152 has hopefully addressed this issue, so this should be fixed

    please do reopen if its still an issue

  18. jesseschalken commented on Dec 1, 2021

    @jesseschalken
    Author

    @kfaseela @phlax Thanks. I tried to build #19152 earlier today and the build still failed because of brotli but not boringssl. So I think the boringssl build failure is fixed but I didn't run it with --keep_going before opening this issue to see that boringssl wasn't the only problem. I started building it with --keep_going to capture all the issues but didn't have time to wait for it to finish.

    I don't have permission to reopen but if this is a general "Build fails with GCC 11" issue I'll put the errors from --keep_going here for the issue to be reopened. Otherwise I'll open another issue.

  19. reopened this on Dec 1, 2021
  20. kfaseela commented on Dec 1, 2021

    @kfaseela
    Contributor

    @jesseschalken please update all the issues which you are hitting afterwards here.

  21. added a commit that references this issue on Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/buildbughelp wantedno stalebot

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions