Skip to content

Commit

Permalink
Add _GNU_SOURCE to libevent build for Android builds (#7497)
Browse files Browse the repository at this point in the history
The Android NDK doesn't assume `_GNU_SOURCE`, clang only assumes it for
C++ builds, not C builds. libevent uses `pipe2` which in the NDK is only
exposed in the header when these variables are set. In bazel 0.27.0
these implicit use became an error.

More details:

- envoyproxy/envoy-mobile#116
- libevent/libevent#850

Signed-off-by: Keith Smiley <keithbsmiley@gmail.com>
  • Loading branch information
keith authored and lizan committed Jul 9, 2019
1 parent 5e0130f commit ba0b5a7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bazel/foreign_cc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ envoy_cmake_external(
# doesn't respect custom toolchains such as the Android NDK,
# see https://github.com/bazelbuild/rules_foreign_cc/issues/252
"CMAKE_RANLIB": "",
# Force _GNU_SOURCE on for Android builds. This would be contained in
# a 'select' but the downstream macro uses a select on all of these
# options, and they cannot be nested.
# If https://github.com/bazelbuild/rules_foreign_cc/issues/289 is fixed
# this can be removed.
# More details https://github.com/lyft/envoy-mobile/issues/116
"_GNU_SOURCE": "on",
},
copy_pdb = True,
lib_source = "@com_github_libevent_libevent//:all",
Expand Down

0 comments on commit ba0b5a7

Please sign in to comment.