Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bazel: enable rules_foreign_cc vendored tools #20910

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 1 addition & 16 deletions bazel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,8 @@ for how to update or override dependencies.
```console
sudo apt-get install \
autoconf \
automake \
cmake \
curl \
libtool \
make \
ninja-build \
patch \
python3-pip \
unzip \
Expand All @@ -69,13 +65,11 @@ for how to update or override dependencies.
```console
dnf install \
aspell-en \
cmake \
libatomic \
libstdc++ \
libstdc++-static \
libtool \
lld \
ninja-build \
patch \
python3-pip
```
Expand Down Expand Up @@ -105,7 +99,7 @@ for how to update or override dependencies.
### macOS
On macOS, you'll need to install several dependencies. This can be accomplished via [Homebrew](https://brew.sh/):
```console
brew install coreutils wget cmake libtool go bazel automake ninja clang-format autoconf aspell
brew install coreutils wget libtool go bazel clang-format autoconf aspell
```
_notes_: `coreutils` is used for `realpath`, `gmd5sum` and `gsha256sum`

Expand Down Expand Up @@ -202,15 +196,6 @@ for how to update or override dependencies.

The Windows SDK contains header files and libraries you need when building Windows applications. Bazel always uses the latest, but you can specify a different version by setting the environment variable `BAZEL_WINSDK_FULL_VERSION`. See [bazel/windows](https://docs.bazel.build/versions/master/windows.html)

Ensure `CMake` and `ninja` binaries are on the PATH. The versions packaged with VC++ Build
Tools are sufficient in most cases, but are 32 bit binaries. These flavors will not run in
the project's GCP CI remote build environment, so 64 bit builds from the CMake and ninja
projects are used instead.
```cmd
set PATH=%USERPROFILE%\VSBT2019\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin;%PATH%
set PATH=%USERPROFILE%\VSBT2019\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja;%PATH%
```

[MSYS2 shell](https://msys2.github.io/): Install to a path with no spaces, e.g. C:\msys64.

Set the `BAZEL_SH` environment variable to the path of the installed MSYS2 `bash.exe`
Expand Down
3 changes: 1 addition & 2 deletions bazel/dependency_imports.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ load("@emsdk//:emscripten_deps.bzl", "emscripten_deps")
GO_VERSION = "1.17.5"

def envoy_dependency_imports(go_version = GO_VERSION):
# TODO: allow building of tools for easier onboarding
rules_foreign_cc_dependencies(register_default_tools = False, register_built_tools = False)
rules_foreign_cc_dependencies()
go_rules_dependencies()
go_register_toolchains(go_version)
gazelle_dependencies()
Expand Down
4 changes: 2 additions & 2 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,8 @@ REPOSITORY_LOCATIONS_SPEC = dict(
project_name = "Rules for using foreign build systems in Bazel",
project_desc = "Rules for using foreign build systems in Bazel",
project_url = "https://github.com/bazelbuild/rules_foreign_cc",
version = "0.7.1",
sha256 = "bcd0c5f46a49b85b384906daae41d277b3dc0ff27c7c752cc51e43048a58ec83",
version = "c57b55f2f6207c0c44c2b4a51dc235955d4f47b2",
sha256 = "c0c23fdf70c0c71ce684dffc0f6718f8fe760eb22fa66e8a180a9f25175fd7fe",
strip_prefix = "rules_foreign_cc-{version}",
urls = ["https://github.com/bazelbuild/rules_foreign_cc/archive/{version}.tar.gz"],
release_date = "2022-01-03",
Expand Down
8 changes: 4 additions & 4 deletions bazel/setup_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export PATH
RT_LIBRARY_PATH="$(dirname "$(find "$(llvm-config --libdir)" -name libclang_rt.ubsan_standalone_cxx-x86_64.a | head -1)")"

echo "# Generated file, do not edit. If you want to disable clang, just delete this file.
build:clang --action_env='PATH=${PATH}'
build:clang --action_env=CC=clang
build:clang --action_env=CXX=clang++
build:clang --action_env='LLVM_CONFIG=${LLVM_PREFIX}/bin/llvm-config'
build:clang --action_env='PATH=${PATH}' --host_action_env='PATH=${PATH}'
build:clang --action_env=CC=clang --host_action_env=CC=clang
build:clang --action_env=CXX=clang++ --host_action_env=CXX=clang++
build:clang --action_env='LLVM_CONFIG=${LLVM_PREFIX}/bin/llvm-config' --host_action_env='LLVM_CONFIG=${LLVM_PREFIX}/bin/llvm-config'
build:clang --repo_env='LLVM_CONFIG=${LLVM_PREFIX}/bin/llvm-config'
build:clang --linkopt='-L$(llvm-config --libdir)'
build:clang --linkopt='-Wl,-rpath,$(llvm-config --libdir)'
Expand Down