Skip to content

Commit

Permalink
[DEPRECATION] Drop C++11 support (#2146)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored and cngzhnp committed May 26, 2023
1 parent cfa130b commit ec849a1
Show file tree
Hide file tree
Showing 10 changed files with 128 additions and 34 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ jobs:
path: /home/runner/.cache/bazel
key: bazel_benchmark
- name: setup
env:
GOOGLETEST_VERSION: 1.13.0
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: Run benchmark
id: run_benchmarks
run: |
Expand Down
53 changes: 34 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
GOOGLETEST_VERSION: 1.13.0
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
Expand All @@ -40,7 +41,7 @@ jobs:
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
GOOGLETEST_VERSION: 1.12.1
GOOGLETEST_VERSION: 1.13.0
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
Expand Down Expand Up @@ -74,7 +75,7 @@ jobs:
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
GOOGLETEST_VERSION: 1.12.1
GOOGLETEST_VERSION: 1.13.0
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
Expand Down Expand Up @@ -108,7 +109,7 @@ jobs:
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
GOOGLETEST_VERSION: 1.12.1
GOOGLETEST_VERSION: 1.13.0
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
Expand Down Expand Up @@ -142,7 +143,7 @@ jobs:
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
GOOGLETEST_VERSION: 1.12.1
GOOGLETEST_VERSION: 1.13.0
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
Expand Down Expand Up @@ -190,6 +191,7 @@ jobs:
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
GOOGLETEST_VERSION: 1.13.0
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
Expand All @@ -209,9 +211,11 @@ jobs:
with:
submodules: 'recursive'
- name: setup
env:
GOOGLETEST_VERSION: 1.13.0
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run cmake tests (enable abseil-cpp)
run: |
sudo ./ci/install_abseil.sh
Expand All @@ -225,9 +229,11 @@ jobs:
with:
submodules: 'recursive'
- name: setup
env:
GOOGLETEST_VERSION: 1.13.0
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run cmake tests (enable opentracing-shim)
run: ./ci/do_ci.sh cmake.opentracing_shim.test

Expand All @@ -250,8 +256,8 @@ jobs:
env:
CC: /usr/bin/gcc-4.8
CXX: /usr/bin/g++-4.8
GOOGLETEST_VERSION: "1.10.0"
run: sudo -E ./ci/setup_cmake.sh
run: |
sudo -E ./ci/setup_cmake.sh
- name: run tests
env:
CC: /usr/bin/gcc-4.8
Expand All @@ -277,7 +283,6 @@ jobs:
env:
CC: /usr/bin/gcc-4.8
CXX: /usr/bin/g++-4.8
GOOGLETEST_VERSION: "1.10.0"
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_grpc.sh -v 4.8
Expand All @@ -296,7 +301,8 @@ jobs:
submodules: 'recursive'
- name: setup
env:
CMAKE_VERSION: "3.20.6"
CMAKE_VERSION: 3.20.6
GOOGLETEST_VERSION: 1.13.0
run: |
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
Expand All @@ -317,7 +323,8 @@ jobs:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
CXXFLAGS: "-stdlib=libc++"
CMAKE_VERSION: "3.20.6"
CMAKE_VERSION: 3.20.6
GOOGLETEST_VERSION: 1.13.0
run: |
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
Expand All @@ -342,9 +349,11 @@ jobs:
with:
submodules: 'recursive'
- name: setup
env:
GOOGLETEST_VERSION: 1.13.0
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run otlp exporter tests
run: |
sudo ./ci/setup_grpc.sh
Expand All @@ -358,9 +367,11 @@ jobs:
with:
submodules: 'recursive'
- name: setup
env:
GOOGLETEST_VERSION: 1.13.0
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run otlp exporter tests
run: |
sudo ./ci/setup_grpc.sh
Expand All @@ -374,9 +385,11 @@ jobs:
with:
submodules: 'recursive'
- name: setup
env:
GOOGLETEST_VERSION: 1.13.0
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run otlp exporter tests
run: |
sudo ./ci/setup_grpc.sh -T
Expand All @@ -393,6 +406,7 @@ jobs:
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
GOOGLETEST_VERSION: 1.13.0
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
Expand Down Expand Up @@ -731,6 +745,7 @@ jobs:
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
GOOGLETEST_VERSION: 1.13.0
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ jobs:
run: |
rm -rf third_party
- name: Setup
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
GOOGLETEST_VERSION: 1.13.0
run: |
sudo CC=/usr/bin/gcc-10 CXX=/usr/bin/g++-10 ./ci/setup_cmake.sh
sudo CC=/usr/bin/gcc-10 CXX=/usr/bin/g++-10 ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ Increment the:
[#2097](https://github.com/open-telemetry/opentelemetry-cpp/pull/2097)
* [API] Add user facing Logging API and Benchmarks
[#2094](https://github.com/open-telemetry/opentelemetry-cpp/pull/2094)
* [DEPRECATION] Drop C++11 support
[#2146](https://github.com/open-telemetry/opentelemetry-cpp/pull/2146)

Breaking changes:

Expand All @@ -38,6 +40,8 @@ Breaking changes:
Deprecations:

* The Jaeger Exporter is deprecated, see [DEPRECATED](./DEPRECATED.md) for details.
* C++11 support is to end, C++14 will be supported instead,
see [DEPRECATED](./DEPRECATED.md) for details.

## [1.9.0] 2023-04-12

Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ set(OTELCPP_PROTO_PATH
if(WIN32)
if(BUILD_TESTING)
if(MSVC)
# GTest bug: https://github.com/google/googletest/issues/860
add_compile_options(/wd4275)
# Warning as error: warning STL4036: <ciso646> is removed in C++20
add_compile_options(/wd4996)
endif()
endif()
option(WITH_ETW "Whether to include the ETW Exporter in the SDK" ON)
Expand Down Expand Up @@ -535,6 +535,7 @@ list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}")

include(CTest)
if(BUILD_TESTING)
set(CMAKE_CXX_STANDARD 20)
add_definitions(-DENABLE_TEST)
if(EXISTS ${CMAKE_BINARY_DIR}/lib/libgtest.a)
# Prefer GTest from build tree. GTest is not always working with
Expand Down
61 changes: 60 additions & 1 deletion DEPRECATED.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,66 @@ N/A

## [Compilers]

N/A
### Drop C++11 support

#### Announcement (C++11)

* Date: 2022-12-01
* Issue: [DEPRECATION] Drop C++11 support
[#1830](https://github.com/open-telemetry/opentelemetry-cpp/pull/1830)
* This announcement has been pinned,
visible in the issues pages since December 2022.

#### Motivation (C++11)

This repository, opentelemetry-cpp, supports a "bring your own dependency" model.

In this model,
the build scripts can be configured to:

* pick a given version for a third party library,
* build opentelemetry-cpp with the library given.

The makefiles do not mandate to use a particular version,
hence the "bring your own" denomination.

To have an up to date build, projects are encouraged to use up to date
versions of third party libraries, to benefit from bug fixes.

Now, many libraries deliver new versions that require C++14, bug fixes
releases for C++11 are no longer available.

In particular, the following components:

* GRPC C++
* abseil
* googletest

now require C++14, per
[google support policies](https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md)

As a result, to stay up to date, opentelemetry-cpp needs to upgrade its
minimum build requirements to use C++14 instead of C++11.

#### Scope (C++11)

Continuous Integration (CI) builds will use C++14 instead of C++11.

The CI build for gcc 4.8 is now deprecated, to be decommissioned when C++11
support is dropped.

#### Mitigation (C++11)

Building the code with recent third party libraries will require C++14
instead of C++11.

#### Planned end of life (C++11)

Support for C++11 in opentelemetry-cpp will end on September 2023.

After this date, opentelemetry-cpp may still build properly in C++11 mode,
assuming a suitable, old, version for each dependency is used,
but the C++11 build will no longer be tested for each new release.

## [Third party dependencies]

Expand Down
6 changes: 3 additions & 3 deletions bazel/repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def opentelemetry_cpp_deps():
maybe(
http_archive,
name = "com_google_googletest",
sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2",
strip_prefix = "googletest-release-1.12.1",
sha256 = "ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363",
strip_prefix = "googletest-1.13.0",
urls = [
"https://github.com/google/googletest/archive/release-1.12.1.tar.gz",
"https://github.com/google/googletest/archive/v1.13.0.tar.gz",
],
)

Expand Down
1 change: 1 addition & 0 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ elif [[ "$1" == "cmake.c++20.stl.test" ]]; then
-DWITH_LOGS_PREVIEW=ON \
-DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DCMAKE_CXX_STANDARD=20 \
-DWITH_STL=ON \
"${SRC_DIR}"
make -j $(nproc)
Expand Down
16 changes: 12 additions & 4 deletions ci/setup_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ if [ "x$CMAKE_VERSION" = "x" ]; then
export CMAKE_VERSION=3.15.2
fi

# This variable not set on CI pipeline for only legacy environment(GCC 4.8).
# With 1.13.0 version, C++14 must be set which does not supported by legacy environment anymore.
# Also with this version, release version path needs to be adapted.
if [ "x$GOOGLETEST_VERSION" = "x" ]; then
export GOOGLETEST_VERSION=1.12.1
export GOOGLETEST_VERSION=1.10.0
GOOGLETEST_VERSION_PATH="release-${GOOGLETEST_VERSION}"
GOOGLETEST_FOLDER_PATH="googletest-release-${GOOGLETEST_VERSION}"
else
GOOGLETEST_VERSION_PATH="v${GOOGLETEST_VERSION}"
GOOGLETEST_FOLDER_PATH="googletest-${GOOGLETEST_VERSION}"
fi

cmake_install() {
Expand All @@ -31,9 +39,9 @@ googletest_install() {
# https://gist.github.com/dlime/313f74fd23e4267c4a915086b84c7d3d
tmp_dir=$(mktemp -d)
pushd $tmp_dir
wget https://github.com/google/googletest/archive/release-${GOOGLETEST_VERSION}.tar.gz
tar -xf release-${GOOGLETEST_VERSION}.tar.gz
cd googletest-release-${GOOGLETEST_VERSION}/
wget https://github.com/google/googletest/archive/${GOOGLETEST_VERSION_PATH}.tar.gz
tar -xf ${GOOGLETEST_VERSION_PATH}.tar.gz
cd ${GOOGLETEST_FOLDER_PATH}/
mkdir build && cd build
cmake .. -DBUILD_SHARED_LIBS=ON -DINSTALL_GTEST=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr
make -j $(nproc)
Expand Down
2 changes: 1 addition & 1 deletion third_party_release
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ gRPC=v1.49.2
thrift=0.14.1
abseil=20220623.1
benchmark=v1.7.1
googletest=release-1.12.1
googletest=release-1.13.0
ms-gsl=v3.1.0-67-g6f45293
nlohmann-json=v3.11.2
opentelemetry-proto=v0.19.0
Expand Down

0 comments on commit ec849a1

Please sign in to comment.