From 70d3ae8a5e93716cff1136c536691136b02bcd84 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Aug 2021 12:01:23 +0530 Subject: [PATCH 01/12] increment bazel --- .bazelversion | 2 +- .github/workflows/ci.yml | 48 +++++++++++++++++++++------------------- bazel/repository.bzl | 12 +++++----- 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/.bazelversion b/.bazelversion index 0b2eb36f50..ee74734aa2 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -3.7.2 +4.1.0 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 788982121d..a92f7afae9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,29 +128,31 @@ jobs: - name: run tests run: ./ci/do_ci.sh cmake.test_example_plugin - bazel_gcc_48_test: - name: Bazel gcc 4.8 - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: 'recursive' - - name: Mount Bazel Cache - uses: actions/cache@v2 - env: - cache-name: bazel_cache - with: - path: /home/runner/.cache/bazel - key: bazel_gcc_48_test - - name: setup - run: | - sudo ./ci/setup_ci_environment.sh - sudo ./ci/install_bazelisk.sh - sudo ./ci/install_gcc48.sh - - name: run tests - run: ./ci/do_ci.sh bazel.legacy.test - env: - CC: /usr/bin/gcc-4.8 + # bazel build is disabled for gcc 4.8 compiler as grpc lib + # used for otlp exporter doesn't work with gcc4.8 + #bazel_gcc_48_test: + # name: Bazel gcc 4.8 + # runs-on: ubuntu-18.04 + # steps: + # - uses: actions/checkout@v2 + # with: + # submodules: 'recursive' + # - name: Mount Bazel Cache + # uses: actions/cache@v2 + # env: + # cache-name: bazel_cache + # with: + # path: /home/runner/.cache/bazel + # key: bazel_gcc_48_test + # - name: setup + # run: | + # sudo ./ci/setup_ci_environment.sh + # sudo ./ci/install_bazelisk.sh + # sudo ./ci/install_gcc48.sh + # - name: run tests + # run: ./ci/do_ci.sh bazel.legacy.test + # env: + # CC: /usr/bin/gcc-4.8 bazel_test: name: Bazel diff --git a/bazel/repository.bzl b/bazel/repository.bzl index af35dece2d..367d896fed 100644 --- a/bazel/repository.bzl +++ b/bazel/repository.bzl @@ -32,20 +32,20 @@ def opentelemetry_cpp_deps(): maybe( http_archive, name = "com_github_grpc_grpc_legacy", - sha256 = "2060769f2d4b0d3535ba594b2ab614d7f68a492f786ab94b4318788d45e3278a", - strip_prefix = "grpc-1.33.2", + #sha256 = "2060769f2d4b0d3535ba594b2ab614d7f68a492f786ab94b4318788d45e3278a", + strip_prefix = "grpc-1.39.0", urls = [ - "https://github.com/grpc/grpc/archive/v1.33.2.tar.gz", + "https://github.com/grpc/grpc/archive/v1.39.0.tar.gz", ], ) maybe( http_archive, name = "com_github_grpc_grpc", - sha256 = "2060769f2d4b0d3535ba594b2ab614d7f68a492f786ab94b4318788d45e3278a", - strip_prefix = "grpc-1.33.2", + # sha256 = "2060769f2d4b0d3535ba594b2ab614d7f68a492f786ab94b4318788d45e3278a", + strip_prefix = "grpc-1.39.0", urls = [ - "https://github.com/grpc/grpc/archive/v1.33.2.tar.gz", + "https://github.com/grpc/grpc/archive/v1.39.0.tar.gz", ], ) From 415019a96aaafeb5f1e510ca3feaef12116a4bf9 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Aug 2021 12:34:15 +0530 Subject: [PATCH 02/12] fix bazel --- ci/do_ci.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 3c1be05119..02574456bb 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -155,7 +155,7 @@ EOF examples/plugin/load/load_plugin_example ${PLUGIN_DIR}/libexample_plugin.so /dev/null exit 0 elif [[ "$1" == "bazel.test" ]]; then - bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS //... + bazel $BAZEL_STARTUP_OPTIONS build --features=-supports_dynamic_linker $BAZEL_OPTIONS //... bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS //... exit 0 elif [[ "$1" == "bazel.legacy.test" ]]; then From ac84851b16264ac4d7c59594af85006333731715 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Aug 2021 13:21:48 +0530 Subject: [PATCH 03/12] bazel macos fix --- .bazelrc | 4 ++++ ci/do_ci.sh | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index 7a1fead515..bf860b65de 100644 --- a/.bazelrc +++ b/.bazelrc @@ -22,3 +22,7 @@ common:tsan --cc_output_directory_tag=tsan # This is needed to address false positive problem with abseil.The same setting as gRPC # https://github.com/google/sanitizers/issues/953 common:tsan --test_env=TSAN_OPTIONS=report_atomic_races=0 + +# https://github.com/bazelbuild/bazel/issues/4341 +build:macos --features=-supports_dynamic_linker + diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 02574456bb..3c1be05119 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -155,7 +155,7 @@ EOF examples/plugin/load/load_plugin_example ${PLUGIN_DIR}/libexample_plugin.so /dev/null exit 0 elif [[ "$1" == "bazel.test" ]]; then - bazel $BAZEL_STARTUP_OPTIONS build --features=-supports_dynamic_linker $BAZEL_OPTIONS //... + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS //... bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS //... exit 0 elif [[ "$1" == "bazel.legacy.test" ]]; then From 6e2036701b0514a0f503768a87c61354c861ee57 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 17 Aug 2021 18:52:50 +0530 Subject: [PATCH 04/12] revert to old bazel --- .bazelversion | 2 +- ci/install_bazelisk.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.bazelversion b/.bazelversion index ee74734aa2..fcdb2e109f 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -4.1.0 +4.0.0 diff --git a/ci/install_bazelisk.sh b/ci/install_bazelisk.sh index 0c3e90b167..d8b6781775 100755 --- a/ci/install_bazelisk.sh +++ b/ci/install_bazelisk.sh @@ -5,7 +5,7 @@ set -e -BAZELISK_VERSION=v1.7.4 +BAZELISK_VERSION=v1.10.1 wget -O /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/download/$BAZELISK_VERSION/bazelisk-linux-amd64 chmod +x /usr/local/bin/bazel From 2a3fce376c392824b0a3b2d5d9eb319dd18f2c6f Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Wed, 18 Aug 2021 19:47:03 +0530 Subject: [PATCH 05/12] bazel 4.2.0 --- .bazelversion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelversion b/.bazelversion index fcdb2e109f..6aba2b245a 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -4.0.0 +4.2.0 From 6c961fa4466814ebf3d1cda81c524c1d35c6f460 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Wed, 18 Aug 2021 21:27:54 +0530 Subject: [PATCH 06/12] fix --- .bazelrc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.bazelrc b/.bazelrc index bf860b65de..d52f1ea391 100644 --- a/.bazelrc +++ b/.bazelrc @@ -24,5 +24,4 @@ common:tsan --cc_output_directory_tag=tsan common:tsan --test_env=TSAN_OPTIONS=report_atomic_races=0 # https://github.com/bazelbuild/bazel/issues/4341 -build:macos --features=-supports_dynamic_linker - +# build:macos --features=-supports_dynamic_linker \ No newline at end of file From cceca21cfa50f5cd7dc89950e9433165076cd2d6 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Wed, 18 Aug 2021 23:35:51 +0530 Subject: [PATCH 07/12] fix --- bazel/repository.bzl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bazel/repository.bzl b/bazel/repository.bzl index 367d896fed..2290e43053 100644 --- a/bazel/repository.bzl +++ b/bazel/repository.bzl @@ -33,9 +33,9 @@ def opentelemetry_cpp_deps(): http_archive, name = "com_github_grpc_grpc_legacy", #sha256 = "2060769f2d4b0d3535ba594b2ab614d7f68a492f786ab94b4318788d45e3278a", - strip_prefix = "grpc-1.39.0", + strip_prefix = "grpc-1.39.1", urls = [ - "https://github.com/grpc/grpc/archive/v1.39.0.tar.gz", + "https://github.com/grpc/grpc/archive/v1.39.1.tar.gz", ], ) @@ -43,9 +43,9 @@ def opentelemetry_cpp_deps(): http_archive, name = "com_github_grpc_grpc", # sha256 = "2060769f2d4b0d3535ba594b2ab614d7f68a492f786ab94b4318788d45e3278a", - strip_prefix = "grpc-1.39.0", + strip_prefix = "grpc-1.39.1", urls = [ - "https://github.com/grpc/grpc/archive/v1.39.0.tar.gz", + "https://github.com/grpc/grpc/archive/v1.39.1.tar.gz", ], ) From e83898cf525ffde42a145dd8f72560d127b0796f Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Thu, 19 Aug 2021 00:31:05 +0530 Subject: [PATCH 08/12] fix --- .bazelrc | 2 -- .github/workflows/ci.yml | 2 +- ci/do_ci.sh | 9 +++++++++ ci/setup_grpc.sh | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.bazelrc b/.bazelrc index d52f1ea391..7127e8fc0a 100644 --- a/.bazelrc +++ b/.bazelrc @@ -23,5 +23,3 @@ common:tsan --cc_output_directory_tag=tsan # https://github.com/google/sanitizers/issues/953 common:tsan --test_env=TSAN_OPTIONS=report_atomic_races=0 -# https://github.com/bazelbuild/bazel/issues/4341 -# build:macos --features=-supports_dynamic_linker \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a92f7afae9..6581a11ad3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -274,7 +274,7 @@ jobs: path: /Users/runner/.cache/bazel key: bazel_osx - name: run tests - run: ./ci/do_ci.sh bazel.test + run: ./ci/do_ci.sh bazel.macos.test benchmark: name: Benchmark diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 3c1be05119..7dfb2fe983 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -25,6 +25,11 @@ mkdir -p "${PLUGIN_DIR}" BAZEL_OPTIONS="--copt=-DENABLE_METRICS_PREVIEW --copt=-DENABLE_LOGS_PREVIEW" BAZEL_TEST_OPTIONS="$BAZEL_OPTIONS --test_output=errors" + +# https://github.com/bazelbuild/bazel/issues/4341 +BAZEL_MACOS_OPTIONS="$BAZEL_OPRIONS --features=-supports_dynamic_linker" +BAZEL_MACOS_TEST_OPTIONS="$BAZEL_MACOS_OPTIONS --test_output=errors" + BAZEL_STARTUP_OPTIONS="--output_user_root=$HOME/.cache/bazel" export CTEST_OUTPUT_ON_FAILURE=1 @@ -158,6 +163,10 @@ elif [[ "$1" == "bazel.test" ]]; then bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS //... bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS //... exit 0 +elif [[ "$1" == "bazel.macos.test" ]]; then + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_MACOS_OPTIONS //... + bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_MACOS_TEST_OPTIONS //... + exit 0 elif [[ "$1" == "bazel.legacy.test" ]]; then # we uses C++ future and async() function to test the Prometheus Exporter functionality, # that make this test always fail. ignore Prometheus exporter here. diff --git a/ci/setup_grpc.sh b/ci/setup_grpc.sh index f6c1f9885a..f46e38c12c 100755 --- a/ci/setup_grpc.sh +++ b/ci/setup_grpc.sh @@ -6,7 +6,7 @@ set -e export DEBIAN_FRONTEND=noninteractive old_grpc_version='v1.33.2' -new_grpc_version='v1.39.0' +new_grpc_version='v1.39.1' gcc_version_for_new_grpc='5.1' install_grpc_version=${new_grpc_version} grpc_version='v1.39.0' From 79a9a0906580be558fc01f70418e98d297cb3d97 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Thu, 19 Aug 2021 01:07:43 +0530 Subject: [PATCH 09/12] add doc --- .bazelrc | 3 +-- .bazelversion | 2 +- INSTALL.md | 2 ++ README.md | 15 ++++++++++----- bazel/repository.bzl | 4 ++-- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.bazelrc b/.bazelrc index 7127e8fc0a..c266ffda80 100644 --- a/.bazelrc +++ b/.bazelrc @@ -21,5 +21,4 @@ common:tsan --linkopt -fsanitize=thread common:tsan --cc_output_directory_tag=tsan # This is needed to address false positive problem with abseil.The same setting as gRPC # https://github.com/google/sanitizers/issues/953 -common:tsan --test_env=TSAN_OPTIONS=report_atomic_races=0 - +common:tsan --test_env=TSAN_OPTIONS=report_atomic_races=0 \ No newline at end of file diff --git a/.bazelversion b/.bazelversion index 6aba2b245a..ef8d7569d6 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -4.2.0 +4.2.0 \ No newline at end of file diff --git a/INSTALL.md b/INSTALL.md index 27523dc598..b8864911cd 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -133,6 +133,8 @@ target_link_libraries(foo PRIVATE ${OPENTELEMETRY_CPP_LIBRARIES}) ## Build instructions using Bazel +NOTE: Experimental, and not supported for all the components. + ### Prerequisites for Bazel - A supported platform (e.g. Windows, macOS or Linux). diff --git a/README.md b/README.md index 3fea28d577..b1304752d5 100644 --- a/README.md +++ b/README.md @@ -47,11 +47,16 @@ of the current project. Our CI pipeline builds and tests on following `x86-64` platforms: -* ubuntu-18.04 (Default GCC Compiler - 7.5.0) -* ubuntu-18.04 (GCC 4.8 with -std=c++11 flag) -* ubuntu-20.04 (Default GCC Compiler - 9.3.0 with -std=c++20 flags) -* macOS 10.15 (Xcode 12.2) -* Windows Server 2019 (Visual Studio Enterprise 2019) +| Platform | Build type | +|---------------------------------------------------------------------|---------------| +| ubuntu-18.04 (Default GCC Compiler - 7.5.0) | CMake, Bazel | +| ubuntu-18.04 (GCC 4.8 with -std=c++11 flag) | CMake [1] | +| ubuntu-20.04 (Default GCC Compiler - 9.3.0 with -std=c++20 flags) | CMake, Bazel | +| macOS 10.15 (Xcode 12.2) | Bazel | +| Windows Server 2019 (Visual Studio Enterprise 2019) | CMake, Bazel | + +[1]: Bazel build is disabled for GCC 4.8, as GRPC library ( required by OTLP expoter) + doesn't build with this compiler. CMake build won't build OTLP exporter with GCC 4.8. In general, the code shipped from this repository should build on all platforms having C++ compiler with [supported C++ standards](#supported-c-versions). diff --git a/bazel/repository.bzl b/bazel/repository.bzl index 2290e43053..73ea34fce6 100644 --- a/bazel/repository.bzl +++ b/bazel/repository.bzl @@ -32,7 +32,7 @@ def opentelemetry_cpp_deps(): maybe( http_archive, name = "com_github_grpc_grpc_legacy", - #sha256 = "2060769f2d4b0d3535ba594b2ab614d7f68a492f786ab94b4318788d45e3278a", + sha256 = "024118069912358e60722a2b7e507e9c3b51eeaeee06e2dd9d95d9c16f6639ec", strip_prefix = "grpc-1.39.1", urls = [ "https://github.com/grpc/grpc/archive/v1.39.1.tar.gz", @@ -42,7 +42,7 @@ def opentelemetry_cpp_deps(): maybe( http_archive, name = "com_github_grpc_grpc", - # sha256 = "2060769f2d4b0d3535ba594b2ab614d7f68a492f786ab94b4318788d45e3278a", + sha256 = "024118069912358e60722a2b7e507e9c3b51eeaeee06e2dd9d95d9c16f6639ec", strip_prefix = "grpc-1.39.1", urls = [ "https://github.com/grpc/grpc/archive/v1.39.1.tar.gz", From bb9327c81a694485b0ab3d30d678ac2f00946a3f Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Thu, 19 Aug 2021 01:09:36 +0530 Subject: [PATCH 10/12] fix --- .bazelversion | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bazelversion b/.bazelversion index ef8d7569d6..6aba2b245a 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -4.2.0 \ No newline at end of file +4.2.0 From fe5d7820083bd3a84a813fb7fea3b6df892eb27d Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Thu, 19 Aug 2021 01:10:38 +0530 Subject: [PATCH 11/12] add newline --- .bazelrc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.bazelrc b/.bazelrc index c266ffda80..7127e8fc0a 100644 --- a/.bazelrc +++ b/.bazelrc @@ -21,4 +21,5 @@ common:tsan --linkopt -fsanitize=thread common:tsan --cc_output_directory_tag=tsan # This is needed to address false positive problem with abseil.The same setting as gRPC # https://github.com/google/sanitizers/issues/953 -common:tsan --test_env=TSAN_OPTIONS=report_atomic_races=0 \ No newline at end of file +common:tsan --test_env=TSAN_OPTIONS=report_atomic_races=0 + From 4d04d7a555d5b25226333fe6af60b45b5cbfd82c Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Thu, 19 Aug 2021 17:59:17 +0530 Subject: [PATCH 12/12] remove commented workflow --- .github/workflows/ci.yml | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6581a11ad3..514b86ff3b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,32 +128,6 @@ jobs: - name: run tests run: ./ci/do_ci.sh cmake.test_example_plugin - # bazel build is disabled for gcc 4.8 compiler as grpc lib - # used for otlp exporter doesn't work with gcc4.8 - #bazel_gcc_48_test: - # name: Bazel gcc 4.8 - # runs-on: ubuntu-18.04 - # steps: - # - uses: actions/checkout@v2 - # with: - # submodules: 'recursive' - # - name: Mount Bazel Cache - # uses: actions/cache@v2 - # env: - # cache-name: bazel_cache - # with: - # path: /home/runner/.cache/bazel - # key: bazel_gcc_48_test - # - name: setup - # run: | - # sudo ./ci/setup_ci_environment.sh - # sudo ./ci/install_bazelisk.sh - # sudo ./ci/install_gcc48.sh - # - name: run tests - # run: ./ci/do_ci.sh bazel.legacy.test - # env: - # CC: /usr/bin/gcc-4.8 - bazel_test: name: Bazel runs-on: ubuntu-latest