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: Use vendored tools from foreign_cc #27211

Merged
merged 2 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -75,12 +75,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 @@ -92,13 +88,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 @@ -128,7 +122,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 python@3.10
brew install coreutils wget libtool go bazel clang-format autoconf aspell
```
_notes_: `coreutils` is used for `realpath`, `gmd5sum` and `gsha256sum`

Expand Down Expand Up @@ -227,15 +221,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 @@ -23,8 +23,7 @@ JQ_VERSION = "1.6"
YQ_VERSION = "4.24.4"

def envoy_dependency_imports(go_version = GO_VERSION, jq_version = JQ_VERSION, yq_version = YQ_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()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keith if this is still an issue for mac users can we add a select here

it would be really good to get rid of this out of the build image, currently we cant even update it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep I can try today

go_rules_dependencies()
go_register_toolchains(go_version)
envoy_download_go_sdks(go_version)
Expand Down
6 changes: 3 additions & 3 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -870,11 +870,11 @@ 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.8.0",
sha256 = "6041f1374ff32ba711564374ad8e007aef77f71561a7ce784123b9b4b88614fc",
version = "0.9.0",
sha256 = "2a4d07cd64b0719b39a7c12218a3e507672b82a97b98c6a89d38565894cf7c51",
strip_prefix = "rules_foreign_cc-{version}",
urls = ["https://github.com/bazelbuild/rules_foreign_cc/archive/{version}.tar.gz"],
release_date = "2022-04-18",
release_date = "2022-08-02",
use_category = ["build", "dataplane_core", "controlplane"],
license = "Apache-2.0",
license_url = "https://github.com/bazelbuild/rules_foreign_cc/blob/{version}/LICENSE",
Expand Down
8 changes: 4 additions & 4 deletions bazel/setup_clang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ LLVM_TARGET="$(llvm-config --host-target)"
RT_LIBRARY_PATH="${LLVM_LIBDIR}/clang/${LLVM_VERSION}/lib/${LLVM_TARGET}"

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'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably need this one regardless of this change?

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