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

build: switch to libc++ by default #8859

Merged
merged 19 commits into from
Nov 6, 2019
Merged
Show file tree
Hide file tree
Changes from 10 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
4 changes: 1 addition & 3 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ build:clang-msan --linkopt -fsanitize=memory
build:clang-msan --copt -fsanitize-memory-track-origins=2

# Clang with libc++
# TODO(cmluciano) fix and re-enable _LIBCPP_VERSION testing for TCMALLOC in Envoy::Stats::TestUtil::hasDeterministicMallocStats
# and update stats_integration_test with appropriate m_per_cluster value
build:libc++ --config=clang
build:libc++ --action_env=CXXFLAGS=-stdlib=libc++
build:libc++ --action_env=BAZEL_CXXOPTS=-stdlib=libc++
Expand Down Expand Up @@ -155,7 +153,7 @@ build:remote-ci --remote_cache=grpcs://remotebuildexecution.googleapis.com
build:remote-ci --remote_executor=grpcs://remotebuildexecution.googleapis.com

# Fuzz builds
build:asan-fuzzer --config=asan
build:asan-fuzzer --config=clang-asan
build:asan-fuzzer --define=FUZZING_ENGINE=libfuzzer
build:asan-fuzzer --copt=-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
build:asan-fuzzer --copt=-fsanitize=fuzzer-no-link
Expand Down
3 changes: 1 addition & 2 deletions bazel/envoy_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ def envoy_cc_fuzz_test(
test_lib_name = name + "_lib"
envoy_cc_test_library(
name = test_lib_name,
deps = deps + [
deps = deps + envoy_stdlib_deps() + [
repository + "//test/fuzz:fuzz_runner_lib",
repository + "//bazel:dynamic_stdlib",
],
repository = repository,
tags = tags,
Expand Down
4 changes: 2 additions & 2 deletions ci/build_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function setup_gcc_toolchain() {
fi
}

function setup_clang_toolchain() {
function setup_clang_libstdcxx_toolchain() {
if [[ -z "${ENVOY_RBE}" ]]; then
export BAZEL_BUILD_OPTIONS="--config=clang ${BAZEL_BUILD_OPTIONS}"
else
Expand All @@ -30,7 +30,7 @@ function setup_clang_toolchain() {
echo "clang toolchain configured"
}

function setup_clang_libcxx_toolchain() {
function setup_clang_toolchain() {
Copy link
Member

Choose a reason for hiding this comment

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

Q: Is there any way to make this the default in the core .bazelrc options such that someone could disable it and go back to libstdcxx if they want? This would provide consistency across all builds in general, not just CI builds. I'm not sure if there is a good way to do this though?

/wait-any

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I will revise the script.

if [[ -z "${ENVOY_RBE}" ]]; then
export BAZEL_BUILD_OPTIONS="--config=libc++ ${BAZEL_BUILD_OPTIONS}"
else
Expand Down
2 changes: 1 addition & 1 deletion ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ elif [[ "$CI_TARGET" == "bazel.compile_time_options" ]]; then
--define path_normalization_by_default=true \
--define deprecated_features=disabled \
"
setup_clang_libcxx_toolchain
setup_clang_libstdcxx_toolchain
# This doesn't go into CI but is available for developer convenience.
echo "bazel with different compiletime options build with tests..."

Expand Down
1 change: 1 addition & 0 deletions docs/root/intro/version_history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Version history

1.13.0 (pending)
================
* build: official released binary is now built against libc++.
Copy link
Member

Choose a reason for hiding this comment

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

alpha order

* tcp_proxy: added :ref:`hash_policy<envoy_api_field_config.filter.network.tcp_proxy.v2.TcpProxy.hash_policy>`

1.12.0 (October 31, 2019)
Expand Down
3 changes: 2 additions & 1 deletion test/common/stats/stat_test_utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ MemoryTest::Mode MemoryTest::mode() {
// on some platforms, so try to force-allocate some heap memory
// and determine whether we can measure it.
const size_t start_mem = Memory::Stats::totalCurrentlyAllocated();
volatile std::string long_string("more than 22 chars to exceed libc++ short-string optimization");
volatile std::unique_ptr<std::string> long_string = std::make_unique<std::string>(
"more than 22 chars to exceed libc++ short-string optimization");
const size_t end_mem = Memory::Stats::totalCurrentlyAllocated();
bool can_measure_memory = end_mem > start_mem;

Expand Down
9 changes: 6 additions & 3 deletions test/integration/stats_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ TEST_P(ClusterMemoryTestRunner, MemoryLargeClusterSizeWithFakeSymbolTable) {
// 2019/09/30 8354 43310 44000 Implement transport socket match.
// 2019/10/17 8537 43308 44000 add new enum value HTTP3
// 2019/10/17 8484 43340 44000 stats: add unit support to histogram
// 2019/11/01 8859 43563 44000 build: switch to libc++ by default

// Note: when adjusting this value: EXPECT_MEMORY_EQ is active only in CI
// 'release' builds, where we control the platform and tool-chain. So you
Expand All @@ -270,7 +271,7 @@ TEST_P(ClusterMemoryTestRunner, MemoryLargeClusterSizeWithFakeSymbolTable) {
// If you encounter a failure here, please see
// https://github.com/envoyproxy/envoy/blob/master/source/docs/stats.md#stats-memory-tests
// for details on how to fix.
EXPECT_MEMORY_EQ(m_per_cluster, 43340); // 104 bytes higher than a debug build.
EXPECT_MEMORY_EQ(m_per_cluster, 43563); // 104 bytes higher than a debug build.
EXPECT_MEMORY_LE(m_per_cluster, 44000);
}

Expand Down Expand Up @@ -301,6 +302,7 @@ TEST_P(ClusterMemoryTestRunner, MemoryLargeClusterSizeWithRealSymbolTable) {
// 2019/09/30 8354 34969 35000 Implement transport socket match.
// 2019/10/17 8537 34966 35000 add new enum value HTTP3
// 2019/10/17 8484 34998 35000 stats: add unit support to histogram
// 2019/11/01 8859 35221 36000 build: switch to libc++ by default

// Note: when adjusting this value: EXPECT_MEMORY_EQ is active only in CI
// 'release' builds, where we control the platform and tool-chain. So you
Expand All @@ -314,7 +316,7 @@ TEST_P(ClusterMemoryTestRunner, MemoryLargeClusterSizeWithRealSymbolTable) {
// If you encounter a failure here, please see
// https://github.com/envoyproxy/envoy/blob/master/source/docs/stats.md#stats-memory-tests
// for details on how to fix.
EXPECT_MEMORY_EQ(m_per_cluster, 34998); // 104 bytes higher than a debug build.
EXPECT_MEMORY_EQ(m_per_cluster, 35221); // 104 bytes higher than a debug build.
EXPECT_MEMORY_LE(m_per_cluster, 36000);
}

Expand All @@ -340,6 +342,7 @@ TEST_P(ClusterMemoryTestRunner, MemoryLargeHostSizeWithStats) {
// ---------- ----- ----------------- -----
// 2019/09/09 8189 2739 3100 Initial per-host memory snapshot
// 2019/09/10 8216 1283 1315 Use primitive counters for host stats
// 2019/10/01 8850 1299 1315 build: switch to libc++ by default

// Note: when adjusting this value: EXPECT_MEMORY_EQ is active only in CI
// 'release' builds, where we control the platform and tool-chain. So you
Expand All @@ -349,7 +352,7 @@ TEST_P(ClusterMemoryTestRunner, MemoryLargeHostSizeWithStats) {
// If you encounter a failure here, please see
// https://github.com/envoyproxy/envoy/blob/master/source/docs/stats.md#stats-memory-tests
// for details on how to fix.
EXPECT_MEMORY_EQ(m_per_host, 1283);
EXPECT_MEMORY_EQ(m_per_host, 1299);
EXPECT_MEMORY_LE(m_per_host, 1315);
}

Expand Down