envoyproxy / envoy-openssl

Envoy OpenSSL extensions
Apache License 2.0
44 stars 39 forks source link

Enabled bazel build for bssl-compat #76

Closed knm3000 closed 1 year ago

knm3000 commented 1 year ago

For now with these changes bssl-compat part can be build with bazel CC=clang CXX=clang++ bazel build --config=clang @bssl-compat//:bssl-compat, but not the whole repo. When trying to build the full envoy-openssl repo with bazel, there are errors from envoy submodule (handshake-related envoy code), will try to work on it in a separate PR.

tedjpoole commented 1 year ago

Works great. However, I don't understand why the bssl-compat/boringssl submodule was updated.

knm3000 commented 1 year ago

@tedjpoole thanks for the review. There are 2 branches of boringssl:

  1. Non bazel default master https://github.com/google/boringssl branch
  2. master-with-bazel https://github.com/google/boringssl/tree/master-with-bazel
 (currently used in envoy-openssl/bssl-compat) The only difference is that master-with-bazel includes extra bazel BUILD/WORKSPACE files and the source code is located in "src" subdirectory https://github.com/google/boringssl/tree/master-with-bazel/src. 
Everything else is the same: all commits from master are automatically merged into master-with-bazel.

bssl-compat has boringssl as a subdirectory, and cmake without bazel works fine.
 But when building it with bazel, everything is copied into bazel sandbox before the build. When bazel finds WORKSPACE file in a subdirectory, it does not copy such subdirectories into the sandbox (probably it considers them as a separate bazel project). Therefore we get an empty bssl-compat/boringssl subdirectory in the sandbox and cmake (that is called from bazel) fails.

To fix this I changed boringssl submodule from master-with-bazel to master branch (the latest commit remains the same: from Jul 19, 2022 “Mostly Revert 52426 - Drop AVCP support for 3DES”):
 master-with-bazel: https://github.com/google/boringssl/tree/098695591f3a2665fccef83a3732ecfc99acdcdd master: https://github.com/google/boringssl/tree/b95124305ab15c7523d3e21437309fa5dd717ee8