-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Changes from 17 commits
4955a37
22bed80
92d06f4
7660ca4
7d43192
43be1d7
12a54de
ec8a5ac
0797cd5
feffa2a
c6b4fe4
86b0f67
1c4b8a7
68c5f0c
98ce9d9
d6ae450
8055bad
90af0f8
849325e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,12 @@ repository. | |
|
||
We use the Clang compiler for all CI runs with tests. We have an additional CI run with GCC which builds binary only. | ||
|
||
# C++ standard library | ||
|
||
As of November 2019 after [#8859](https://github.com/envoyproxy/envoy/pull/8859) the official released binary is | ||
[linked against libc++ on Linux](https://github.com/envoyproxy/envoy/blob/master/bazel/README.md#linking-against-libc-on-linux). | ||
To override the C++ standard library in your build, set environment variable `ENVOY_STDLIB` to `libstdc++` or `libc++`. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for being dense but if we have bazelrc configs, why do we also need env variables? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah this is for |
||
|
||
# Building and running tests as a developer | ||
|
||
An example basic invocation to build a developer version of the Envoy static binary (using the Bazel `fastbuild` type) is: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,32 +11,36 @@ export PPROF_PATH=/thirdparty_build/bin/pprof | |
echo "ENVOY_SRCDIR=${ENVOY_SRCDIR}" | ||
|
||
function setup_gcc_toolchain() { | ||
if [[ ! -z "${ENVOY_STDLIB}" && "${ENVOY_STDLIB}" != "libstdc++" ]]; then | ||
echo "gcc toolchain doesn't support ${ENVOY_STDLIB}." | ||
exit 1 | ||
fi | ||
if [[ -z "${ENVOY_RBE}" ]]; then | ||
export CC=gcc | ||
export CXX=g++ | ||
export BAZEL_COMPILER=gcc | ||
echo "$CC/$CXX toolchain configured" | ||
else | ||
export BAZEL_BUILD_OPTIONS="--config=rbe-toolchain-gcc ${BAZEL_BUILD_OPTIONS}" | ||
export BAZEL_BUILD_OPTIONS="--config=remote-gcc ${BAZEL_BUILD_OPTIONS}" | ||
fi | ||
} | ||
|
||
function setup_clang_toolchain() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, I will revise the script. |
||
ENVOY_STDLIB="${ENVOY_STDLIB:-libc++}" | ||
if [[ -z "${ENVOY_RBE}" ]]; then | ||
export BAZEL_BUILD_OPTIONS="--config=clang ${BAZEL_BUILD_OPTIONS}" | ||
else | ||
export BAZEL_BUILD_OPTIONS="--config=rbe-toolchain-clang ${BAZEL_BUILD_OPTIONS}" | ||
fi | ||
echo "clang toolchain configured" | ||
} | ||
|
||
function setup_clang_libcxx_toolchain() { | ||
if [[ -z "${ENVOY_RBE}" ]]; then | ||
export BAZEL_BUILD_OPTIONS="--config=libc++ ${BAZEL_BUILD_OPTIONS}" | ||
if [[ "${ENVOY_STDLIB}" == "libc++" ]]; then | ||
export BAZEL_BUILD_OPTIONS="--config=libc++ ${BAZEL_BUILD_OPTIONS}" | ||
else | ||
export BAZEL_BUILD_OPTIONS="--config=clang ${BAZEL_BUILD_OPTIONS}" | ||
fi | ||
else | ||
export BAZEL_BUILD_OPTIONS="--config=rbe-toolchain-clang-libc++ ${BAZEL_BUILD_OPTIONS}" | ||
if [[ "${ENVOY_STDLIB}" == "libc++" ]]; then | ||
export BAZEL_BUILD_OPTIONS="--config=remote-clang-libc++ ${BAZEL_BUILD_OPTIONS}" | ||
else | ||
export BAZEL_BUILD_OPTIONS="--config=remote-clang ${BAZEL_BUILD_OPTIONS}" | ||
fi | ||
fi | ||
echo "clang toolchain with libc++ configured" | ||
echo "clang toolchain with ${ENVOY_STDLIB} configured" | ||
} | ||
|
||
# Create a fake home. Python site libs tries to do getpwuid(3) if we don't and the CI | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ Version history | |
|
||
1.13.0 (pending) | ||
================ | ||
* build: official released binary is now built against libc++. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. alpha order |
||
* access log: added FILTER_STATE :ref:`access log formatters <config_access_log_format>` and gRPC access logger. | ||
* api: remove all support for v1 | ||
* redis: performance improvement for larger split commands by avoiding string copies. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think what I was wondering before is whether it's possible to just have
--config-libc++
be the default?The issue that I have found in the past is that I don't think there is a way to have a default config and then actual have a local config disable it and replace it with something else?
/wait-any
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will recommend having
--config=libc++
inuser.bazelrc
file to make it default. It is possible to override but not easy, partially because toolchains are also defaulted to libstdc++.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, should we document that somewhere?