Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Build fix. (#470)
Browse files Browse the repository at this point in the history
env BAZEL_CXXOPTS=-std=c++14 bazel build //...
now works.
  • Loading branch information
g-easy authored Sep 20, 2022
1 parent 4158a58 commit 050aea2
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 66 deletions.
3 changes: 0 additions & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# bazel configurations for running tests under sanitizers.
# Based on https://github.com/bazelment/trunk/blob/master/tools/bazel.rc

# Needed by gRPC to build on some platforms.
build --copt -DGRPC_BAZEL_BUILD

# --config=asan : Address Sanitizer.
common:asan --copt -fsanitize=address
common:asan --copt -DADDRESS_SANITIZER
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ for stats.
## Language support

* STL is required. (e.g. `libstdc++`, `libc++`, etc)
* C++11 is required.
* C++14 is required.
* [`absl`](https://github.com/abseil/abseil-cpp/) is used for its building blocks.
* [`googletest`](https://github.com/google/googletest/) is used for tests.
* [`benchmark`](https://github.com/google/benchmark/) is used for benchmarking.
Expand Down
48 changes: 4 additions & 44 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -31,59 +31,19 @@ http_archive(
# Only needed for benchmarks, not to build the OpenCensus library.
http_archive(
name = "com_github_google_benchmark",
strip_prefix = "benchmark-master",
urls = ["https://github.com/google/benchmark/archive/master.zip"],
strip_prefix = "benchmark-main",
urls = ["https://github.com/google/benchmark/archive/main.zip"],
)

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

grpc_deps()

http_archive(
name = "rules_python",
strip_prefix = "rules_python-main",
url = "https://github.com/bazelbuild/rules_python/archive/main.zip",
)

# grpc_deps() cannot load() its deps, this WORKSPACE has to do it.
# See also: https://github.com/bazelbuild/bazel/issues/1943
load(
"@build_bazel_rules_apple//apple:repositories.bzl",
"apple_rules_dependencies",
)
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")

apple_rules_dependencies()

load(
"@build_bazel_apple_support//lib:repositories.bzl",
"apple_support_dependencies",
)

apple_support_dependencies()

# Used by prometheus-cpp.
local_repository(
name = "net_zlib_zlib",
path = "tools/zlib",
)
grpc_extra_deps()

# Load Prometheus dependencies.
load("@com_github_jupp0r_prometheus_cpp//bazel:repositories.bzl", "prometheus_cpp_repositories")

prometheus_cpp_repositories()

# Google APIs - used by Stackdriver exporter.
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")

switched_rules_by_language(
name = "com_google_googleapis_imports",
cc = True,
grpc = True,
)

# Needed by @opencensus_proto.
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains()
26 changes: 8 additions & 18 deletions bazel/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
def opencensus_cpp_deps():
"""Loads dependencies need to compile the opencensus-cpp library."""

maybe(
http_archive,
name = "rules_cc",
strip_prefix = "rules_cc-main",
urls = ["https://github.com/bazelbuild/rules_cc/archive/main.zip"],
)

# We depend on Abseil.
maybe(
http_archive,
Expand All @@ -19,6 +12,14 @@ def opencensus_cpp_deps():
urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"],
)

# Abseil depends on skylib.
maybe(
http_archive,
name = "bazel_skylib",
strip_prefix = "bazel-skylib-main",
urls = ["https://github.com/bazelbuild/bazel-skylib/archive/main.zip"],
)

# gRPC
maybe(
http_archive,
Expand Down Expand Up @@ -61,17 +62,6 @@ def opencensus_cpp_deps():
urls = ["https://github.com/googleapis/googleapis/archive/master.zip"],
)

# Needed by opencensus-proto.
maybe(
http_archive,
name = "io_bazel_rules_go",
sha256 = "9fb16af4d4836c8222142e54c9efa0bb5fc562ffc893ce2abeac3e25daead144",
urls = [
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.19.0/rules_go-0.19.0.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/0.19.0/rules_go-0.19.0.tar.gz",
],
)

# OpenCensus proto - used by OcAgent exporter.
maybe(
http_archive,
Expand Down
2 changes: 2 additions & 0 deletions tools/travis/build_bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ if [[ "$TRAVIS_COMPILER" = "clang" ]]; then
export BAZEL_OPTIONS="$BAZEL_OPTIONS --copt=-Werror=thread-safety --copt=-Werror=thread-safety-reference"
fi

export BAZEL_CXXOPTS=-std=c++14

export BAZEL_VERSION="3.7.2"

wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-${BAZEL_OS}-x86_64.sh
Expand Down

0 comments on commit 050aea2

Please sign in to comment.